MILDRobotModel.cpp
Go to the documentation of this file.
1 
20 #include <glpk.h>
21 #include <limits>
22 #include <ros/ros.h>
23 #include <ros/node_handle.h>
24 
28 
29 #include "nav_msgs/GetPlan.h"
30 #include "geometry_msgs/PoseStamped.h"
31 #include "geometry_msgs/Point.h"
32 
33 #include "urdf/model.h"
34 #include "urdf_model/joint.h"
35 #include "tf/tf.h"
36 #include "tf/transform_datatypes.h"
37 //#include <robot_state_publisher/robot_state_publisher.h>
38 #include <kdl_parser/kdl_parser.hpp>
39 #include <kdl/chain.hpp>
40 #include <kdl/chainfksolver.hpp>
41 #include <kdl/chainfksolverpos_recursive.hpp>
42 
43 namespace robot_model_services {
46  mDebugHelperPtr->write(std::stringstream() << "STARTING MILD ROBOT MODEL", DebugHelper::ROBOT_MODEL);
48  navigationCostClient = n.serviceClient<nav_msgs::GetPlan>("/move_base/make_plan");
49  double mOmegaPan_, mOmegaTilt_, mOmegaRot_, tolerance_, speedFactorPTU_,speedFactorBaseMove_,speedFactorBaseRot_, mSigma_;
50  bool useGlobalPlanner_;
51  n.getParam("mOmegaPan", mOmegaPan_);
52  n.getParam("mOmegaTilt", mOmegaTilt_);
53  n.getParam("mOmegaRot", mOmegaRot_);
54  n.getParam("speedFactorPTU", speedFactorPTU_);
55  n.getParam("speedFactorBaseMove", speedFactorBaseMove_);
56  n.getParam("speedFactorBaseRot", speedFactorBaseRot_);
57  n.getParam("tolerance", tolerance_);
58  n.getParam("useGlobalPlanner", useGlobalPlanner_);
59  n.getParam("mSigma", mSigma_);
60 
61  useGlobalPlanner = useGlobalPlanner_;
62  if (useGlobalPlanner_)
63  {
64  mDebugHelperPtr->write("Use of global planner ENABLED", DebugHelper::PARAMETERS);
65  }
66  else
67  {
68  mDebugHelperPtr->write("Use of global planner DISABLED. Using simplified calculation instead", DebugHelper::PARAMETERS);
69  }
70 
71  mDebugHelperPtr->write(std::stringstream() << "speedFactorPTU: " << speedFactorPTU_, DebugHelper::PARAMETERS);
72  mDebugHelperPtr->write(std::stringstream() << "speedFactorBaseMove: " << speedFactorBaseMove_, DebugHelper::PARAMETERS);
73  mDebugHelperPtr->write(std::stringstream() << "speedFactorBaseRot: " << speedFactorBaseRot_, DebugHelper::PARAMETERS);
74  mDebugHelperPtr->write(std::stringstream() << "tolerance: " << tolerance_, DebugHelper::PARAMETERS);
75  mDebugHelperPtr->write(std::stringstream() << "mOmegaPan: " << mOmegaPan_, DebugHelper::PARAMETERS);
76  mDebugHelperPtr->write(std::stringstream() << "mOmegaTilt: " << mOmegaTilt_, DebugHelper::PARAMETERS);
77  mDebugHelperPtr->write(std::stringstream() << "mOmegaRot: " << mOmegaRot_, DebugHelper::PARAMETERS);
78  mDebugHelperPtr->write(std::stringstream() << "mSigma: " << mSigma_, DebugHelper::PARAMETERS);
79  mOmegaPan = mOmegaPan_;
80  mOmegaTilt = mOmegaTilt_;
81  mOmegaRot = mOmegaRot_;
82  speedFactorPTU = speedFactorPTU_;
83  speedFactorBaseMove = speedFactorBaseMove_;
84  speedFactorBaseRot = speedFactorBaseRot_;
85  tolerance = tolerance_;
86  mSigma = mSigma_;
87  //Read robot model frames
88  std::string strMap_, strMild_base_, strMild_ptu_base_link_, strMild_ptu_pan_link_, strMild_ptu_pan_link_rotated_, strMild_ptu_tilt_link_,
89  strMild_ptu_tilt_link_rotated_, strMild_camera_mount_link_, strMild_camera_left_, strMild_camera_right;
90  n.getParam("map_frame", strMap_);
91  n.getParam("base_frame", strMild_base_);
92  n.getParam("ptu_base_frame", strMild_ptu_base_link_);
93  n.getParam("ptu_pan_frame", strMild_ptu_pan_link_);
94  n.getParam("ptu_pan_frame_rotated", strMild_ptu_pan_link_rotated_);
95  n.getParam("ptu_tilt_frame", strMild_ptu_tilt_link_);
96  n.getParam("ptu_tilt_frame_rotated", strMild_ptu_tilt_link_rotated_);
97  n.getParam("camera_mount_frame", strMild_camera_mount_link_);
98  n.getParam("camera_left_frame", strMild_camera_left_);
99  n.getParam("camera_right_frame", strMild_camera_right);
100 
101  mDebugHelperPtr->write(std::stringstream() << "strMap_: " << strMap_, DebugHelper::PARAMETERS);
102  mDebugHelperPtr->write(std::stringstream() << "strMild_base_: " << strMild_base_, DebugHelper::PARAMETERS);
103  mDebugHelperPtr->write(std::stringstream() << "strMild_ptu_base_link_: " << strMild_ptu_base_link_, DebugHelper::PARAMETERS);
104  mDebugHelperPtr->write(std::stringstream() << "strMild_ptu_pan_link_: " << strMild_ptu_pan_link_, DebugHelper::PARAMETERS);
105  mDebugHelperPtr->write(std::stringstream() << "strMild_ptu_pan_link_rotated_: " << strMild_ptu_pan_link_rotated_, DebugHelper::PARAMETERS);
106  mDebugHelperPtr->write(std::stringstream() << "strMild_ptu_tilt_link_: " << strMild_ptu_tilt_link_, DebugHelper::PARAMETERS);
107  mDebugHelperPtr->write(std::stringstream() << "strMild_ptu_tilt_link_rotated_: " << strMild_ptu_tilt_link_rotated_, DebugHelper::PARAMETERS);
108  mDebugHelperPtr->write(std::stringstream() << "strMild_camera_mount_link_: " << strMild_camera_mount_link_, DebugHelper::PARAMETERS);
109  mDebugHelperPtr->write(std::stringstream() << "strMild_camera_left_: " << strMild_camera_left_, DebugHelper::PARAMETERS);
110  mDebugHelperPtr->write(std::stringstream() << "strMild_camera_right: " << strMild_camera_right, DebugHelper::PARAMETERS);
111 
112  mFrameName_map = strMap_;
113  mFrameName_mild_base = strMild_base_;
114  mFrameName_mild_ptu_base_link = strMild_ptu_base_link_;
115  mFrameName_mild_ptu_pan_link = strMild_ptu_pan_link_;
116  mFrameName_mild_ptu_pan_link_rotated = strMild_ptu_pan_link_rotated_;
117  mFrameName_mild_ptu_tilt_link = strMild_ptu_tilt_link_;
118  mFrameName_mild_ptu_tilt_link_rotated = strMild_ptu_tilt_link_rotated_;
119  mFrameName_mild_camera_mount_link = strMild_camera_mount_link_;
120  mFrameName_mild_camera_left = strMild_camera_left_;
121  mFrameName_mild_camera_right = strMild_camera_right;
122  this->setPanAngleLimits(0, 0);
123  this->setTiltAngleLimits(0, 0);
124  this->setRotationAngleLimits(0, 0);
125  }
126 
128 
129  geometry_msgs::Pose MILDRobotModel::getRobotPose()
130  {
131  geometry_msgs::Pose robotPose;
132  tf::StampedTransform transform;
134  robotPose.position.x = transform.getOrigin()[0];
135  robotPose.position.y = transform.getOrigin()[1];
136  robotPose.position.z = transform.getOrigin()[2];
137  tf::quaternionTFToMsg(transform.getRotation(), robotPose.orientation);
138  return robotPose;
139  }
140 
141  geometry_msgs::Pose MILDRobotModel::getCameraPose()
142  {
143  geometry_msgs::Pose cameraPose;
144  tf::StampedTransform transform;
146  cameraPose.position.x = transform.getOrigin()[0];
147  cameraPose.position.y = transform.getOrigin()[1];
148  cameraPose.position.z = transform.getOrigin()[2];
149  tf::quaternionTFToMsg(transform.getRotation(), cameraPose.orientation);
150  return cameraPose;
151  }
152 
153  void MILDRobotModel::setPanAngleLimits(float minAngleDegrees, float maxAngleDegrees) {
154  mDebugHelperPtr->write(std::stringstream() << "Setting PAN angle limits to (" << minAngleDegrees << ", " << maxAngleDegrees << ")", DebugHelper::PARAMETERS);
155  mPanLimits.get<0>() = MathHelper::degToRad(minAngleDegrees);
156  mPanLimits.get<1>() = MathHelper::degToRad(maxAngleDegrees);
157  }
158 
159  void MILDRobotModel::setTiltAngleLimits(float minAngleDegrees, float maxAngleDegrees) {
160  mDebugHelperPtr->write(std::stringstream() << "Setting TILT angle limits to (" << minAngleDegrees << ", " << maxAngleDegrees << ")", DebugHelper::PARAMETERS);
161  mTiltLimits.get<0>() = MathHelper::degToRad(minAngleDegrees);
162  mTiltLimits.get<1>() = MathHelper::degToRad(maxAngleDegrees);
163  }
164 
165  void MILDRobotModel::setRotationAngleLimits(float minAngleDegrees, float maxAngleDegrees) {
166  mDebugHelperPtr->write(std::stringstream() << "Setting rotation angle limits to (" << minAngleDegrees << ", " << maxAngleDegrees << ")", DebugHelper::PARAMETERS);
167  mRotationLimits.get<0>() = MathHelper::degToRad(minAngleDegrees);
168  mRotationLimits.get<1>() = MathHelper::degToRad(maxAngleDegrees);
169  }
170 
171  bool MILDRobotModel::isPositionAllowed(const geometry_msgs::Point &position)
172  {
173  mDebugHelperPtr->writeNoticeably("STARTING IS-POSITION-ALLOWED METHOD", DebugHelper::ROBOT_MODEL);
175  SimpleVector3 pos(position.x, position.y, position.z);
176  int8_t occupancyValue = mMapHelperPtr->getRaytracingMapOccupancyValue(pos);
177  mDebugHelperPtr->writeNoticeably("ENDING IS-POSITION-ALLOWED METHOD", DebugHelper::ROBOT_MODEL);
178  return mMapHelperPtr->isOccupancyValueAcceptable(occupancyValue);
179  }
180 
182  if (mMapHelperPtr == nullptr)
183  {
184  mDebugHelperPtr->writeNoticeably("INIT MAP_HELPER IN MILDRobotModel", DebugHelper::ROBOT_MODEL);
187  double colThresh;
188  n.param("colThresh", colThresh, 40.0);
189  mDebugHelperPtr->write(std::stringstream() << "colThresh: " << colThresh, DebugHelper::PARAMETERS);
190  mMapHelperPtr->setCollisionThreshold(colThresh);
191  mDebugHelperPtr->writeNoticeably("INIT MAP_HELPER IN MILDRobotModel DONE", DebugHelper::ROBOT_MODEL);
192  }
193  }
194 
195  bool MILDRobotModel::isPoseReachable(const SimpleVector3 &position, const SimpleQuaternion &orientation)
196  {
197  SimpleVector3 visualAxis = MathHelper::getVisualAxis(orientation);
198  SimpleSphereCoordinates sphereCoords = MathHelper::convertC2S(visualAxis);
199 
200  return (mTiltLimits.get<0>() <= sphereCoords[1] && sphereCoords[1] <= mTiltLimits.get<1>());
201  }
202 
203  bool MILDRobotModel::isPositionReachable(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition)
204  {
205  mDebugHelperPtr->writeNoticeably("STARTING IS-POSITION-REACHABLE METHOD", DebugHelper::ROBOT_MODEL);
206 
207  nav_msgs::Path path = getNavigationPath(sourcePosition, targetPosition);
208 
209  if (path.poses.empty())
210  {
211  mDebugHelperPtr->writeNoticeably("ENDING IS-POSITION-REACHABLE METHOD", DebugHelper::ROBOT_MODEL);
212  return false;
213  }
214 
215  int lastPose = path.poses.size()-1;
216  float distanceToLastPoint = sqrt(pow(targetPosition.x - path.poses[lastPose].pose.position.x, 2) + pow(targetPosition.y - path.poses[lastPose].pose.position.y, 2));
217  mDebugHelperPtr->write(std::stringstream() << "Target: " << targetPosition.x << ", " << targetPosition.y, DebugHelper::ROBOT_MODEL);
218  mDebugHelperPtr->write(std::stringstream() << "Actual position: " << path.poses[lastPose].pose.position.x << ", " << path.poses[lastPose].pose.position.y,
220  mDebugHelperPtr->writeNoticeably("ENDING IS-POSITION-REACHABLE METHOD", DebugHelper::ROBOT_MODEL);
221  return distanceToLastPoint < 0.01f;
222  }
223 
224  float MILDRobotModel::getBase_TranslationalMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
225  {
226  MILDRobotStatePtr sourceMILDRobotState = boost::static_pointer_cast<MILDRobotState>(sourceRobotState);
227  MILDRobotStatePtr targetMILDRobotState = boost::static_pointer_cast<MILDRobotState>(targetRobotState);
228 
229  float distance ;
230  geometry_msgs::Point sourcePoint, targetPoint;
231  sourcePoint.x = sourceMILDRobotState->x;
232  sourcePoint.y = sourceMILDRobotState->y;
233  sourcePoint.z = 0;
234  targetPoint.x = targetMILDRobotState->x;
235  targetPoint.y = targetMILDRobotState->y;
236  targetPoint.z = 0;
237 
238  distance = getDistance(sourcePoint, targetPoint);
239 
240  float movementCosts = std::exp(-pow((distance-0.0), 2.0)/(2.0*pow(mSigma, 2.0))); // [0, 1]
241  return movementCosts;
242  }
243 
244  float MILDRobotModel::getPTU_PanMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
245  {
246  MILDRobotStatePtr sourceMILDRobotState = boost::static_pointer_cast<MILDRobotState>(sourceRobotState);
247  MILDRobotStatePtr targetMILDRobotState = boost::static_pointer_cast<MILDRobotState>(targetRobotState);
248 
249  float panDiff = targetMILDRobotState->pan - sourceMILDRobotState->pan;
250 
251  float panSpan = mPanLimits.get<1>() - mPanLimits.get<0>();
252 
253  if (panSpan == 0)
254  return 1.0;
255 
256  float ptuPanCosts = fabs(panDiff)/ panSpan;
257 
258  return 1.0 - ptuPanCosts;
259  }
260 
261  float MILDRobotModel::getPTU_TiltMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
262  {
263  MILDRobotStatePtr sourceMILDRobotState = boost::static_pointer_cast<MILDRobotState>(sourceRobotState);
264  MILDRobotStatePtr targetMILDRobotState = boost::static_pointer_cast<MILDRobotState>(targetRobotState);
265  float tiltDiff = targetMILDRobotState->tilt - sourceMILDRobotState->tilt;
266 
267  float tiltSpan = mTiltLimits.get<1>() - mTiltLimits.get<0>();
268 
269  if (tiltSpan == 0)
270  return 1.0;
271 
272  float ptuTiltCosts = fabs(tiltDiff)/ tiltSpan;
273 
274  return 1.0 - ptuTiltCosts;
275  }
276 
277  float MILDRobotModel::getBase_RotationalMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
278  {
279  MILDRobotStatePtr sourceMILDRobotState = boost::static_pointer_cast<MILDRobotState>(sourceRobotState);
280  MILDRobotStatePtr targetMILDRobotState = boost::static_pointer_cast<MILDRobotState>(targetRobotState);
281 
282  float rotationCosts;
283 
284  if (fabs(targetMILDRobotState->y - sourceMILDRobotState->y) < 0.00001 && fabs(targetMILDRobotState->x - sourceMILDRobotState->x) < 0.00001) {
285  float rotDiff = targetMILDRobotState->rotation - sourceMILDRobotState->rotation;
286 
287  rotationCosts = std::min((float)fabs(rotDiff), (float)(2.0f*M_PI-fabs(rotDiff)))/ (2.0 * M_PI);
288 
289  }
290  else {
291  float angleBetweenPoints = std::atan2(targetMILDRobotState->y - sourceMILDRobotState->y, targetMILDRobotState->x - sourceMILDRobotState->x);
292  if(angleBetweenPoints < 0.0) angleBetweenPoints += 2.0 * M_PI;
293 
294  float sourceRotDiff = sourceMILDRobotState->rotation - angleBetweenPoints;
295  float targetRotDiff = targetMILDRobotState->rotation - angleBetweenPoints;
296 
297  rotationCosts = std::min((float)fabs(sourceRotDiff), (float)(2.0f*M_PI-fabs(sourceRotDiff)))
298  + std::min((float)fabs(targetRotDiff), (float)(2.0f*M_PI-fabs(targetRotDiff)));
299  rotationCosts /= 2.0 * M_PI;
300 
301  }
302  return 1.0 - rotationCosts;
303  }
304 
305  float MILDRobotModel::getDistance(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition)
306  {
307  mDebugHelperPtr->writeNoticeably("STARTING GET-DISTANCE METHOD", DebugHelper::ROBOT_MODEL);
308  double distance;
309  if (useGlobalPlanner) //Use global planner to calculate distance
310  {
311  nav_msgs::Path path;
312  mDebugHelperPtr->write(std::stringstream() << "Calculate path from (" << sourcePosition.x << ", "
313  << sourcePosition.y << ") to (" << targetPosition.x << ", "<< targetPosition.y << ")",
315 
316  path = getNavigationPath(sourcePosition, targetPosition);
317 
318  if (!path.poses.empty())
319  {
320  unsigned int size = path.poses.size();
321  distance = 0;
322  for (unsigned int i = 0; i < size ; i++)
323  {
324  mDebugHelperPtr->write(std::stringstream() << "Path (" << path.poses[i].pose.position.x << ", " << path.poses[i].pose.position.y << ")",
326  }
327  //Calculate distance from source point to first point in path
328  distance += sqrt(pow(sourcePosition.x - path.poses[0].pose.position.x, 2) + pow(sourcePosition.y - path.poses[0].pose.position.y, 2));
329  //Calculate path length
330  for (unsigned int i = 0; i < size - 1 ; i++)
331  {
332  distance += sqrt(pow(path.poses[i].pose.position.x - path.poses[i+1].pose.position.x, 2) + pow(path.poses[i].pose.position.y - path.poses[i+1].pose.position.y, 2));
333  }
334  }
335  else
336  {
337  distance = -1;
338  ROS_ERROR("Could not get navigation path..");
339  }
340  }
341  else //Use euclidean distance
342  {
343  distance = sqrt(pow(sourcePosition.x -targetPosition.x, 2) + pow(sourcePosition.y - targetPosition.y, 2));
344  }
345  mDebugHelperPtr->write(std::stringstream() << "Calculated distance: " << distance, DebugHelper::ROBOT_MODEL);
346  mDebugHelperPtr->write(std::stringstream() << "Euclidian distance: "
347  << sqrt(pow(sourcePosition.x -targetPosition.x, 2) + pow(sourcePosition.y - targetPosition.y, 2)),
349  mDebugHelperPtr->writeNoticeably("ENDING GET-DISTANCE METHOD", DebugHelper::ROBOT_MODEL);
350  return distance;
351  }
352 
353  nav_msgs::Path MILDRobotModel::getNavigationPath(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition)
354  {
355  return getNavigationPath(sourcePosition, targetPosition, 0, 0);
356  }
357 
358  nav_msgs::Path MILDRobotModel::getNavigationPath(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition, double sourceRotationBase, double targetRotationBase)
359  {
360  mDebugHelperPtr->writeNoticeably("STARTING GET-NAVIGATION-PATH METHOD", DebugHelper::ROBOT_MODEL);
361 
362  nav_msgs::GetPlan srv;
363  srv.request.start.header.frame_id = mFrameName_map;
364  srv.request.goal.header.frame_id = mFrameName_map;
365  srv.request.start.pose.position = sourcePosition;
366  srv.request.goal.pose.position = targetPosition;
367  Eigen::Quaterniond sourceRotationEigen(Eigen::AngleAxisd(sourceRotationBase,Eigen::Vector3d::UnitZ()));
368  Eigen::Quaterniond targetRotationEigen(Eigen::AngleAxisd(targetRotationBase,Eigen::Vector3d::UnitZ()));
369  geometry_msgs::Quaternion sourceRotation;
370  sourceRotation.w = sourceRotationEigen.w();
371  sourceRotation.x = sourceRotationEigen.x();
372  sourceRotation.y = sourceRotationEigen.y();
373  sourceRotation.z = sourceRotationEigen.z();
374  geometry_msgs::Quaternion targetRotation;
375  targetRotation.w = targetRotationEigen.w();
376  targetRotation.x = targetRotationEigen.x();
377  targetRotation.y = targetRotationEigen.y();
378  targetRotation.z = targetRotationEigen.z();
379  srv.request.start.pose.orientation = sourceRotation;
380  srv.request.goal.pose.orientation = targetRotation;
381  srv.request.tolerance = tolerance;
382 
383  nav_msgs::Path path;
384  if (navigationCostClient.call(srv))
385  {
386  path = srv.response.plan;
387  mDebugHelperPtr->write(std::stringstream() << "Path size:" << path.poses.size(), DebugHelper::ROBOT_MODEL);
388  }
389  else
390  {
391  ROS_ERROR("Failed to call the global planner.");
392  }
393 
394  mDebugHelperPtr->writeNoticeably("ENDING GET-NAVIGATION-PATH METHOD", DebugHelper::ROBOT_MODEL);
395  return path;
396  }
397 
398  // Not fully implemented
399  // Guideline: http://www.orocos.org/kdl/examples
400  geometry_msgs::Pose MILDRobotModel::calculateCameraPose(const RobotStatePtr &sourceRobotState)
401  {
402  /*MILDRobotStatePtr sourceMILDRobotState = boost::static_pointer_cast<MILDRobotState>(sourceRobotState);
403 
404  urdf::Model * myModel;
405  geometry_msgs::Pose cameraPose;
406 
407  tf::Transform pan(tf::Quaternion(tf::Vector3(0,0,1), sourceMILDRobotState->pan));
408  tf::Transform tilt(tf::Quaternion(tf::Vector3(0,-1,0), sourceMILDRobotState->tilt));
409 
410  urdf::Model myModel;
411  ros::Rate loop_rate(30);
412  //geometry_msgs::Pose cameraPose;
413 
414  if(!myModel.initParam("/robot_description"))
415  {
416  ROS_ERROR("Could not get robot description.");
417  }
418  else
419  {
420  KDL::Tree my_tree;
421  if (!kdl_parser::treeFromUrdfModel(myModel, my_tree))
422  {
423  ROS_ERROR("Failed to construct kdl tree");
424  }
425  else
426  {
427  KDL::Chain chain;
428  my_tree.getChain(myModel.getRoot()->name, "mount_to_camera_left", chain);
429  ChainFkSolverPos_recursive fksolver = ChainFkSolverPos_recursive(chain);
430 
431 
432  //robot_state_publisher::RobotStatePublisher* publisher = new robot_state_publisher::RobotStatePublisher(my_tree);
433  //my_tree.getSegment()
434 
435  typedef std::map<std::string, boost::shared_ptr<urdf::Joint> > joint_map;
436 
437  std::map<std::string, double> positions;
438  joint_map joints = myModel.joints_;
439 
440  for(joint_map::const_iterator it = joints.begin(); it != joints.end(); ++it)
441  {
442  std::string name = it->first;
443  urdf::Joint* joint = it->second.get();
444  //joint->dynamics.
445  mDebugHelperPtr->write(name, DebugHelper::ROBOT_MODEL);
446  if(joint->type==urdf::Joint::REVOLUTE || joint->type==urdf::Joint::CONTINUOUS || joint->type==urdf::Joint::PRISMATIC) positions[name] = 0;
447  }
448  while (ros::ok())
449  {
450  //publisher->publishTransforms(positions, ros::Time::now());
451 
452  // Process a round of subscription messages
453  ros::spinOnce();
454 
455  // This will adjust as needed per iteration
456  loop_rate.sleep();
457  }
458  }
459  } */
460  geometry_msgs::Pose myPose;
461  return myPose;
462  }
463 }
464 
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
bool isPositionReachable(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition)
boost::tuple< float, float > mRotationLimits
static double degToRad(double input)
Definition: MathHelper.cpp:172
f
float getBase_TranslationalMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
Calculates the movement costs from sourceRobotState to targetRobotState. Returns -1 if pose is not re...
static boost::shared_ptr< DebugHelper > getInstance()
Definition: DebugHelper.cpp:29
float getBase_RotationalMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
bool call(MReq &req, MRes &res)
ROSCPP_DECL const std::string & getName()
void setRotationAngleLimits(float minAngleDegrees, float maxAngleDegrees)
sets the angle limits of the rotation angle.
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
Definition: typedef.hpp:50
geometry_msgs::Pose calculateCameraPose(const RobotStatePtr &sourceRobotState)
Uses a given RobotState to calculate the camera frame.
void setPanAngleLimits(float minAngleDegrees, float maxAngleDegrees)
sets the angle limits of the pan angle.
static SimpleVector3 getVisualAxis(const SimpleQuaternion &orientation)
Definition: MathHelper.cpp:53
SimpleVector3 SimpleSphereCoordinates
Definition: typedef.hpp:51
boost::shared_ptr< MapHelper > MapHelperPtr
Definition: MapHelper.hpp:405
bool isPoseReachable(const SimpleVector3 &position, const SimpleQuaternion &orientation)
double distance(double x0, double y0, double x1, double y1)
nav_msgs::Path getNavigationPath(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition, double sourceRotationBase, double targetRotationBase)
TFSIMD_FORCE_INLINE const tfScalar & z() const
boost::tuple< float, float > mPanLimits
bool param(const std::string &param_name, T &param_val, const T &default_val) const
static void quaternionTFToMsg(const Quaternion &bt, geometry_msgs::Quaternion &msg)
this namespace contains all generally usable classes.
Definition: DebugHelper.hpp:27
void setTiltAngleLimits(float minAngleDegrees, float maxAngleDegrees)
sets the angle limits of the tilt angle.
TFSIMD_FORCE_INLINE const tfScalar & y() const
float getPTU_TiltMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
TFSIMD_FORCE_INLINE Vector3 & getOrigin()
void lookupTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &time, StampedTransform &transform) const
float getDistance(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition)
static SimpleSphereCoordinates convertC2S(const SimpleVector3 &cartesian)
converts cartesian coordinates to sphere coordinates
Definition: MathHelper.cpp:29
boost::tuple< float, float > mTiltLimits
void initMapHelper()
Init MapHelper if it is not initialized yet.
Quaternion getRotation() const
bool getParam(const std::string &key, std::string &s) const
MILDRobotModel()
constructor of the MILDRobotModel
bool isPositionAllowed(const geometry_msgs::Point &position)
virtual ~MILDRobotModel()
destructor of the MILDRobotModel
float getPTU_PanMovementCosts(const RobotStatePtr &sourceRobotState, const RobotStatePtr &targetRobotState)
#define ROS_ERROR(...)
Eigen::Quaternion< Precision > SimpleQuaternion
Definition: typedef.hpp:64
RobotModel generalizes a robot model.
Definition: RobotModel.hpp:37


asr_robot_model_services
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:49:59