10 #ifndef _RUN_TRIALS_HH_ 11 #define _RUN_TRIALS_HH_ 14 #include <gazebo/gazebo_client.hh> 15 #include <gazebo/gazebo_config.h> 16 #include <gazebo/transport/transport.hh> 17 #include <gazebo/msgs/msgs.hh> 22 #include <condition_variable> 26 #include "yaml-cpp/yaml.h" 46 #include "dr_request.pb.h" 48 #include "DRInterface.hh" 51 typedef std::map<std::string,std::string>
Config;
56 #define HAND_REQ_TOPIC "~/hand" 57 #define HAND_RES_TOPIC "~/hand/response" 59 #define TARGET_REQ_TOPIC "~/grasp/target" 61 #define TARGET_RES_TOPIC "~/grasp/target/response" 63 #define CONTACT_REQ_TOPIC "~/grasp/contact" 65 #define CONTACT_RES_TOPIC "~/grasp/contact/response" 67 #define CAMERA_REQ_TOPIC "~/grasp/rgbd" 69 #define CAMERA_RES_TOPIC "~/grasp/rgbd/response" 71 #define FACTORY_TOPIC "~/factory" 73 #define REQUEST_TOPIC "~/request" 81 #define REQ_GET_POSE grasp::msgs::TargetRequest::GET_POSE 82 #define REQ_SET_POSE grasp::msgs::TargetRequest::SET_POSE 84 #define REQ_REST_POSE grasp::msgs::TargetRequest::GET_REST_POSE 86 #define REQ_RESET grasp::msgs::TargetRequest::RESET 88 #define RES_POSE grasp::msgs::TargetResponse::POSE 90 #define RES_REST_POSE grasp::msgs::TargetResponse::REST_POSE 96 #define REQ_CAPTURE grasp::msgs::CameraRequest::CAPTURE 101 #define POSITION grasp::msgs::Target::POSITION 102 #define VELOCITY grasp::msgs::Target::VELOCITY 110 typedef const boost::shared_ptr<const grasp::msgs::Hand>
116 typedef const boost::shared_ptr<const grasp::msgs::TargetRequest>
121 typedef const boost::shared_ptr<const grasp::msgs::TargetResponse>
129 typedef const boost::shared_ptr<const grasp::msgs::ContactRequest>
134 typedef const boost::shared_ptr<const grasp::msgs::ContactResponse>
140 typedef const boost::shared_ptr<const grasp::msgs::CameraRequest>
145 typedef const boost::shared_ptr<const grasp::msgs::CameraResponse>
155 const std::string
getUsage(
const char* argv_0);
171 gazebo::transport::NodePtr & node,
172 std::map<std::string, gazebo::transport::PublisherPtr> & pubs,
173 std::map<std::string, gazebo::transport::SubscriberPtr> & subs);
183 const std::string & file_name);
192 const std::string & robot,
193 const std::string & object_name,
194 std::vector<Grasp> & grasps);
202 const std::string & robot,
203 const std::string & object_name,
204 const std::vector<Grasp> & grasps);
213 void setPose(gazebo::transport::PublisherPtr pub,
214 ignition::math::Pose3d pose,
222 const std::string & hand,
223 std::vector<std::string> & targets);
235 void liftHand(gazebo::transport::PublisherPtr pub,
240 void resetTarget(gazebo::transport::PublisherPtr pub);
249 std::map<std::string, gazebo::transport::PublisherPtr> & pubs,
250 const std::string & model_name);
Protobuf message types header.
grasp::msgs::Hand HandMsg
Declaration for hand message type.
Definition: run_trials.hh:108
const boost::shared_ptr< const grasp::msgs::CameraResponse > CameraResponsePtr
Shared pointer declaration for response message type.
Definition: run_trials.hh:146
bool importGrasps(const std::string &grasp_cfg_dir, const std::string &robot, const std::string &object_name, std::vector< Grasp > &grasps)
Obtain list of grasps in yml files.
Definition: run_trials.cc:229
const boost::shared_ptr< const grasp::msgs::Hand > HandMsgPtr
Shared pointer declaration for hand message type.
Definition: run_trials.hh:111
grasp::msgs::TargetResponse TargetResponse
Declaration for response message type.
Definition: run_trials.hh:119
const boost::shared_ptr< const grasp::msgs::TargetResponse > TargetResponsePtr
Shared pointer declaration for response message type.
Definition: gen_rest_poses.hh:58
const boost::shared_ptr< const grasp::msgs::TargetRequest > TargetRequestPtr
Shared pointer declaration for request message type.
Definition: run_trials.hh:117
grasp::msgs::CameraRequest CameraRequest
Declaration for request message type.
Definition: run_trials.hh:138
grasp::msgs::ContactResponse ContactResponse
Declaration for response message type.
Definition: run_trials.hh:132
void setPose(gazebo::transport::PublisherPtr pub, ignition::math::Pose3d pose, double timeout=-1)
Sets hand pose.
grasp::msgs::TargetRequest TargetRequest
Declaration for request message type.
Definition: run_trials.hh:114
void exportGraspMetrics(const std::string &trials_out_dir, const std::string &robot, const std::string &object_name, const std::vector< Grasp > &grasps)
Export set of metrics to file.
Definition: run_trials.cc:246
const std::string getUsage(const char *argv_0)
Obtains usage string.
Definition: gen_renders.cc:130
void obtainTargets(std::vector< std::string > &targets, const std::string &file_name)
Obtain list of models' names in dataset yml.
Definition: gen_renders.cc:212
const boost::shared_ptr< const grasp::msgs::ContactResponse > ContactResponsePtr
Shared pointer declaration for response message type.
Definition: run_trials.hh:135
Object related utilities.
const boost::shared_ptr< const grasp::msgs::CameraRequest > CameraRequestPtr
Shared pointer declaration for request message type.
Definition: run_trials.hh:141
const boost::shared_ptr< const grasp::msgs::TargetResponse > TargetResponsePtr
Shared pointer declaration for response message type.
Definition: run_trials.hh:122
grasp::msgs::CameraResponse CameraResponse
Declaration for response message type.
Definition: run_trials.hh:143
void onHandResponse(HandMsgPtr &_msg)
TODO.
Definition: run_trials.cc:374
Hand interface.
Definition: Interface.hh:42
void liftHand(gazebo::transport::PublisherPtr pub, double timeout=-1)
Lifts robotic manipulator along positive z axis.
grasp::msgs::CollisionRequest CollisionRequest
Declaration for request aux message type.
Definition: run_trials.hh:125
void setupCommunications(gazebo::transport::NodePtr &node, std::map< std::string, gazebo::transport::PublisherPtr > &pubs, std::map< std::string, gazebo::transport::SubscriberPtr > &subs)
Sets up gazebo communication pubs/subs.
Definition: gen_renders.cc:190
void closeFingers(gazebo::transport::PublisherPtr pub, double timeout=-1)
Closes manipulator fingers.
void checkHandCollisions(gazebo::transport::PublisherPtr pub, const std::string &hand, std::vector< std::string > &targets)
Requests collisions in the world.
Definition: run_trials.cc:257
void onTargetResponse(TargetResponsePtr &_msg)
TODO.
Definition: gen_rest_poses.cc:203
grasp::msgs::ContactRequest ContactRequest
Declaration for request message type.
Definition: run_trials.hh:127
void tryGrasp(Grasp &grasp, Interface &interface, std::map< std::string, gazebo::transport::PublisherPtr > &pubs, const std::string &model_name)
Attempts to grasp object.
Definition: run_trials.cc:289
const boost::shared_ptr< const grasp::msgs::ContactRequest > ContactRequestPtr
Shared pointer declaration for request message type.
Definition: run_trials.hh:130
Grasp representation class.
Definition: Grasp.hh:19
void parseArgs(int argc, char **argv, Config &config)
Parses command-line arguments.
Definition: run_trials.cc:136
void waitForTrigger(int timeout=-1)
Waits for condition variable.
Definition: run_trials.cc:360
void resetTarget(gazebo::transport::PublisherPtr pub)
Resets target object to rest pose.
Definition: run_trials.cc:281
void onContactResponse(ContactResponsePtr &_msg)
TODO.
Definition: run_trials.cc:396
std::map< std::string, std::string > Config
Config dictionary.
Definition: run_trials.hh:51