Go to the documentation of this file.00001 #include "zyonz_camera_pose_around_point_alg.h"
00002
00003 ZyonzCameraPoseAroundPointAlgorithm::ZyonzCameraPoseAroundPointAlgorithm(void):
00004 camera_pose_(boost::make_shared<geometry_msgs::PoseStamped>())
00005 {
00006 }
00007
00008 ZyonzCameraPoseAroundPointAlgorithm::~ZyonzCameraPoseAroundPointAlgorithm(void)
00009 {
00010 }
00011
00012 void ZyonzCameraPoseAroundPointAlgorithm::config_update(Config& new_cfg, uint32_t level)
00013 {
00014 this->lock();
00015
00016
00017 this->config_=new_cfg;
00018
00019 this->unlock();
00020 }
00021
00022
00023 bool ZyonzCameraPoseAroundPointAlgorithm::isRunning(geometry_msgs::PoseStamped& view_point, double& dist_m, double& rad_x_rot, double& rad_y_rot)
00024 {
00025
00026
00027 tf::Stamped<tf::Transform> w_tf_viewpoint;
00028 tf::poseStampedMsgToTF (view_point, w_tf_viewpoint);
00029
00030
00031 tf::Transform zenital_view(tf::Transform::getIdentity());
00032 zenital_view.setOrigin(tf::Vector3(0, 0, dist_m));
00033 tf::Quaternion zenital_z_quat(tf::Quaternion::getIdentity());
00034 zenital_z_quat.setEuler(0.0, 0.0, -M_PI_2);
00035 tf::Transform zenital_z_tf(zenital_z_quat);
00036 tf::Quaternion zenital_x_quat(tf::Quaternion::getIdentity());
00037 zenital_x_quat.setEuler(0.0, -M_PI, 0.0);
00038 tf::Transform zenital_x_tf(zenital_x_quat);
00039 tf::Stamped<tf::Transform> w_tf_zenital (zenital_view * zenital_z_tf * zenital_x_tf, ros::Time::now(), w_tf_viewpoint.frame_id_);
00040
00041
00042 tf::Quaternion nextview_y_quat(tf::Quaternion::getIdentity());
00043 nextview_y_quat.setEuler(rad_y_rot, 0.0, 0.0);
00044 tf::Transform nextview_y_tf(nextview_y_quat);
00045 tf::Quaternion nextview_x_quat(tf::Quaternion::getIdentity());
00046 nextview_x_quat.setEuler(0.0, rad_x_rot, 0.0);
00047 tf::Transform nextview_x_tf(nextview_x_quat);
00048 tf::Stamped<tf::Transform> w_tf_nbv ( w_tf_viewpoint * nextview_y_tf * nextview_x_tf * w_tf_zenital , ros::Time::now(), w_tf_viewpoint.frame_id_);
00049 tf::poseStampedTFToMsg( w_tf_nbv, *camera_pose_);
00050
00051 return true;
00052 }
00053
00054 geometry_msgs::PoseStamped::Ptr ZyonzCameraPoseAroundPointAlgorithm::get_camera_pose() const
00055 {
00056 return camera_pose_;
00057 }
00058