Browse Source

Create jogging.md

pull/19/head
Binit Shah 2 months ago
committed by GitHub
parent
commit
53d10b966b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 42 additions and 0 deletions
  1. +42
    -0
      ros2/jogging.md

+ 42
- 0
ros2/jogging.md View File

@ -0,0 +1,42 @@
# 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
node = MyNode()
node.main()
```
Copy the above into a file called "example.py" and run it using:
```{.bash .shell-prompt .copy}
python3 example.py
```

Loading…
Cancel
Save