Skip to content

Commit 5d29c04

Browse files
authored
Merge pull request #19 from hello-robot/docs/jogging
WIP: Quick docs on jogging motion commands
2 parents d0b7652 + 0059ad7 commit 5d29c04

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

mkdocs_rt.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ extra:
8383

8484
nav:
8585
- Getting Started: ./getting_started.md
86+
- Motion Commands: ./jogging.md
8687
- Robot Drivers: ./robot_drivers.md
8788
# - Writing Nodes: ./writing_nodes.md # TODO
8889
- Navigation with Nav2:

ros2/jogging.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Motion Commands in ROS2
2+
3+
## Quickstart
4+
5+
Sending motion commands is as easy as:
6+
7+
1. Launch the ROS2 driver in a terminal:
8+
```{.bash .shell-prompt .copy}
9+
ros2 launch stretch_core stretch_driver.launch.py
10+
```
11+
2. Open iPython and type the following code, one line at a time:
12+
```python
13+
import hello_helpers.hello_misc as hm
14+
node = hm.HelloNode.quick_create('temp')
15+
node.move_to_pose({'joint_lift': 0.4}, blocking=True)
16+
node.move_to_pose({'joint_wrist_yaw': 0.0, 'joint_wrist_roll': 0.0}, blocking=True)
17+
```
18+
19+
## Writing a node
20+
21+
You can also write a ROS2 node to send motion commands:
22+
23+
```python
24+
import hello_helpers.hello_misc as hm
25+
26+
class MyNode(hm.HelloNode):
27+
def __init__(self):
28+
hm.HelloNode.__init__(self)
29+
30+
def main(self):
31+
hm.HelloNode.main(self, 'my_node', 'my_node', wait_for_first_pointcloud=False)
32+
33+
# my_node's main logic goes here
34+
self.move_to_pose({'joint_lift': 0.6}, blocking=True)
35+
self.move_to_pose({'joint_wrist_yaw': -1.0, 'joint_wrist_pitch': -1.0}, blocking=True)
36+
37+
node = MyNode()
38+
node.main()
39+
```
40+
41+
Copy the above into a file called "example.py" and run it using:
42+
43+
```{.bash .shell-prompt .copy}
44+
python3 example.py
45+
```

0 commit comments

Comments
 (0)