Gazebo

Gazebo Introduction

Gazebo is an integrated development platform in ROS, consisting of various functional packages for manipulating robotic arms, including motion planning, operation, control, inverse kinematics, 3D perception, and collision detection. It features a realistic world simulation platform and can be used in conjunction with Moveit

Local Setup

1. Operation Process

1.1 Prerequisites

To use this package, you need to install the Python API library first.

pip install pymycobot --user

# Environment:
ros1 noetic

1.2 Package Download and Installation

Download the package to your ROS workspace:

$ cd ~/catkin_ws/src
$ git clone https://github.com/elephantrobotics/mycobot_ros.git
$ cd ~/catkin_ws
$ catkin_make
$ source devel/setup.bash

MyCobot_280_m5-Gazebo Usage Instructions

1. Slider Control

Slider control through joint_state_publisher_gui is now implemented to control the robot arm model pose in Gazebo.

After connecting the real robot arm to the computer, check the port the robot arm is connected to:

ls /dev/tty*
# /dev/ttyACM0 or /dev/ttyUSB0

You will get output similar to:

/dev/tty    /dev/tty26  /dev/tty44  /dev/tty62      /dev/ttyS20
/dev/tty0   /dev/tty27  /dev/tty45  /dev/tty63      /dev/ttyS21
/dev/tty1   /dev/tty28  /dev/tty46  /dev/tty7       /dev/ttyS22
/dev/tty10  /dev/tty29  /dev/tty47  /dev/tty8       /dev/ttyS23
/dev/tty11  /dev/tty3   /dev/tty48  /dev/tty9       /dev/ttyS24
/dev/tty12  /dev/tty30  /dev/tty49  /dev/ttyACM0   (/dev/ttyUSB0)
/dev/tty13  /dev/tty31  /dev/tty5   /dev/ttyprintk  /dev/ttyS26
/dev/tty14  /dev/tty32  /dev/tty50  /dev/ttyS0      /dev/ttyS27
/dev/tty15  /dev/tty33  /dev/tty51  /dev/ttyS1      /dev/ttyS28
/dev/tty16  /dev/tty34  /dev/tty52  /dev/ttyS10     /dev/ttyS29
/dev/tty17  /dev/tty35  /dev/tty53  /dev/ttyS11     /dev/ttyS3
/dev/tty18  /dev/tty36  /dev/tty54  /dev/ttyS12     /dev/ttyS30
/dev/tty19  /dev/tty37  /dev/tty55  /dev/ttyS13     /dev/ttyS31
/dev/tty2   /dev/tty38  /dev/tty56  /dev/ttyS14     /dev/ttyS4
/dev/tty20  /dev/tty39  /dev/tty57  /dev/ttyS15     /dev/ttyS5
/dev/tty21  /dev/tty4   /dev/tty58  /dev/ttyS16     /dev/ttyS6
/dev/tty22  /dev/tty40  /dev/tty59  /dev/ttyS17     /dev/ttyS7
/dev/tty23  /dev/tty41  /dev/tty6   /dev/ttyS18     /dev/ttyS8
/dev/tty24  /dev/tty42  /dev/tty60  /dev/ttyS19     /dev/ttyS9
/dev/tty25  /dev/tty43  /dev/tty61  /dev/ttyS2

Enable communication and add execution permissions to the scripts:

sudo chmod -R 777 /dev/ttyACM0  # or sudo chmod -R 777 /dev/ttyUSB0
sudo chmod -R 777 mycobot_280/mycobot_280m5_gazebo_gripper/scripts/follow_display_gazebo.py
sudo chmod -R 777 mycobot_280/mycobot_280m5_gazebo_gripper/scripts/slider_control_gazebo.py
sudo chmod -R 777 mycobot_280/mycobot_280m5_gazebo_gripper/scripts/teleop_keyboard_gazebo.py
roscore

After confirming the port, open a terminal and enter the following command (remember to change the port to the value found in the previous step):

source devel/setup.bash
roslaunch mycobot_280m5_gazebo_gripper slider.launch _port:=/dev/ttyACM0 _baud:=115200

Then open another terminal and enter:

source devel/setup.bash
rosrun mycobot_280m5_gazebo_gripper slider_control_gazebo.py _port:=/dev/ttyACM0 _baud:=115200

Remember to modify the port number to the one found in the previous step. If successful, you will see the following terminal prompt:

('/dev/ttyACM0', 115200)
spin ...

Now you can control the Gazebo or robot arm model pose by manipulating the joint_state_publisher_gui sliders.


2. Gazebo Model Following

The following commands allow the Gazebo model to follow the actual robot arm's movements. First, run the launch file:

source devel/setup.bash
roslaunch mycobot_280m5_gazebo_gripper follower.launch _port:=/dev/ttyACM0

If the program runs successfully, the Gazebo interface will load the robot arm model with all joints at their original pose, i.e., [0,0,0,0,0,0]. Then open a second terminal and run:

source devel/setup.bash
rosrun mycobot_280m5_gazebo_gripper follow_display_gazebo.py _port:=/dev/ttyACM0 _baud:=115200

Now when you manipulate the actual robot arm's pose, you can see the robot arm in Gazebo moving to the same pose.


3. Keyboard Control

You can also use keyboard input to control both the Gazebo robot arm model and the actual robot arm simultaneously. First, open a terminal and enter:

source devel/setup.bash
roslaunch mycobot_280m5_gazebo_gripper teleop_keyboard.launch _port:=/dev/ttyACM0 _baud:=115200

As in the previous section, you will see the robot arm model loaded in Gazebo with all joints at their initial pose. Then open another terminal and enter:

source devel/setup.bash
rosrun mycobot_280m5_gazebo_gripper teleop_keyboard_gazebo.py _port:=/dev/ttyACM0 _baud:=115200

If successful, you will see the following output in the terminal:

Mycobot_280_m5_gripper Teleop Keyboard Controller
---------------------------
Moving options (control the angle of each joint):

w: joint2_to_joint1++   s: joint2_to_joint1--
e: joint3_to_joint2++   d: joint3_to_joint2--
r: joint4_to_joint3++   f: joint4_to_joint3--
t: joint5_to_joint4++   g: joint5_to_joint4--
y: joint6_to_joint5++   h: joint6_to_joint5--
u: joint6output_to_joint6++ j: joint6output_to_joint6--

o: open gripper          p: close gripper

Other:
1 - Go to home pose
q - Quit

Based on the prompts above, you can learn how to control the robot arm. Each key press moves the robot arm and the Gazebo model by 1 degree. You can try holding down one of the keys to reach a certain pose.

results matching ""

    No results matching ""