[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes you have a PostgreSQL server installed and running on a local machine. This step is covered in the Installing a PostgreSQL server tutorial..
(!) 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.

Install the household_objects_database on your local database server

Description: Shows how to create the household_objects_database on your local database server, and how to populate it using a backup file from Willow Garage.

Tutorial Level: BEGINNER

Database Creation

Restore the Database from a Backup File

Download the desired version of the database backup file from Willow Garage. You can find the database backup files here:

https://github.com/ros-interactive-manipulation/household_objects_database_backups

In general, if you have an up-to-date installation of cturtle (and thus the manipulation pipeline) it is recommended you use the latest version of the database as well. Note that if a backup file is called *-schema.backup it will only contain the schema of the database, but no data.

After downloading the backup file, go back to pgadmin3. Right-click your newly created database, and click Restore.... Point the dialog to the backup file you downloaded and click OK. Wait for the restoration to finish, then close the dialog.

If the restore option is not present

Using the Database

You must now point the ROS wrapper node for the database at your newly created database. The simplest way of doing this is to create a parameter file, and then a launch file which uses those parameters.

Create your parameter file, called for example some_package_name/config/my_server.yaml. Use the example below, replacing the values with the correct ones for your system:

household_objects_database:
  database_host: myserver.mydomain.com
  database_port: 5432
  database_user: willow
  database_pass: willow
  database_name: household_objects

Then, you can create a launch file to start the database wrapper node:

<launch>

  <!-- load database connection parameters -->
  <rosparam command="load" 
            file="$(find some_package_name)/config/my_server.yaml"/>

  <!-- start the database wrapper node -->
  <node pkg="household_objects_database" name="objects_database_node" 
        type="objects_database_node" respawn="true" output="screen"/>

</launch>

That's it, you are done!

Adding custom model sets to the database

Contained in the database is certain model sets, useful if you do not want to load all models. You can try this out by calling

rosservice call /objects_database_node/get_model_list REDUCED_MODEL_SET 

which should return

return_code: 
  code: -1
model_ids: [18665, 18685, 18691, 18693, 18699, 18744, 18746, 18765, 18766, 18783, 18791, 18798, 18799, 18800, 18802, 18807, 18808] 

In order to create your own model set, you can do this by adding this set to the database. Here's how.

The following SQL query adds a custom model sets:

INSERT INTO model_set (original_model_id, model_set_name)
SELECT original_model_id, 'MY_MODEL_SET'
FROM original_model
WHERE original_model_id IN (
SELECT original_model_id FROM scaled_model
WHERE scaled_model_id IN (18671,18659,18638)
)

In this case it creates a model set called MY_MODEL_SET containing the objects with the IDs 18671, 18659 and 18638. The IDs are the model_id used in the household_objects_database services.

To execute the query, press the play button, or F5 on your keyboard. You should see a message stating that the query executed successfully. You can then test it similar to the service call above, i.e.

rosservice call /objects_database_node/get_model_list MY_MODEL_SET 

which would return the models specified in the SQL query.

To delete your model set from the database, run the following query:

DELETE FROM model_set
WHERE model_set_name='MY_MODEL_SET'


2019-12-07 12:39