-
Notifications
You must be signed in to change notification settings - Fork 106
Object information and recognition tutorial
The following describes how to test the object information pipeline using the example robot consisting of a Jaco arm mounted on a table. You can obtain the packages for the Jaco arm from the repository jaco-arm-pkgs (follow the install instructions on the wiki there).
Step 1. Load required parameters for object information service and fake object recognition
roslaunch gazebo_test_tools gazebo_fake_object_recognition.launch
This sets the required ROS parameters for loading the Gazebo "World plugin" (see also this wiki page), which will be needed as soon as Gazebo is launched.
Step 2. Launch the Jaco arm in Gazebo
In a new terminal, launch the robot with the following launch file:
roslaunch jaco_on_table jaco_on_table_gazebo_controlled.launch
Step 3. Spawn a cube
Spawn a cube named "cube1" into the gazebo world. For example, drop it at height z=1 so that it falls on the table.
Open a new terminal and spawn the cube:
rosrun gazebo_test_tools cube_spawner cube1 0 0 1
This test spawner takes as agruments:
- the name of the cube which you must use later to refer to it
- The x,y,z coordinates where to spawn the cube
Step 4. Test gazebo object information service
Lets now test if the Gazebo object information service is working.
You may use the same terminal which you just used to spawn the cube:
rosrun gazebo_state_plugins gazebo_request_object_info cube1
Details about the cube should be printed.
Step 5. "Recognize" the cube
Now that you know the Gazebo object information service is working, lets try to "recognize" the cube with the fake object recognizer, and set it to continuously publish information about the recognized object, until we tell the fake object recognizer to stop recognizing it.
You can start the fake object recognition for "cube1" with the following command. You may use the same terminal you used to spawn the cube:
rosrun gazebo_test_tools fake_object_recognizer_cmd cube1 1
The last parameter (1="true") sets the fake object recognizer to repeatedly publish the most recent object information.
This should print no errors. Now, see if the messages are being published (print only 5):
rostopic echo -n 5 /gazebo_objects
Note that only the object pose is included in the messages, as only the first message published contained the geometry, and we have missed that first message. This is explained with the node description above.
Now, stop the object recognition (simulate that the robot cannot see the object any more):
rosrun gazebo_test_tools fake_object_recognizer_cmd cube1 0
The 0 stands for "false" and switches off the object recognition for this object. Now, try again to receive messages:
rostopic echo /gazebo_objects
Now, no messages should be printed any more. Exit with Ctrl+C.
Step 6 [optional]. Test it with MoveIt!
The repository moveit-pkgs includes a tutorial to test the pipeline with MoveIt!. See the tutorial on this wiki page if you would like to try it out.