update: ros package support atom 2.6

This commit is contained in:
zachary 2021-03-22 16:11:16 +08:00
parent d9ef4d10bd
commit 2d6ef43f0e
4 changed files with 26 additions and 58 deletions

View file

@ -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 ```
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**
``` - lanuch ros and rviz
roslaunch myCobotROS control.launch
```
-**Step 3**: Open rviz to view robot ```
roslanuch myCobotRos mycobot.lanuch
```
```bash - run python script
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. ```
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 rviz rviz -d rospack find myCobotROS/config/mycobot.rviz 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 ## Q & A

View file

@ -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>

View file

@ -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

View file

@ -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)