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
|
### 3.2 Lanuch and Run
|
||||||
|
|
||||||
-**Step 1**: In one terminal, open the core.
|
- **Use slide bar to control**
|
||||||
|
|
||||||
```bash
|
- lanuch ros and rviz
|
||||||
roscore #open another tab
|
|
||||||
```
|
|
||||||
|
|
||||||
-**Step 2**: Launch
|
|
||||||
|
|
||||||
a) For display or marker control, in second terminal, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
roslaunch myCobotROS mycobot.launch
|
|
||||||
```
|
|
||||||
|
|
||||||
b) For slider bar control, in second terminal, run:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
roslaunch myCobotROS control.launch
|
roslanuch myCobotRos control_slider.lanuch
|
||||||
```
|
```
|
||||||
|
|
||||||
-**Step 3**: Open rviz to view robot
|
- run python script
|
||||||
|
|
||||||
```bash
|
|
||||||
rosrun rviz rviz
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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
|
rosrun myCobotROS control_slider.py
|
||||||
```
|
```
|
||||||
|
|
||||||
c) For marker control
|
- **The model moves with the real manipulator**
|
||||||
|
|
||||||
|
- lanuch ros and rviz
|
||||||
|
|
||||||
|
```
|
||||||
|
roslanuch myCobotRos mycobot.lanuch
|
||||||
|
```
|
||||||
|
|
||||||
|
- run python script
|
||||||
|
|
||||||
|
```
|
||||||
|
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
|
```bash
|
||||||
rosrun myCobotROS control_marker.py
|
rosrun rviz rviz -d rospack find myCobotROS/config/mycobot.rviz
|
||||||
```
|
``` -->
|
||||||
|
|
||||||
## Q & A
|
## Q & A
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<launch>
|
<launch>
|
||||||
<arg name="model" default="$(find myCobotROS)/urdf/mycobot_urdf.urdf"/>
|
<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)" />
|
<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="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
|
||||||
|
|
||||||
<!-- <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
|
<node name="control_slider" pkg="myCobotROS" type="control_slider.py"/>
|
||||||
<param name="use_gui" value="true"/>
|
|
||||||
</node> -->
|
|
||||||
|
|
||||||
|
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
|
||||||
</launch>
|
</launch>
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ def talker():
|
||||||
angles = mycobot.get_radians()
|
angles = mycobot.get_radians()
|
||||||
data_list = []
|
data_list = []
|
||||||
for index, value in enumerate(angles):
|
for index, value in enumerate(angles):
|
||||||
if index != 2:
|
|
||||||
value *= -1
|
|
||||||
data_list.append(value)
|
data_list.append(value)
|
||||||
|
|
||||||
joint_state_send.position = data_list
|
joint_state_send.position = data_list
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,8 @@ if __name__ == '__main__':
|
||||||
shell=True).decode()
|
shell=True).decode()
|
||||||
mycobot = MyCobot(port)
|
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')
|
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('::get_angles()')
|
||||||
print('==> degrees: {}\n'.format(mycobot.get_angles()))
|
print('==> degrees: {}\n'.format(mycobot.get_angles()))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue