Example
Note
This instruction was tested on Ubuntu 16.04
and ROS Kinetic Kame
.
Warning
Make sure to run the Bringup instruction before performing Example.
Warning
Be careful when testing the robot on the table as the robot might fall.
Tip : The example is supposed to be running on the remote PC. Follow the instruction on your Remote PC.
rqt common plugin
The rqt is a Qt-based framework for GUI development for ROS. The rqt is a tool that allows users to easily see the topic status by displaying all the topics in the topic list. There are topic names, types, bandwidth, Hz, value in GUI
[Remote PC] Run the rqt.
$ rqt
Tip : If rqt is not displayed, select the plugin
-> Topics
-> Topic Monitors
.
When rqt is first run, the topic values are not monitored. To monitor the topic, click the checkbox next to each topic.
If you want to see more detail topic message, click the ▶
button next to each checkbox.
/battery_state
indicates a message relating to the battery condition, such as the current battery voltage and remaining capacity.
/diagnostics
indicates a message the status of the components connected to the turtlebot3, such as a MPU9250, a DYNAMIXEL X, a HLS-LFCD-LDS, a battery and a OpenCR.
/odom
indicates a message the odometry of the turtlebot3. This topic has orientation and position by the encoder data.
/sensor_state
indicates a message the encoder values, battery and torque.
/scan
indicates a message all of the LDS data, such as angle_max and min, range_max and min, indicates, ranges.
In addition, you can monitor topics through rqt whenever you have a topic added.
Interactive Markers
Turtlebot3 can be moved by interactive markers on RViz. You can move the turtlebot3 to rotate or linear using interactive markers.
Tip : The terminal application can be found with the Ubuntu search icon on the top left corner of the screen. Shortcut key for terminal is Ctrl-Alt-T.
[Remote PC] Open a new terminal and launch the remote file. If you have TurtleBot3 Burger,
Tip : TB3_MODEL = burger
, waffle
, waffle_pi
$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ roslaunch turtlebot3_bringup turtlebot3_remote.launch
[Remote PC] launch the interactive markers file.
$ roslaunch turtlebot3_example interactive_markers.launch
[Remote PC] Visualize the model in 3D with RViz.
$ rosrun rviz rviz -d `rospack find turtlebot3_example`/rviz/turtlebot3_interactive.rviz
Obstacle Detection
Turtlebot3 can be moved or stopped by LDS data. When the turtlebot3 moves, it stops when it detects an obstacle ahead.
[Remote PC] Run the obstacle file.
$ rosrun turtlebot3_example turtlebot3_obstacle.py
Point operation
Turtlebot3 can be moved by 2D point(x,y) and z-angular. For example, if you insert (0.5, 0.3, 60), turtlebot3 moves to point (x = 0.5m, y = 0.3m) and then rotates 60 deg.
[Remote PC] launch the pointop file.
$ roslaunch turtlebot3_example turtlebot3_pointop_key.launch
Patrol
Turtlebot3 can be moved by custom routes. There are three routes(rectangle, triangle and circle). This example uses action topic. Action client translates patrol data(mode, area, count) to action server. And then action server translates cmd_vel
to turtlebot3.
[Remote PC] Run the patrol server file.
$ rosrun turtlebot3_example turtlebot3_server.py
[Remote PC] Run the patrol client file.
$ rosrun turtlebot3_example turtlebot3_client.py