refacotr: update ros package for Atom2.4 or later.

This commit is contained in:
zhangLijun 2021-01-28 16:30:40 +08:00 committed by 张立军
parent 1f71328852
commit 6d20af3719
5 changed files with 14 additions and 14 deletions

View file

@ -10,10 +10,12 @@
<!-- 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>
> Make sure that `Atom` 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
**If your `Atom` is 2.3 or before, or `pymycobot` is 1.\*, Please check branch [before](https://github.com/elephantrobotics/myCobotRos/tree/before)**
Download ROS [http://wiki.ros.org/ROS/Installation](http://wiki.ros.org/ROS/Installation)
## 1. Installation
@ -22,10 +24,8 @@ Download ROS [http://wiki.ros.org/ROS/Installation](http://wiki.ros.org/ROS/Inst
For using this package, the [Python api](https://github.com/elephantrobotics/pymycobot.git) library should be installed first.
If you want to use api alone, you can look here [https://github.com/elephantrobotics/pymycobot.git](https://github.com/elephantrobotics/pymycobot.git)
```bash
pip install pymycobot==1.0.7
pip install pymycobot --user
```
### 1.2 Package Download and Install

View file

@ -10,9 +10,11 @@
<!-- This is the mycobot ROS package designed by Zhang Lijun([lijun.zhang@elephantrobotics.com]()) -->
> 请确保顶部的 Atom 烧入 `Atom2.1alpha`,底部的 Basic 烧入 `Transponder`。烧录工具的下载地址: [https://github.com/elephantrobotics/myCobot/tree/main/Software](https://github.com/elephantrobotics/myCobot/tree/main/Software)<br>
> 请确保顶部的 Atom 烧入 `Atom`,底部的 Basic 烧入 `Transponder`。烧录工具的下载地址: [https://github.com/elephantrobotics/myCobot/tree/main/Software](https://github.com/elephantrobotics/myCobot/tree/main/Software)<br>
> 该包的测试环境:<br> &nbsp;&nbsp;&nbsp;&nbsp; ubuntu: 16.04LTS<br> &nbsp;&nbsp;&nbsp;&nbsp; ros version: 1.12.17
**如果你的`Atom` 是 2.3 或更早的, 或者 `pymycobot` 是 1.\*, 请查看分支 [before](https://github.com/elephantrobotics/myCobotRos/tree/before)**
ROS 下载地址:[http://wiki.ros.org/ROS/Installation](http://wiki.ros.org/ROS/Installation)
## 1. 安装
@ -21,10 +23,8 @@ ROS 下载地址:[http://wiki.ros.org/ROS/Installation](http://wiki.ros.org/RO
要使用该包,请确保 [python api](https://github.com/elephantrobotics/pymycobot.git) 已正确安装。
如果你仅仅想单独使用 api, 你可以去到这里 [https://github.com/elephantrobotics/pymycobot.git](https://github.com/elephantrobotics/pymycobot.git)
```bash
pip install pymycobot==1.0.7
pip install pymycobot --user
```
### 1.2 Ros 包的下载和安装

View file

@ -209,7 +209,7 @@ def listener():
while not rospy.is_shutdown():
joint_state_send.header.stamp = rospy.Time.now()
angles = mycobot.get_angles_of_radian()
angles = mycobot.get_radians()
rospy.loginfo(angles)
if angles:
data_list = []
@ -228,6 +228,6 @@ def listener():
if __name__ == '__main__':
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
shell=True)
shell=True).decode()
mycobot = MyCobot(port)
listener()

View file

@ -17,7 +17,7 @@ def callback(data):
value *= -1
data_list.append(value)
mc.send_angles_by_radian(data_list, 80)
mc.send_radians(data_list, 80)
# time.sleep(0.5)
def listener():
@ -30,6 +30,6 @@ def listener():
if __name__ == '__main__':
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
shell=True)
shell=True).decode()
mc = MyCobot(port)
listener()

View file

@ -38,7 +38,7 @@ def talker():
while not rospy.is_shutdown():
joint_state_send.header.stamp = rospy.Time.now()
angles = mycobot.get_angles_of_radian()
angles = mycobot.get_radians()
data_list = []
for index, value in enumerate(angles):
if index != 2:
@ -78,7 +78,7 @@ def talker():
if __name__ == '__main__':
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
shell=True)
shell=True).decode()
mycobot = MyCobot(port)
try:
talker()