Train a new object
Description: This tutorial teaches you how to train a new object with the IPA object detection package.Tutorial Level: BEGINNER
These tutorials require packages that are not open to the public. If you want to run the packages, please write to fmw@ipa.fhg.de . |
If you have Care-O-bot related questions or discover Care-O-bot specific problems please contact us via the Care-O-bot mailinglist.
Contents
Startup a robot
To execute the following tutorial, you have to start either a real or a simulated Care-O-bot. (see cob_bringup or cob_bringup_sim).
Startup packages for Object detection
You must startup a package that generates the necessary input topics for object detection and of course the object detection node.
roslaunch cob_sensor_fusion sensor_fusion_stereo.launch roslaunch cob_object_detection object_detection.launch
Running the train script
In order to train an object named 'milk_box', execute the following command. The resulting object model will be known to the system under the name of 'milk_box'.
rosrun cob_object_detection Train.py milk_box
The script will move the arm in training position and wait for user input in order to give you same time to place the object on top of the gripper. Right now it is best to place a training platform (e.g. a white cube) without features over the gripper with the object on top of it in order to avoid the extraction of feature points from the gripper.
Setting up the object internal coordinate frame
You may approximately specify the coordinate frame of the object model by aligning the object with the coordinate frame of the robot's gripper (have a look into rviz to get an impression of the gripper's coordinate frame sdh_palm_link). In general the resulting object coordinate frame will be at the bottom and in the centre of the minimal axis aligned bounding box enclosing the object. The edges of the object model's bounding box are initially aligned to the gripper's coordinate axis. However, bounding box is automatically rotated by at most 15 degree around each axis to determine a better fitting bounding box and compensate the inaccuracy induced by manual placing the object on top of the gripper.
Spawn the learning platform and a milk box in Gazebo
If you are running the simulated Care-O-bot on gazebo (see cob_bringup) you may execute a launch file to automatically load an object model and the featureless training platform into gazebo at the correct position. You just need to do a
roslaunch cob_object_detection train_load_model.launch model_name:=milk_box
Here, the model name relates to an artificially generated gazebo model located at 'cob_gazebo_worlds/objects'. It may be necessary to execute the script several times until the objects decide to appear at the correct position (you may as well persuade them to stay where they have to by manually moving them with the gazebo tools).
Once the training object is set up, hit enter at the Train.py script to start the image acquisition process.
Start rviz
You can subscribe to topic /object_detection/point_cloud_2 or /object_detection/image to visualise and supervise the training procedure. The sensor_msgs/PointCloud2 message holds 3D information about the sensor data provided to the object detection procedure. This gives you an indication if the object is capture with 3D data by your RGBD device e.g. transparent material usually does not give you any 3D data. Furthermore, the 3D view will show your object model is constructed from different object views by showing you the build up process in a step-by-step procedure. The 2D images published by sensor_msgs/Image message give you an indication of the recorded 2D images used for feature extraction. In general counts: 'the more texture the better'.
Training is over
Once training is done, the object model is published on /object_detection/point_cloud_2 topic. If its shape does correspond to the original model, you may proceed to the object detection tutorial. If not, most likely the object model has had too few feature points for model generation and you may delete the model following the corresponding tutorial.






