mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-05 19:47:04 +00:00
update: ros package support atom 2.6
This commit is contained in:
parent
d9ef4d10bd
commit
2d6ef43f0e
4 changed files with 26 additions and 58 deletions
61
README.md
61
README.md
|
|
@ -73,57 +73,40 @@ python scripts/test.py
|
|||
|
||||
### 3.2 Lanuch and Run
|
||||
|
||||
-**Step 1**: In one terminal, open the core.
|
||||
- **Use slide bar to control**
|
||||
|
||||
```bash
|
||||
roscore #open another tab
|
||||
```
|
||||
- lanuch ros and rviz
|
||||
|
||||
-**Step 2**: Launch
|
||||
```
|
||||
roslanuch myCobotRos control_slider.lanuch
|
||||
```
|
||||
|
||||
a) For display or marker control, in second terminal, run:
|
||||
- run python script
|
||||
|
||||
```bash
|
||||
roslaunch myCobotROS mycobot.launch
|
||||
```
|
||||
```
|
||||
rosrun myCobotROS control_slider.py
|
||||
```
|
||||
|
||||
b) For slider bar control, in second terminal, run:
|
||||
- **The model moves with the real manipulator**
|
||||
|
||||
```
|
||||
roslaunch myCobotROS control.launch
|
||||
```
|
||||
- lanuch ros and rviz
|
||||
|
||||
-**Step 3**: Open rviz to view robot
|
||||
```
|
||||
roslanuch myCobotRos mycobot.lanuch
|
||||
```
|
||||
|
||||
```bash
|
||||
rosrun rviz rviz
|
||||
```
|
||||
- run python script
|
||||
|
||||
If you use the above command, then you may need to manually add some model components. If you don't want to be so troublesome, you can use the following command to load a saved **myCobot** model.
|
||||
```
|
||||
rosrun myCobotROS display.py
|
||||
```
|
||||
|
||||
|
||||
<!-- If you use the above command, then you may need to manually add some model components. If you don't want to be so troublesome, you can use the following command to load a saved **myCobot** model.
|
||||
|
||||
```bash
|
||||
rosrun rviz rviz -d rospack find myCobotROS/config/mycobot.rviz
|
||||
```
|
||||
|
||||
-**Step 4**: Run python script
|
||||
|
||||
a) For display
|
||||
|
||||
```bash
|
||||
rosrun myCobotROS display.py
|
||||
```
|
||||
|
||||
b) For slider bar.
|
||||
|
||||
```bash
|
||||
rosrun myCobotROS control_slider.py
|
||||
```
|
||||
|
||||
c) For marker control
|
||||
|
||||
```bash
|
||||
rosrun myCobotROS control_marker.py
|
||||
```
|
||||
``` -->
|
||||
|
||||
## Q & A
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<launch>
|
||||
<arg name="model" default="$(find myCobotROS)/urdf/mycobot_urdf.urdf"/>
|
||||
<arg name="rvizconfig" default="$(find myCobotROS)/config/mycobot.rviz" />
|
||||
<param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />
|
||||
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
|
||||
|
||||
<!-- <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
|
||||
<param name="use_gui" value="true"/>
|
||||
</node> -->
|
||||
|
||||
<node name="control_slider" pkg="myCobotROS" type="control_slider.py"/>
|
||||
|
||||
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
|
||||
</launch>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ def talker():
|
|||
angles = mycobot.get_radians()
|
||||
data_list = []
|
||||
for index, value in enumerate(angles):
|
||||
if index != 2:
|
||||
value *= -1
|
||||
data_list.append(value)
|
||||
|
||||
joint_state_send.position = data_list
|
||||
|
|
|
|||
|
|
@ -8,21 +8,8 @@ if __name__ == '__main__':
|
|||
shell=True).decode()
|
||||
mycobot = MyCobot(port)
|
||||
|
||||
# port = subprocess.run(['echo -n /dev/ttyUSB*'],
|
||||
# stdout=subprocess.PIPE,
|
||||
# shell=True).stdout.decode('utf-8')
|
||||
# mycobot = MyCobot3(port)
|
||||
|
||||
print('Start check api\n')
|
||||
|
||||
color_name = ['red', 'green', 'blue']
|
||||
color_code = ['ff0000', '00ff00', '0000ff']
|
||||
print('::ser_led_color()')
|
||||
i = random.randint(0, len(color_code) - 1)
|
||||
mycobot.set_led_color(color_code[i])
|
||||
print('==>set color {}\n'.format(color_name[i]))
|
||||
time.sleep(0.5)
|
||||
|
||||
print('::get_angles()')
|
||||
print('==> degrees: {}\n'.format(mycobot.get_angles()))
|
||||
time.sleep(0.5)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue