Skip to content

Object information and recognition

Jennifer Buehler edited this page Feb 28, 2016 · 11 revisions

The recognition of objects when working with Gazebo is handled by two nodes. There is a dataflow of object information between those nodes, which is explained in the following.

Gazebo object information service

The "Gazebo object information service" is a Gazebo world plugin provided in the library libgazebo_object_info.so, which is included in the package gazebo_state_plugins (see also the gazebo_world_plugin_loader wiki page). It provides a ROS service which can be used to request object information.

Check the following ROS parameters which are set by gazebo_state_plugins/launch/plugin_loader.launch:

rosed gazebo_state_plugins GazeboObjectInfo.yaml

  • Pay attention to the topic set in the parameter request_object_service, as you will need to use the same for the fake object recognition described below.
  • publish_world_objects should be set to false, because in the configuration as in the figure above, we are publishing the information from our fake object recognition. Setting this option to true should only be used for test purposes. When false, the setting of world_objects_topic will be ignored.
  • objects_frame_id should be "world", or whatever else is set to be Gazebos top-level world frame.

Fake object recognition

The "fake object recognition" in package gazebo_test_tools can be used to simulate recognition of objects in the scene. For each object recognized, it will send out an object_msgs/Object message (to be found in repository general-message-pkgs) which can be received by any other node which processes recognized objects.

The "fake" recognition of selected objects is achieved by querying the Gazebo object information service to retrieve the most recent state of the object, before it is then published as object_msgs/Object.
The fake object recognition node can be instructed to either

  • continuously repeat the publishing of the most recent information read from Gazebo, or
  • only recognize the object once each time the fake object recognition service (type gazebo_test_tools/RecognizeGazeboObject.srv) is called.

The fake object recognition node is launched with gazebo_test_tools/launch/fake_object_recognizer.launch.

To add an object to be reconized, the following command has to be sent to the fake object recognition:

rosrun gazebo_test_tools fake_object_recognizer_cmd <object name> <repeat>

where <repeat> is 0 or 1 and triggers the repeated, or once-only object recognition action.
Note: Given that the object is expected to move (e.g. after it has been picked up by the robot), it is better to have repeat on true and keep re-publishing the objects most recent state in Gazebo, so that other nodes always have the most recent information. However, this does not model reality very well, as in reality objects are not continusously recognized, e.g. sometimes they cannot be seen. However it is good for test purposes if another nodes always needs to know the most recent object state.

Parameters for the fake object recognizer can be set in

rosed gazebo_test_tools FakeObjectRecognizer.yaml

or whichever other YAML file you decide to use in place of this default.

  • recognize_object_service is the service provided by this node and which is used by the command rosrun gazebo_test_tools fake_object_recognizer_cmd.
  • request_object_service has to be the same as in the Gazebo object information service.

Important
The fake object recognition only sends out the geometry of the object along with the Object.msg the first time the object is detected. Receiving nodes should remember the geometry, as all follow-up messages will only contain the current object pose. This means that only nodes which were already subscribed to /gazebo_objects at the time the object recognition was triggered will have received the geometry.
The implementation of the fake object recogniser can still be improved to send out the geometry of all recognised objects for all new subscribers. However because the fake object recogniser is only a test tool at this stage, this is not of immediate priority.

Additional info

The Gazebo object information service also offers the functionality to publish all gazebo objects such that it continuously sends out Object.msg messages directly, without the "detour" around the fake object recognition. But we want more control, in that we want it to use only the objects which we have explicitly set as "recognized", and only for the duration as they have been set to be "recognized". This more closely mimicks the behaviour of a real object recognition system.