... | ... | @@ -45,7 +45,7 @@ Turtlebot4 |
|
|
|
|
|
_TurtleBot 4_ is the next-generation of the world’s most popular open-source robotics platform for education and research, offering better computing power, better sensors, and a world-class user experience at an affordable price point.
|
|
|
|
|
|
For this course, the _Turtlebot 4_ is simulated, using a 2D simulator called _simple simulator_, which can run well in thinlinc or the lab computers. The official project uses a 3D simulator, [https://gazebosim.org/](Gazebo), which works poorly on the University computers.
|
|
|
For this course, the _Turtlebot 4_ is simulated, using a 2D simulator called _simple simulator_, which can run well in ThinLinc or the lab computers. The official project uses a 3D simulator, [https://gazebosim.org/](Gazebo), which works poorly on the IDA's computers.
|
|
|
|
|
|
Setup the environment
|
|
|
---------------------
|
... | ... | @@ -64,14 +64,14 @@ kate ~/.bashrc |
|
|
|
|
|
# You need to set your ROS Domain id
|
|
|
|
|
|
To avoid conflict with ROS2, you need to set a unique ROS Domain id:
|
|
|
To avoid conflict with other ROS2 users, you need to set a unique ROS Domain id:
|
|
|
|
|
|
```bash
|
|
|
mkdir -p $HOME/TDDE05
|
|
|
kate $HOME/TDDE05/.domain_id
|
|
|
```
|
|
|
|
|
|
And in the domain id set your group number, so if you are group 12, it should contain ``12``.
|
|
|
And in the domain id set your group number, so if you are in group 12, it should contain ``12``.
|
|
|
|
|
|
# Every time you open a new terminal, before issuing a ROS command, you will need to run:
|
|
|
|
... | ... | @@ -92,7 +92,7 @@ If all went well, the following image should appear: |
|
|
|
|
|
![simple_sim](uploads/303eb34883048aa7deb52ba8d0e7da01/simple_sim.png)
|
|
|
|
|
|
The _red_ dot is the robot. The black square are obstacles and the dots with numbers are semantic objects which are used in an other lab.
|
|
|
The _red_ dot is the robot. The black squares are obstacles, and the dots with numbers are semantic objects used in another lab assignment.
|
|
|
|
|
|
Visualization
|
|
|
-------------
|
... | ... | @@ -126,20 +126,20 @@ You can save your Rviz configuration from the file menu. |
|
|
Send a command to the robot
|
|
|
-------------------------
|
|
|
|
|
|
The robot is ready to take command. The first commands you can send to the robot are for docking and undocking, in a terminal:
|
|
|
The robot is ready to accept commands. The first commands you can send to the robot are for docking and undocking, in a terminal:
|
|
|
|
|
|
```bash
|
|
|
ros2 action send_goal /dock irobot_create_msgs/action/DockServo {}
|
|
|
ros2 action send_goal /undock irobot_create_msgs/action/Undock {}
|
|
|
```
|
|
|
|
|
|
The following action can be used to make the robot move forward by a given velocity:
|
|
|
The following action can be used to make the robot move forward with a given velocity:
|
|
|
|
|
|
```bash
|
|
|
ros2 action send_goal /drive_distance irobot_create_msgs/action/DriveDistance "{ distance: 3.5, max_translation_speed: 0.3 }"
|
|
|
```
|
|
|
|
|
|
The following action can be used to send the robot to a specific position:
|
|
|
The following action can be used to move the robot to a specific position:
|
|
|
|
|
|
```bash
|
|
|
ros2 action send_goal /navigate_to_position irobot_create_msgs/action/NavigateToPosition "{achieve_goal_heading: true,goal_pose:{pose:{position:{x: 3, y: 4,z: 0.0}, orientation:{x: 0.0,y: 0.0, z: 0.0, w: 1.0}}}}"
|
... | ... | @@ -155,9 +155,11 @@ The main communication medium for ROS is through the use of _topics_. Topics hav |
|
|
ros2 topic list
|
|
|
```
|
|
|
|
|
|
If you want detailed information about a topic, to know the type and which nodes are subscribed/publishing:
|
|
|
If you want detailed information about a topic, i.e. to know the type and which nodes are subscribed/publishing use the following parameters with the topic name at the end. For example:
|
|
|
|
|
|
```bash
|
|
|
ros2 topic info -v /cmd_vel
|
|
|
```
|
|
|
|
|
|
You can listen to a topic from the command line to get the values:
|
|
|
|
... | ... | @@ -165,7 +167,7 @@ You can listen to a topic from the command line to get the values: |
|
|
ros2 topic echo /odom
|
|
|
```
|
|
|
|
|
|
To check what is happening, run one of the commands in the previous section, and you should see the position of the robot on the terminal.
|
|
|
To check what is happening, run one of the commands in the previous section, and you should see the position of the robot in the terminal.
|
|
|
|
|
|
And finally, you can publish on a topic:
|
|
|
|
... | ... | @@ -173,7 +175,7 @@ And finally, you can publish on a topic: |
|
|
ros2 topic pub --rate 100 /cmd_vel geometry_msgs/msg/Twist "{ linear: { x: 0.4, y: 0.0, z: 0.0}, angular: { x: 0.0, y: 0.0, z: 0.3 } }"
|
|
|
```
|
|
|
|
|
|
After that command, you should be able to see the robot move in a circle in RViz or the simulator window. You should also be able to see the position changed when listening to ```/odom```.
|
|
|
After that command, you should be able to see the robot move in a circle in RViz or the simulator window. You should also be able to see the position changes when listening to ```/odom``` topic.
|
|
|
|
|
|
RQT
|
|
|
---
|
... | ... | |