19 #include "move_base_msgs/MoveBaseActionGoal.h" 26 std::time_t
t = std::time(0);
27 std::string
path = std::to_string(
t)+
"posen.xml";
31 std::string xmlString;
33 float x = msg->goal.target_pose.pose.position.x;
34 float y = msg->goal.target_pose.pose.position.y;
35 float z = msg->goal.target_pose.pose.position.z;
37 float xq = msg->goal.target_pose.pose.orientation.x;
38 float yq = msg->goal.target_pose.pose.orientation.y;
39 float zq = msg->goal.target_pose.pose.orientation.z;
40 float wq = msg->goal.target_pose.pose.orientation.w;
46 ROS_INFO(
"I heard x quat : [%f]",xq);
47 ROS_INFO(
"I heard y quat : [%f]",yq);
48 ROS_INFO(
"I heard z quat : [%f]",zq);
49 ROS_INFO(
"I heard w quat : [%f]",wq);
51 xmlString +=
"<Pose X=\""+std::to_string(x)+
"\" ";
52 xmlString +=
"Y=\""+std::to_string(y)+
"\" ";
53 xmlString +=
"Z=\""+std::to_string(z)+
"\" ";
54 xmlString +=
"XQ=\""+std::to_string(xq)+
"\" ";
55 xmlString +=
"YQ=\""+std::to_string(yq)+
"\" ";
56 xmlString +=
"ZQ=\""+std::to_string(zq)+
"\" ";
57 xmlString +=
"WQ=\""+std::to_string(wq)+
"\"></Pose>";
59 std::ofstream pose_xml_file(
path,std::ofstream::out|std::ofstream::app);
60 pose_xml_file << xmlString << std::endl;
61 pose_xml_file.close();
65 int main(
int argc,
char **argv)
68 std::string xmlString =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>";
69 std::ofstream pose_xml_file(
path,std::ofstream::out|std::ofstream::app);
70 pose_xml_file << xmlString << std::endl <<
"<Posen>" << std::endl;
72 ros::init(argc, argv,
"asr_rviz_pose_manager");
80 pose_xml_file <<
"</Posen>" << std::endl;
81 pose_xml_file.close();
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void chatterCallback(const move_base_msgs::MoveBaseActionGoal::ConstPtr &msg)