database_capture_region.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the Willow Garage nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************/
00034 
00035 // Author(s): Mehmet Dogar (mdogar@cs.cmu.edu)
00036 
00037 #ifndef _DATABASE_CAPTURE_REGION_H_
00038 #define _DATABASE_CAPTURE_REGION_H_
00039 
00040 #include <iostream>
00041 
00042 #include <geometry_msgs/Pose.h>
00043 
00044 #include <database_interface/db_class.h>
00045 
00046 #include <boost/shared_ptr.hpp>
00047 
00048 #include "household_objects_database/database_helper_classes.h"
00049 
00050 namespace household_objects_database {
00051 
00053 class DatabaseCaptureRegion : public database_interface::DBClass
00054 {
00055  private:
00056 
00057  public:
00059   database_interface::DBField<int> id_;
00060 
00062   database_interface::DBField<int> scaled_model_id_;
00063 
00065   database_interface::DBField<std::string> object_description_;
00067   database_interface::DBField<std::string> object_geometry_hash_;
00069   database_interface::DBField<std::string> robot_geometry_hash_;
00070 
00072   database_interface::DBField<double> hand_object_coefficient_of_friction_;
00074   database_interface::DBField<double> pushing_distance_;
00076   database_interface::DBField<double> in_hand_distance_;
00077 
00079   database_interface::DBField<double> y_resolution_;
00081   database_interface::DBField<double> start_y_offset_;
00083   database_interface::DBField<int> n_y_steps_;
00084 
00086   database_interface::DBField<double> rotation_resolution_;
00088   database_interface::DBField<int> n_rotations_;
00089 
00091   database_interface::DBField< std::vector< std::vector< double > > > left_pushing_distances_;
00093   database_interface::DBField< std::vector< std::vector< double > > > right_pushing_distances_;
00094 
00096   database_interface::DBField< std::vector< std::vector< int > > > left_pushing_roll_sides_;
00098   database_interface::DBField< std::vector< std::vector< int > > > right_pushing_roll_sides_;
00099 
00101   database_interface::DBField<double> radius_of_cylinder_bounding_the_object_;
00103   database_interface::DBField<DatabasePose> capture_region_computation_frame_in_object_frame_;
00104 
00106   database_interface::DBField<double> fingertip_frame_to_pushing_surface_distance_;
00108   database_interface::DBField<double> finger_padding_;
00109 
00110 
00112   DatabaseCaptureRegion() :
00113     id_(database_interface::DBFieldBase::TEXT, this, "capture_region_id", "capture_region", true),
00114     scaled_model_id_(database_interface::DBFieldBase::TEXT, this, "scaled_model_id", "capture_region", true),
00115     object_description_(database_interface::DBFieldBase::TEXT, this, "object_description", "capture_region", true),
00116     object_geometry_hash_(database_interface::DBFieldBase::TEXT, this, "object_geometry_hash", "capture_region", true),
00117     robot_geometry_hash_(database_interface::DBFieldBase::TEXT, this, "robot_geometry_hash", "capture_region", true),
00118     hand_object_coefficient_of_friction_(database_interface::DBFieldBase::TEXT, this, "hand_object_coefficient_of_friction", "capture_region", true),
00119     pushing_distance_(database_interface::DBFieldBase::TEXT, this, "pushing_distance", "capture_region", true),
00120     in_hand_distance_(database_interface::DBFieldBase::TEXT, this, "in_hand_distance", "capture_region", true),
00121     y_resolution_(database_interface::DBFieldBase::TEXT, this, "y_resolution", "capture_region", true),
00122     start_y_offset_(database_interface::DBFieldBase::TEXT, this, "start_y_offset", "capture_region", true),
00123     n_y_steps_(database_interface::DBFieldBase::TEXT, this, "n_y_steps", "capture_region", true),
00124     rotation_resolution_(database_interface::DBFieldBase::TEXT, this, "rotation_resolution", "capture_region", true),
00125     n_rotations_(database_interface::DBFieldBase::TEXT, this, "n_rotations", "capture_region", true),
00126     left_pushing_distances_(database_interface::DBFieldBase::TEXT, this, "left_pushing_distances", "capture_region", true),
00127     right_pushing_distances_(database_interface::DBFieldBase::TEXT, this, "right_pushing_distances", "capture_region", true),
00128     left_pushing_roll_sides_(database_interface::DBFieldBase::TEXT, this, "left_pushing_roll_sides", "capture_region", true),
00129     right_pushing_roll_sides_(database_interface::DBFieldBase::TEXT, this, "right_pushing_roll_sides", "capture_region", true),
00130     radius_of_cylinder_bounding_the_object_(database_interface::DBFieldBase::TEXT, this, "radius_of_cylinder_bounding_the_object", "capture_region", true),
00131     capture_region_computation_frame_in_object_frame_(database_interface::DBFieldBase::TEXT, this, "capture_region_computation_frame_in_object_frame", "capture_region", true),
00132     fingertip_frame_to_pushing_surface_distance_(database_interface::DBFieldBase::TEXT, this, "fingertip_frame_to_pushing_surface_distance", "capture_region", true),
00133     finger_padding_(database_interface::DBFieldBase::TEXT, this, "finger_padding", "capture_region", true)
00134   {
00135     //primary key field
00136     primary_key_field_ = &id_;
00137     //all the other fields
00138     fields_.push_back(&scaled_model_id_);
00139     fields_.push_back(&object_description_);
00140     fields_.push_back(&object_geometry_hash_);
00141     fields_.push_back(&robot_geometry_hash_);
00142     fields_.push_back(&hand_object_coefficient_of_friction_);
00143     fields_.push_back(&pushing_distance_);
00144     fields_.push_back(&in_hand_distance_);
00145     fields_.push_back(&y_resolution_);
00146     fields_.push_back(&start_y_offset_);
00147     fields_.push_back(&n_y_steps_);
00148     fields_.push_back(&rotation_resolution_);
00149     fields_.push_back(&n_rotations_);
00150     fields_.push_back(&left_pushing_distances_);
00151     fields_.push_back(&right_pushing_distances_);
00152     fields_.push_back(&left_pushing_roll_sides_);
00153     fields_.push_back(&right_pushing_roll_sides_);
00154     fields_.push_back(&radius_of_cylinder_bounding_the_object_);
00155     fields_.push_back(&capture_region_computation_frame_in_object_frame_);
00156     fields_.push_back(&fingertip_frame_to_pushing_surface_distance_);
00157     fields_.push_back(&finger_padding_);
00158 
00159     //sequences
00160     id_.setSequenceName("capture_region_id_seq");
00161 
00162     //by default, all fields here are used, and many of then not-null, so sync both ways
00163     setAllFieldsReadFromDatabase(true);
00164     setAllFieldsWriteToDatabase(true);
00165     //primary key id_ only syncs from database; it has a sequence which is used by default on insertions
00166     id_.setWriteToDatabase(false);
00167   }
00168 
00170   ~DatabaseCaptureRegion(){}
00171 };
00172 
00173 
00174 typedef boost::shared_ptr<DatabaseCaptureRegion> DatabaseCaptureRegionPtr;
00175 
00176 } //namespace
00177 
00178 #endif


household_objects_database
Author(s): Matei Ciocarlie, except for source files individually marked otherwise
autogenerated on Thu Jan 2 2014 11:40:12