Note: This tutorial assumes that you have completed the previous tutorials: Kobuki Installation. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Examine Kobuki
Description: Start up your Kobuki and see what's going on inside.Keywords: kobuki, start, examine, roslaunch, rostopic
Tutorial Level: BEGINNER
Next Tutorial: Kobuki Diagnostics
Show EOL distros:
New in groovy
Overview
In this tutorial you will learn how to start the basic software for Kobuki, inspect the sensors' state and send commands.
Launch Kobuki
First, start minimal.launch to bring up Kobuki's basic software (bootstrap layer). We use the argument --screen to get verbose output in the terminal.
> roslaunch kobuki_node minimal.launch --screen
This launch file starts a nodelet manager and loads the Kobuki nodelet (the ROS wrapper around Kobuki's driver).
Examine the topics
Next, take a look at Kobuki's topics.
$ rostopic list /diagnostics /diagnostics_agg /diagnostics_toplevel_state /joint_states /mobile_base/commands/digital_output /mobile_base/commands/external_power /mobile_base/commands/led1 /mobile_base/commands/led2 /mobile_base/commands/motor_power /mobile_base/commands/reset_odometry /mobile_base/commands/sound /mobile_base/commands/velocity /mobile_base/debug/raw_data_command /mobile_base/debug/raw_data_stream /mobile_base/events/bumper /mobile_base/events/button /mobile_base/events/cliff /mobile_base/events/digital_input /mobile_base/events/power_system /mobile_base/events/robot_state /mobile_base/events/wheel_drop /mobile_base/sensors/bump_pc /mobile_base/sensors/core /mobile_base/sensors/dock_ir /mobile_base/sensors/imu_data /mobile_base/sensors/imu_data_raw /mobile_base/version_info /odom /rosout /rosout_agg /tf
In Hydro, a couple of new topics joined the list:
/mobile_base/commands/controller_info /mobile_base/controller_info
As you see, Kobuki's data in- and output follows a structure:
<node_name>/sensor/: Continuous streams of the sensor's data (note that /odom and /joints_states are remapped by default, since they are widley used at the highest level/namespace)
<node_name>/events/: If a sensor changes its state, e.g. bumper pressed/released, the new state is published here.
<node_name>/commands/: Use these topics to make Kobuki do things like switch on LEDs, playing sounds and driving around.
<node_name>/debug/: Outputs detailed info about a lot of Kobuki's internals.
Check sensors
Let's try out some topics.
- Check the bumpers: Listen to the bumper topic, then tap one of the bumpers.
$ rostopic echo /mobile_base/events/bumper state: 1 bumper: 2 --- state: 0 bumper: 2 ---
- Check the wheel drop sensors: Listen to the wheel drop sensor topic, then lift up and put down Kobuki.
$ rostopic echo /mobile_base/events/wheel_drop state: 1 wheel: 0 --- state: 1 wheel: 1 --- state: 0 wheel: 0 --- state: 0 wheel: 1 ---
- Check the IMU: Listen to the imu sensor topic, then turn Kobuki.
$ rostopic echo /mobile_base/sensors/imu_data header: seq: 0 stamp: secs: 1355022789 nsecs: 36483345 frame_id: gyro_link orientation: x: 0.0 y: 0.0 z: 0.28769484546 w: 0.957722128749 orientation_covariance: [1.7976931348623157e+308, 0.0, 0.0, 0.0, 1.7976931348623157e+308, 0.0, 0.0, 0.0, 0.005] angular_velocity: x: 0.0 y: 0.0 z: 0.000349065850399 angular_velocity_covariance: [1.7976931348623157e+308, 0.0, 0.0, 0.0, 1.7976931348623157e+308, 0.0, 0.0, 0.0, 0.005] linear_acceleration: x: 0.0 y: 0.0 z: 0.0 linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ---
Trigger stuff
Roboticists want to do things. So, let's do it!
Remark: rostopic pub works create with tab completion!
- Change the color or turn off a LED: Publish to the LED command topic. The available commands are:
- 0 - off
- 1 - green
- 2 - orange
- 3 - red
$ rostopic pub /mobile_base/commands/led1 kobuki_msgs/Led "value: 1" $ rostopic pub /mobile_base/commands/led1 kobuki_msgs/Led "value: 0"
- Play a sound: Publish to the sound command topic. The available sequences are:
- 0 - turn on
- 1 - turn off
- 2 - recharge start
- 3 - press button,
- 4 - error sound
- 5 - start cleaning
- 6 - cleaning end
$ rostopic pub /mobile_base/commands/sound kobuki_msgs/Sound "value: 6"
- Make the turtle snap!: Publish to the velocity command topic.
rostopic pub /mobile_base/commands/velocity geometry_msgs/Twist "linear: x: 0.1 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0"
What's next
Now that you know how to launch the basics and work with Kobuki, it's time to take it for a ride.