39 mInitPosePub = mNodeHandle->advertise<geometry_msgs::PoseWithCovarianceStamped>(
"/initialpose", 100,
false);
41 this->silent = silent;
50 mSetInitRobotStateClient = mNodeHandle->serviceClient<asr_next_best_view::SetInitRobotState>(
"/nbv/set_init_robot_state");
52 mSetPointCloudClient = mNodeHandle->serviceClient<asr_next_best_view::SetAttributedPointCloud>(
"/nbv/set_point_cloud");
54 mGetPointCloudClient = mNodeHandle->serviceClient<asr_next_best_view::GetAttributedPointCloud>(
"/nbv/get_point_cloud");
56 mGetNextBestViewClient = mNodeHandle->serviceClient<asr_next_best_view::GetNextBestView>(
"/nbv/next_best_view");
58 mUpdatePointCloudClient = mNodeHandle->serviceClient<asr_next_best_view::UpdatePointCloud>(
"/nbv/update_point_cloud");
60 mResetCalculatorClient = mNodeHandle->serviceClient<asr_next_best_view::ResetCalculator>(
"/nbv/reset_nbv_calculator");
64 mTriggerFrustumVisClient = mNodeHandle->serviceClient<asr_next_best_view::TriggerFrustumVisualization>(
"/nbv/trigger_frustum_visualization");
71 geometry_msgs::PoseWithCovarianceStamped pose;
72 pose.header.frame_id =
"map";
73 boost::array<double, 36> a = {
75 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
76 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
77 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
78 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
79 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
80 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
82 pose.pose.covariance = a;
83 pose.pose.pose = initialPose;
85 mInitPosePub.publish(pose);
87 this->setInitialRobotState(initialPose, nbv);
91 robot_model_services::MILDRobotStatePtr statePtr = this->getRobotState(initialPose);
93 asr_next_best_view::SetInitRobotState sirb;
94 sirb.request.robotState.pan = statePtr->pan;
95 sirb.request.robotState.tilt = statePtr->tilt;
96 sirb.request.robotState.rotation = statePtr->rotation;
97 sirb.request.robotState.x = statePtr->x;
98 sirb.request.robotState.y = statePtr->y;
101 if (!nbv->processSetInitRobotStateServiceCall(sirb.request, sirb.response)) {
102 ROS_ERROR(
"Failed to process service SetInitRobotState.");
107 if (!mSetInitRobotStateClient.call(sirb)) {
108 ROS_ERROR(
"Failed to call service SetInitRobotState.");
114 tf::Quaternion q(initialPose.orientation.x, initialPose.orientation.y, initialPose.orientation.z, initialPose.orientation.w);
116 double yaw, pitch, roll;
117 m.
getRPY(roll, pitch, yaw);
119 robot_model_services::MILDRobotStatePtr statePtr(
new robot_model_services::MILDRobotState(0, 0, yaw, initialPose.position.x, initialPose.position.y));
129 std::cout <<
"Press ENTER to continue.." << std::endl <<
">";
130 std::getline(std::cin, dummy);
131 std::cout << std::endl;
139 Eigen::AngleAxis<Precision> rollAngle(M_PI*roll/180.0,SimpleVector3::UnitX());
140 Eigen::AngleAxis<Precision> pitchAngle(M_PI*pitch/180.0,SimpleVector3::UnitY());
141 Eigen::AngleAxis<Precision> yawAngle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
152 Eigen::AngleAxis<Precision> Z1_Angle(M_PI*roll/180.0,SimpleVector3::UnitZ());
153 Eigen::AngleAxis<Precision> X_Angle(M_PI*pitch/180.0,SimpleVector3::UnitX());
154 Eigen::AngleAxis<Precision> Z2_Angle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
SimpleQuaternion euler2Quaternion(const Precision roll, const Precision pitch, const Precision yaw)
void setInitialPose(const geometry_msgs::Pose &initialPose, boost::shared_ptr< NextBestView > nbv=nullptr)
robot_model_services::MILDRobotStatePtr getRobotState(const geometry_msgs::Pose &initialPose)
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
void setInitialRobotState(const geometry_msgs::Pose &initialPose, boost::shared_ptr< NextBestView > nbv=nullptr)
SimpleQuaternion ZXZ2Quaternion(const Precision roll, const Precision pitch, const Precision yaw)
void init(bool useRos, bool silent)
Eigen::Quaternion< Precision > SimpleQuaternion
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)