From 2d6ef43f0e52ada23f885f8eb36e02ba0afe4b4d Mon Sep 17 00:00:00 2001 From: zachary Date: Mon, 22 Mar 2021 16:11:16 +0800 Subject: [PATCH] update: ros package support atom 2.6 --- README.md | 61 ++++++++++++++++--------------------------- launch/mycobot.launch | 8 +++--- scripts/display.py | 2 -- scripts/test.py | 13 --------- 4 files changed, 26 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index ac979aa..2fbe776 100644 --- a/README.md +++ b/README.md @@ -73,57 +73,40 @@ python scripts/test.py ### 3.2 Lanuch and Run --**Step 1**: In one terminal, open the core. +- **Use slide bar to control** -```bash -roscore #open another tab -``` + - lanuch ros and rviz --**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** -``` -roslaunch myCobotROS control.launch -``` + - lanuch ros and rviz --**Step 3**: Open rviz to view robot + ``` + roslanuch myCobotRos mycobot.lanuch + ``` -```bash -rosrun rviz rviz -``` + - run python script -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 + ``` + + + ## Q & A diff --git a/launch/mycobot.launch b/launch/mycobot.launch index bc50e7a..ba52b7d 100644 --- a/launch/mycobot.launch +++ b/launch/mycobot.launch @@ -1,10 +1,10 @@ + - - + + + diff --git a/scripts/display.py b/scripts/display.py index 0743c95..28a230d 100755 --- a/scripts/display.py +++ b/scripts/display.py @@ -41,8 +41,6 @@ def talker(): angles = mycobot.get_radians() data_list = [] for index, value in enumerate(angles): - if index != 2: - value *= -1 data_list.append(value) joint_state_send.position = data_list diff --git a/scripts/test.py b/scripts/test.py index ed36c4d..7be8093 100644 --- a/scripts/test.py +++ b/scripts/test.py @@ -8,21 +8,8 @@ if __name__ == '__main__': shell=True).decode() 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') - 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('==> degrees: {}\n'.format(mycobot.get_angles())) time.sleep(0.5)