Skip to content

Commit

Permalink
Merge pull request #19 from hello-robot/docs/jogging
Browse files Browse the repository at this point in the history
WIP: Quick docs on jogging motion commands
  • Loading branch information
hello-binit committed Sep 3, 2024
2 parents d0b7652 + 0059ad7 commit 5d29c04
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions mkdocs_rt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ extra:

nav:
- Getting Started: ./getting_started.md
- Motion Commands: ./jogging.md
- Robot Drivers: ./robot_drivers.md
# - Writing Nodes: ./writing_nodes.md # TODO
- Navigation with Nav2:
Expand Down
45 changes: 45 additions & 0 deletions ros2/jogging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Motion Commands in ROS2

## Quickstart

Sending motion commands is as easy as:

1. Launch the ROS2 driver in a terminal:
```{.bash .shell-prompt .copy}
ros2 launch stretch_core stretch_driver.launch.py
```
2. Open iPython and type the following code, one line at a time:
```python
import hello_helpers.hello_misc as hm
node = hm.HelloNode.quick_create('temp')
node.move_to_pose({'joint_lift': 0.4}, blocking=True)
node.move_to_pose({'joint_wrist_yaw': 0.0, 'joint_wrist_roll': 0.0}, blocking=True)
```

## Writing a node

You can also write a ROS2 node to send motion commands:

```python
import hello_helpers.hello_misc as hm
class MyNode(hm.HelloNode):
def __init__(self):
hm.HelloNode.__init__(self)
def main(self):
hm.HelloNode.main(self, 'my_node', 'my_node', wait_for_first_pointcloud=False)
# my_node's main logic goes here
self.move_to_pose({'joint_lift': 0.6}, blocking=True)
self.move_to_pose({'joint_wrist_yaw': -1.0, 'joint_wrist_pitch': -1.0}, blocking=True)
node = MyNode()
node.main()
```

Copy the above into a file called "example.py" and run it using:

```{.bash .shell-prompt .copy}
python3 example.py
```

0 comments on commit 5d29c04

Please sign in to comment.