mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-14 09:00:53 +00:00
Merge branch 'main' of https://github.com/elephantrobotics/myCobotROS into main
This commit is contained in:
commit
78e95b9135
5 changed files with 28 additions and 12 deletions
|
|
@ -43,7 +43,7 @@ $ catkin_make
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/catkin_ws/src/myCobotROS
|
cd ~/catkin_ws/src/myCobotROS
|
||||||
python3 scripts/test.py
|
python scripts/test.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Package Modules
|
## 2. Package Modules
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ $ catkin_make
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/catkin_ws/src/myCobotROS
|
cd ~/catkin_ws/src/myCobotROS
|
||||||
python3 scripts/test.py
|
python scripts/test.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. 模块
|
## 2. 模块
|
||||||
|
|
|
||||||
14
launch/control_slider.launch
Normal file
14
launch/control_slider.launch
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<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>
|
||||||
|
|
@ -14,10 +14,12 @@
|
||||||
<build_depend>roscpp</build_depend>
|
<build_depend>roscpp</build_depend>
|
||||||
<build_depend>rospy</build_depend>
|
<build_depend>rospy</build_depend>
|
||||||
<build_depend>std_msgs</build_depend>
|
<build_depend>std_msgs</build_depend>
|
||||||
|
<build_depend>serial</build_depend>
|
||||||
|
|
||||||
<exec_depend>roscpp</exec_depend>
|
<exec_depend>roscpp</exec_depend>
|
||||||
<exec_depend>rospy</exec_depend>
|
<exec_depend>rospy</exec_depend>
|
||||||
<exec_depend>std_msgs</exec_depend>
|
<exec_depend>std_msgs</exec_depend>
|
||||||
|
<exec_depend>serial</exec_depend>
|
||||||
|
|
||||||
|
|
||||||
<!-- The export tag contains other, unspecified, tags -->
|
<!-- The export tag contains other, unspecified, tags -->
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import time, random, subprocess
|
import time, random, subprocess
|
||||||
from pymycobot.mycobot import MyCobot
|
from pymycobot.mycobot import MyCobot
|
||||||
# from pythonAPI.mycobot3 import MyCobot as MyCobot3
|
# from pythonAPI.mycobot3 import MyCobot as MyCobot3
|
||||||
from pymycobot.common import Angle, Coord
|
from pymycobot.genre import Angle, Coord
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
|
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
|
||||||
shell=True)
|
shell=True).decode()
|
||||||
mycobot = MyCobot(port)
|
mycobot = MyCobot(port)
|
||||||
|
|
||||||
# port = subprocess.run(['echo -n /dev/ttyUSB*'],
|
# port = subprocess.run(['echo -n /dev/ttyUSB*'],
|
||||||
|
|
@ -17,9 +17,9 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
color_name = ['red', 'green', 'blue']
|
color_name = ['red', 'green', 'blue']
|
||||||
color_code = ['ff0000', '00ff00', '0000ff']
|
color_code = ['ff0000', '00ff00', '0000ff']
|
||||||
print('::ser_color()')
|
print('::ser_led_color()')
|
||||||
i = random.randint(0, len(color_code) - 1)
|
i = random.randint(0, len(color_code) - 1)
|
||||||
mycobot.set_color(color_code[i])
|
mycobot.set_led_color(color_code[i])
|
||||||
print('==>set color {}\n'.format(color_name[i]))
|
print('==>set color {}\n'.format(color_name[i]))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
@ -27,8 +27,8 @@ if __name__ == '__main__':
|
||||||
print('==> degrees: {}\n'.format(mycobot.get_angles()))
|
print('==> degrees: {}\n'.format(mycobot.get_angles()))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
print('::get_angles_of_radian()')
|
print('::get_radians()')
|
||||||
print('==> radians: {}\n'.format(mycobot.get_angles_of_radian()))
|
print('==> radians: {}\n'.format(mycobot.get_radians()))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
print('::send_angles()')
|
print('::send_angles()')
|
||||||
|
|
@ -37,8 +37,8 @@ if __name__ == '__main__':
|
||||||
print('Is moving: {}'.format(mycobot.is_moving()))
|
print('Is moving: {}'.format(mycobot.is_moving()))
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
print('::send_angles_by_radian')
|
print('::send_radians')
|
||||||
mycobot.send_angles_by_radian([1,1,1,1,1,1], 70)
|
mycobot.send_radians([1,1,1,1,1,1], 70)
|
||||||
print('==> set raidans [1,1,1,1,1,1], speed 70\n')
|
print('==> set raidans [1,1,1,1,1,1], speed 70\n')
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ if __name__ == '__main__':
|
||||||
print('==> send coords [160,160,160,0,0,0], speed 70, mode 0\n')
|
print('==> send coords [160,160,160,0,0,0], speed 70, mode 0\n')
|
||||||
time.sleep(3.0)
|
time.sleep(3.0)
|
||||||
|
|
||||||
print(mycobot.is_in_position(coord_list))
|
print(mycobot.is_in_position(coord_list, 1))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
print('::send_coord()')
|
print('::send_coord()')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue