mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-05 19:47:04 +00:00
Merge branch 'main' of https://github.com/elephantrobotics/myCobotROS into main
This commit is contained in:
commit
69c46129c2
7 changed files with 206 additions and 22 deletions
23
README.md
23
README.md
|
|
@ -3,6 +3,7 @@
|
|||
**Notes**:
|
||||
|
||||
<!-- This is the mycobot ROS package designed by Zhang Lijun([lijun.zhang@elephantrobotics.com]()) -->
|
||||
|
||||
> Make sure that `Atom2.1alpha` is flashed into the top Atom and `Transponder` is flashed into the base Basic .The tool download address: [https://github.com/elephantrobotics/myCobot/tree/main/Software](https://github.com/elephantrobotics/myCobot/tree/main/Software)<br>
|
||||
> ubuntu: 16.04LTS<br>
|
||||
> ros version: 1.12.17
|
||||
|
|
@ -14,6 +15,7 @@
|
|||
For using this package, the [api]() library should be installed first.(demo comes with)
|
||||
|
||||
If you want to use api alone, you can look here [https://github.com/elephantrobotics/myCobotROS/blob/main/scripts/pythonAPI/README.md](https://github.com/elephantrobotics/myCobotROS/blob/main/scripts/pythonAPI/README.md)
|
||||
|
||||
### 1.2 Package Download and Install
|
||||
|
||||
Install ros package in your src folder of your Catkin workspace.
|
||||
|
|
@ -28,7 +30,7 @@ $ catkin_make
|
|||
### 1.3 Test API
|
||||
|
||||
```bash
|
||||
cd ~/catkin_ws/src/myCobotRos
|
||||
cd ~/catkin_ws/src/myCobotROS
|
||||
python3 scripts/test.py
|
||||
```
|
||||
|
||||
|
|
@ -57,14 +59,14 @@ If the myCobot color change to red, it's mean the API is working normally.
|
|||
|
||||
- Visualization -- display.launch: This function will display robot arm movement in realtime when you manually move mycobot.
|
||||
|
||||
- Control -- control.launch: This function will allow you use slider bar to control movement of the robot arm.
|
||||
- Control -- control.launch: This function will allow you use slider bar to control movement of the robot arm.
|
||||
|
||||
### 3.2 Lanuch and Run
|
||||
|
||||
-**Step 1**: In one terminal, open the core.
|
||||
|
||||
```bash
|
||||
rocore #open another tab
|
||||
roscore #open another tab
|
||||
```
|
||||
|
||||
-**Step 2**: Launch
|
||||
|
|
@ -87,25 +89,34 @@ roslaunch myCobotROS control.launch
|
|||
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
|
||||
rosrun myCobotROS display.py
|
||||
```
|
||||
|
||||
b) For slider bar.
|
||||
|
||||
```bash
|
||||
rosrun myCobotRos control_slider.py
|
||||
rosrun myCobotROS control_slider.py
|
||||
```
|
||||
|
||||
c) For marker control
|
||||
|
||||
```bash
|
||||
rosrun myCobots control_marker.py
|
||||
rosrun myCobotROS control_marker.py
|
||||
```
|
||||
|
||||
## Q & A
|
||||
|
||||
**Q: error[101]**
|
||||
|
||||
**A:** Make sure that the serial port is not occupied, and that the correct firmware is burned in for atom and basic
|
||||
|
|
|
|||
171
config/mycobot.rviz
Normal file
171
config/mycobot.rviz
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
Panels:
|
||||
- Class: rviz/Displays
|
||||
Help Height: 78
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 591
|
||||
- Class: rviz/Selection
|
||||
Name: Selection
|
||||
- Class: rviz/Tool Properties
|
||||
Expanded:
|
||||
- /2D Pose Estimate1
|
||||
- /2D Nav Goal1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
- Class: rviz/Time
|
||||
Experimental: false
|
||||
Name: Time
|
||||
SyncMode: 0
|
||||
SyncSource: ""
|
||||
Preferences:
|
||||
PromptSaveOnExit: true
|
||||
Toolbars:
|
||||
toolButtonStyle: 2
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
- Alpha: 1
|
||||
Class: rviz/RobotModel
|
||||
Collision Enabled: false
|
||||
Enabled: true
|
||||
Links:
|
||||
All Links Enabled: true
|
||||
Expand Joint Details: false
|
||||
Expand Link Details: false
|
||||
Expand Tree: false
|
||||
Link Tree Style: Links in Alphabetic Order
|
||||
joint1:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint2:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint3:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint4:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint5:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint6:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
joint6_flange:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
Name: RobotModel
|
||||
Robot Description: robot_description
|
||||
TF Prefix: ""
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
Visual Enabled: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Default Light: true
|
||||
Fixed Frame: joint1
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz/MoveCamera
|
||||
- Class: rviz/Select
|
||||
- Class: rviz/FocusCamera
|
||||
- Class: rviz/Measure
|
||||
- Class: rviz/SetInitialPose
|
||||
Theta std deviation: 0.2617993950843811
|
||||
Topic: /initialpose
|
||||
X std deviation: 0.5
|
||||
Y std deviation: 0.5
|
||||
- Class: rviz/SetGoal
|
||||
Topic: /move_base_simple/goal
|
||||
- Class: rviz/PublishPoint
|
||||
Single click: true
|
||||
Topic: /clicked_point
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz/Orbit
|
||||
Distance: 1.2028908729553223
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: -0.07064759731292725
|
||||
Y: -0.0814988762140274
|
||||
Z: 0.10758385062217712
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.35539841651916504
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 0.7703980207443237
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 885
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd000000040000000000000156000002d9fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003c000002d9000000c800fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002d9fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003c000002d9000000a200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005240000003efc0100000002fb0000000800540069006d00650100000000000005240000029800fffffffb0000000800540069006d00650100000000000004500000000000000000000002b3000002d900000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
Time:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1316
|
||||
X: 349
|
||||
Y: 42
|
||||
0
scripts/control_marker.py
Normal file → Executable file
0
scripts/control_marker.py
Normal file → Executable file
0
scripts/pythonAPI/__init__.py
Normal file → Executable file
0
scripts/pythonAPI/__init__.py
Normal file → Executable file
24
scripts/pythonAPI/common.py
Normal file → Executable file
24
scripts/pythonAPI/common.py
Normal file → Executable file
|
|
@ -1,18 +1,18 @@
|
|||
import enum
|
||||
|
||||
class Angle(enum.Enum):
|
||||
J1 = '00'
|
||||
J2 = '01'
|
||||
J3 = '02'
|
||||
J4 = '03'
|
||||
J5 = '04'
|
||||
J6 = '05'
|
||||
J1 = '01'
|
||||
J2 = '02'
|
||||
J3 = '03'
|
||||
J4 = '04'
|
||||
J5 = '05'
|
||||
J6 = '06'
|
||||
|
||||
|
||||
class Coord(enum.Enum):
|
||||
X = '00'
|
||||
Y = '01'
|
||||
Z = '02'
|
||||
Rx = '03'
|
||||
Ry = '04'
|
||||
Rz = '05'
|
||||
X = '01'
|
||||
Y = '02'
|
||||
Z = '03'
|
||||
Rx = '04'
|
||||
Ry = '05'
|
||||
Rz = '06'
|
||||
|
|
|
|||
5
scripts/pythonAPI/mycobot.py
Normal file → Executable file
5
scripts/pythonAPI/mycobot.py
Normal file → Executable file
|
|
@ -94,7 +94,8 @@ class MyCobot():
|
|||
|
||||
'''
|
||||
_hex = self._angle_to_hex(degree)
|
||||
command = 'fefe0621{}{}{}fa'.format(id, _hex, hex(speed)[2:])
|
||||
speed = self._complement_zero(hex(speed)[2:], digit=2)
|
||||
command = 'fefe0621{}{}{}fa'.format(id, _hex, speed)
|
||||
# print(command)
|
||||
self._write(command)
|
||||
|
||||
|
|
@ -353,4 +354,4 @@ class MyCobot():
|
|||
|
||||
def _read(self, size=1024):
|
||||
data = self.serial_port.read(size)
|
||||
return data
|
||||
return data
|
||||
|
|
|
|||
5
scripts/pythonAPI/mycobot3.py
Normal file → Executable file
5
scripts/pythonAPI/mycobot3.py
Normal file → Executable file
|
|
@ -95,7 +95,8 @@ class MyCobot():
|
|||
|
||||
'''
|
||||
_hex = self._angle_to_hex(degree)
|
||||
command = 'fefe0621{}{}{}fa'.format(id, _hex, hex(speed)[2:])
|
||||
speed = self._complement_zero(hex(speed)[2:], digit=2)
|
||||
command = 'fefe0621{}{}{}fa'.format(id, _hex, speed)
|
||||
# print(command)
|
||||
self._write(command)
|
||||
|
||||
|
|
@ -354,4 +355,4 @@ class MyCobot():
|
|||
|
||||
def _read(self, size: int=1024):
|
||||
data = self.serial_port.read(size)
|
||||
return data
|
||||
return data
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue