19 #include "asr_recognizer_prediction_psm/recognizer_prediction_psm.h" 21 #include <asr_msgs/AsrObject.h> 26 int main(
int argc,
char **argv)
28 ros::init(argc, argv,
"recognizer_prediction_psm_client");
31 ROS_INFO(
"usage: recognizer_prediction_psm_client integer");
37 asr_recognizer_prediction_psm::recognizer_prediction_psm srv;
43 std::string path =
ros::package::getPath(
"asr_recognizer_prediction_psm") +
"/models/dome_scene1.xml";
44 std::vector<std::string> scenes;
45 scenes.push_back(
"background");
46 scenes.push_back(
"marker_scene1");
47 scenes.push_back(
"marker_scene2");
49 std::vector<float> probs;
50 probs.push_back(0.25
f);
51 probs.push_back(0.5
f);
52 probs.push_back(0.25);
53 std::vector<asr_msgs::AsrObject> objects;
57 geometry_msgs::Point point;
62 geometry_msgs::Quaternion q;
69 asr_msgs::AsrObject pObj;
70 geometry_msgs::PoseWithCovariance newPose;
71 pObj.type =
"VitalisSchoko";
72 pObj.identifier =
"/map";
73 pObj.header.frame_id =
"/map";
74 newPose.pose.position = point;
75 newPose.pose.orientation = q;
76 pObj.sampledPoses.push_back(newPose);
77 objects.push_back(pObj);
80 pObj.sampledPoses.clear();
82 pObj.identifier =
"/map";
83 pObj.header.frame_id =
"/map";
85 newPose.pose.position = point;
86 newPose.pose.orientation = q;
96 srv.request.pathToXML = path;
97 srv.request.scenes = scenes;
98 srv.request.scene_probabilities = probs;
99 srv.request.num_votes = atoll(argv[1]);
100 srv.request.objects = objects;
101 srv.request.base_frame_id =
"/map";
106 if (client.
call(srv))
108 for(
auto e : srv.response.pose_hypothesis.elements)
110 ROS_INFO(
"Hypothesis type \"%s\" at position (%.2f, %.2f, %.2f), orientation (%.2f, %.2f, %.2f, %.2f), base_frame \"%s\"",
115 e.pose.orientation.w,
116 e.pose.orientation.x,
117 e.pose.orientation.y,
118 e.pose.orientation.z,
119 srv.request.base_frame_id.c_str());
124 ROS_ERROR(
"Failed to call service recognizer_prediction_psm");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
int main(int argc, char **argv)
ROSLIB_DECL std::string getPath(const std::string &package_name)