current_state_monitor.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Ioan Sucan */
36 
38 
39 #include <boost/algorithm/string/join.hpp>
40 #include <limits>
41 #include <tf2_eigen/tf2_eigen.h>
43 
44 constexpr char LOGNAME[] = "current_state_monitor";
45 
46 namespace planning_scene_monitor
47 {
48 CurrentStateMonitor::CurrentStateMonitor(const moveit::core::RobotModelConstPtr& robot_model,
49  const std::shared_ptr<tf2_ros::Buffer>& tf_buffer)
50  : CurrentStateMonitor(robot_model, tf_buffer, ros::NodeHandle())
51 {
52 }
53 
54 CurrentStateMonitor::CurrentStateMonitor(const moveit::core::RobotModelConstPtr& robot_model,
55  const std::shared_ptr<tf2_ros::Buffer>& tf_buffer, const ros::NodeHandle& nh)
56  : nh_(nh)
57  , tf_buffer_(tf_buffer)
58  , robot_model_(robot_model)
59  , robot_state_(robot_model)
60  , state_monitor_started_(false)
61  , copy_dynamics_(false)
62  , error_(std::numeric_limits<double>::epsilon())
63 {
65 }
66 
68 {
70 }
71 
72 moveit::core::RobotStatePtr CurrentStateMonitor::getCurrentState() const
73 {
74  boost::mutex::scoped_lock slock(state_update_lock_);
76  return moveit::core::RobotStatePtr(result);
77 }
78 
80 {
81  const std::vector<const moveit::core::JointModel*>* active_joints = &robot_model_->getActiveJointModels();
82  if (!group.empty())
83  {
84  const moveit::core::JointModelGroup* jmg = robot_model_->getJointModelGroup(group);
85  if (jmg)
86  {
87  active_joints = &jmg->getActiveJointModels();
88  }
89  else
90  {
91  ROS_ERROR_STREAM_NAMED(LOGNAME, "There is no group with the name " << std::quoted(group) << "!");
92  return ros::Time(0.0);
93  }
94  }
95  auto oldest_state_time = ros::Time();
96  for (const moveit::core::JointModel* joint : *active_joints)
97  {
98  auto it = joint_time_.find(joint);
99  if (it == joint_time_.end())
100  {
101  ROS_DEBUG_NAMED(LOGNAME, "Joint '%s' has never been updated", joint->getName().c_str());
102  }
103  else
104  {
105  if (!oldest_state_time.isZero())
106  {
107  oldest_state_time = std::min(oldest_state_time, it->second);
108  }
109  else
110  {
111  oldest_state_time = it->second;
112  }
113  }
114  }
115  return oldest_state_time;
116 }
117 
119 {
120  boost::mutex::scoped_lock slock(state_update_lock_);
121  return getCurrentStateTimeHelper(group);
122 }
123 
124 std::pair<moveit::core::RobotStatePtr, ros::Time>
125 CurrentStateMonitor::getCurrentStateAndTime(const std::string& group) const
126 {
127  boost::mutex::scoped_lock slock(state_update_lock_);
129  return std::make_pair(moveit::core::RobotStatePtr(result), getCurrentStateTimeHelper(group));
130 }
131 
132 std::map<std::string, double> CurrentStateMonitor::getCurrentStateValues() const
133 {
134  std::map<std::string, double> m;
135  boost::mutex::scoped_lock slock(state_update_lock_);
136  const double* pos = robot_state_.getVariablePositions();
137  const std::vector<std::string>& names = robot_state_.getVariableNames();
138  for (std::size_t i = 0; i < names.size(); ++i)
139  m[names[i]] = pos[i];
140  return m;
141 }
142 
144 {
145  boost::mutex::scoped_lock slock(state_update_lock_);
146  const double* pos = robot_state_.getVariablePositions();
147  upd.setVariablePositions(pos);
148  if (copy_dynamics_)
149  {
151  {
152  const double* vel = robot_state_.getVariableVelocities();
153  upd.setVariableVelocities(vel);
154  }
156  {
157  const double* acc = robot_state_.getVariableAccelerations();
158  upd.setVariableAccelerations(acc);
159  }
160  if (robot_state_.hasEffort())
161  {
162  const double* eff = robot_state_.getVariableEffort();
163  upd.setVariableEffort(eff);
164  }
165  }
166 }
167 
169 {
170  if (fn)
171  update_callbacks_.push_back(fn);
172 }
173 
175 {
176  update_callbacks_.clear();
177 }
178 
179 void CurrentStateMonitor::startStateMonitor(const std::string& joint_states_topic)
180 {
182  {
183  joint_time_.clear();
184  if (joint_states_topic.empty())
185  ROS_ERROR_NAMED(LOGNAME, "The joint states topic cannot be an empty string");
186  else
188  if (tf_buffer_ && !robot_model_->getMultiDOFJointModels().empty())
189  {
191  std::make_shared<TFConnection>(tf_buffer_->_addTransformsChangedListener([this] { tfCallback(); }));
192  }
193  state_monitor_started_ = true;
195  ROS_DEBUG_NAMED(LOGNAME, "Listening to joint states on topic '%s'", nh_.resolveName(joint_states_topic).c_str());
196  }
197 }
198 
200 {
201  return state_monitor_started_;
202 }
203 
205 {
207  {
209  if (tf_buffer_ && tf_connection_)
210  {
211  tf_buffer_->_removeTransformsChangedListener(*tf_connection_);
212  tf_connection_.reset();
213  }
214  ROS_DEBUG_NAMED(LOGNAME, "No longer listening for joint states");
215  state_monitor_started_ = false;
216  }
217 }
218 
220 {
223  else
224  return "";
225 }
226 
227 bool CurrentStateMonitor::haveCompleteStateHelper(const ros::Time& oldest_allowed_update_time,
228  std::vector<std::string>* missing_joints,
229  const std::string& group) const
230 {
231  const std::vector<const moveit::core::JointModel*>* active_joints = &robot_model_->getActiveJointModels();
232  if (!group.empty())
233  {
234  const moveit::core::JointModelGroup* jmg = robot_model_->getJointModelGroup(group);
235  if (jmg)
236  {
237  active_joints = &jmg->getActiveJointModels();
238  }
239  else
240  {
241  ROS_ERROR_STREAM_NAMED(LOGNAME, "There is no group with the name "
242  << std::quoted(group)
243  << ". All joints of the group are considered to be missing!");
244  if (missing_joints)
245  *missing_joints = robot_model_->getActiveJointModelNames();
246  return false;
247  }
248  }
249  boost::mutex::scoped_lock slock(state_update_lock_);
250  for (const moveit::core::JointModel* joint : *active_joints)
251  {
252  std::map<const moveit::core::JointModel*, ros::Time>::const_iterator it = joint_time_.find(joint);
253  if (it == joint_time_.end())
254  {
255  ROS_DEBUG_NAMED(LOGNAME, "Joint '%s' has never been updated", joint->getName().c_str());
256  }
257  else if (it->second < oldest_allowed_update_time)
258  {
259  ROS_DEBUG_NAMED(LOGNAME, "Joint '%s' was last updated %0.3lf seconds before requested time",
260  joint->getName().c_str(), (oldest_allowed_update_time - it->second).toSec());
261  }
262  else
263  continue;
264  if (missing_joints)
265  missing_joints->push_back(joint->getName());
266  else
267  return false;
268  }
269  return (missing_joints == nullptr) || missing_joints->empty();
270 }
271 
272 bool CurrentStateMonitor::waitForCurrentState(const ros::Time t, double wait_time) const
273 {
275  ros::WallDuration elapsed(0, 0);
276  ros::WallDuration timeout(wait_time);
277  boost::mutex::scoped_lock lock(state_update_lock_);
278  while (getCurrentStateTimeHelper() < t)
279  {
280  state_update_condition_.wait_for(lock, boost::chrono::nanoseconds((timeout - elapsed).toNSec()));
281  elapsed = ros::WallTime::now() - start;
282  if (elapsed > timeout)
283  {
285  "Didn't receive robot state (joint angles) with recent timestamp within "
286  << wait_time << " seconds.\n"
287  << "Check clock synchronization if your are running ROS across multiple machines!");
288  return false;
289  }
290  }
291  return true;
292 }
293 
294 bool CurrentStateMonitor::waitForCompleteState(double wait_time) const
295 {
296  double slept_time = 0.0;
297  double sleep_step_s = std::min(0.05, wait_time / 10.0);
298  ros::Duration sleep_step(sleep_step_s);
299  while (!haveCompleteState() && slept_time < wait_time)
300  {
301  sleep_step.sleep();
302  slept_time += sleep_step_s;
303  }
304  return haveCompleteState();
305 }
306 
307 bool CurrentStateMonitor::waitForCompleteState(const std::string& group, double wait_time) const
308 {
309  double slept_time = 0.0;
310  double sleep_step_s = std::min(0.05, wait_time / 10.0);
311  ros::Duration sleep_step(sleep_step_s);
312  while (!haveCompleteState(group) && slept_time < wait_time)
313  {
314  sleep_step.sleep();
315  slept_time += sleep_step_s;
316  }
317  std::vector<std::string> missing_joints;
318  if (!haveCompleteState(missing_joints, group))
319  {
320  ROS_ERROR_STREAM_NAMED(LOGNAME, std::quoted(group) << " has missing joints: " << boost::join(missing_joints, ","));
321  return false;
322  }
323  return true;
324 }
325 
326 void CurrentStateMonitor::jointStateCallback(const sensor_msgs::JointStateConstPtr& joint_state)
327 {
328  if (joint_state->name.size() != joint_state->position.size())
329  {
331  1, LOGNAME,
332  "State monitor received invalid joint state (number of joint names does not match number of "
333  "positions)");
334  return;
335  }
336  bool update = false;
337 
338  {
339  boost::mutex::scoped_lock _(state_update_lock_);
340  // read the received values, and update their time stamps
341  std::size_t n = joint_state->name.size();
342  for (std::size_t i = 0; i < n; ++i)
343  {
344  const moveit::core::JointModel* jm = robot_model_->getJointModel(joint_state->name[i]);
345  if (!jm)
346  continue;
347  // ignore fixed joints, multi-dof joints (they should not even be in the message)
348  if (jm->getVariableCount() != 1)
349  continue;
350 
351  if (auto& joint_time{ joint_time_[jm] }; joint_time < joint_state->header.stamp)
352  {
353  joint_time = joint_state->header.stamp;
354  }
355  else
356  {
357  ROS_WARN_STREAM_NAMED(LOGNAME, "New joint state for joint '"
358  << jm->getName()
359  << "' is not newer than the previous state. Assuming your rosbag looped.");
360  joint_time_.clear();
361  joint_time_[jm] = joint_state->header.stamp;
362  }
363 
364  if (robot_state_.getJointPositions(jm)[0] != joint_state->position[i])
365  {
366  update = true;
367  robot_state_.setJointPositions(jm, &(joint_state->position[i]));
368 
369  // continuous joints wrap, so we don't modify them (even if they are outside bounds!)
371  if (static_cast<const moveit::core::RevoluteJointModel*>(jm)->isContinuous())
372  continue;
373 
375  jm->getVariableBounds()[0]; // only one variable in the joint, so we get its bounds
376 
377  // if the read variable is 'almost' within bounds (up to error_ difference), then consider it to be within
378  // bounds
379  if (joint_state->position[i] < b.min_position_ && joint_state->position[i] >= b.min_position_ - error_)
381  else if (joint_state->position[i] > b.max_position_ && joint_state->position[i] <= b.max_position_ + error_)
383  }
384 
385  // optionally copy velocities and effort
386  if (copy_dynamics_)
387  {
388  // update joint velocities
389  if (joint_state->name.size() == joint_state->velocity.size() &&
390  (!robot_state_.hasVelocities() || robot_state_.getJointVelocities(jm)[0] != joint_state->velocity[i]))
391  {
392  update = true;
393  robot_state_.setJointVelocities(jm, &(joint_state->velocity[i]));
394  }
395 
396  // update joint efforts
397  if (joint_state->name.size() == joint_state->effort.size() &&
398  (!robot_state_.hasEffort() || robot_state_.getJointEffort(jm)[0] != joint_state->effort[i]))
399  {
400  update = true;
401  robot_state_.setJointEfforts(jm, &(joint_state->effort[i]));
402  }
403  }
404  }
405  }
406 
407  // callbacks, if needed
408  if (update)
409  for (JointStateUpdateCallback& update_callback : update_callbacks_)
410  update_callback(joint_state);
411 
412  // notify waitForCurrentState() *after* potential update callbacks
413  state_update_condition_.notify_all();
414 }
415 
417 {
418  // read multi-dof joint states from TF, if needed
419  const std::vector<const moveit::core::JointModel*>& multi_dof_joints = robot_model_->getMultiDOFJointModels();
420 
421  bool update = false;
422  bool changes = false;
423  {
424  boost::mutex::scoped_lock _(state_update_lock_);
425 
426  for (const moveit::core::JointModel* joint : multi_dof_joints)
427  {
428  const std::string& child_frame = joint->getChildLinkModel()->getName();
429  const std::string& parent_frame =
430  joint->getParentLinkModel() ? joint->getParentLinkModel()->getName() : robot_model_->getModelFrame();
431 
432  ros::Time latest_common_time;
433  geometry_msgs::TransformStamped transf;
434  try
435  {
436  transf = tf_buffer_->lookupTransform(parent_frame, child_frame, ros::Time(0.0));
437  latest_common_time = transf.header.stamp;
438  }
439  catch (tf2::TransformException& ex)
440  {
441  ROS_WARN_STREAM_ONCE_NAMED(LOGNAME, "Unable to update multi-DOF joint '"
442  << joint->getName() << "': Failure to lookup transform between '"
443  << parent_frame.c_str() << "' and '" << child_frame.c_str()
444  << "' with TF exception: " << ex.what());
445  continue;
446  }
447 
448  // allow update if time is more recent or if it is a static transform (time = 0)
449  if (latest_common_time <= joint_time_[joint] && latest_common_time > ros::Time(0))
450  continue;
451  joint_time_[joint] = latest_common_time;
452 
453  std::vector<double> new_values(joint->getStateSpaceDimension());
454  const moveit::core::LinkModel* link = joint->getChildLinkModel();
455  if (link->jointOriginTransformIsIdentity())
456  joint->computeVariablePositions(tf2::transformToEigen(transf), new_values.data());
457  else
458  joint->computeVariablePositions(link->getJointOriginTransform().inverse() * tf2::transformToEigen(transf),
459  new_values.data());
460 
461  if (joint->distance(new_values.data(), robot_state_.getJointPositions(joint)) > 1e-5)
462  {
463  changes = true;
464  }
465 
466  robot_state_.setJointPositions(joint, new_values.data());
467  update = true;
468  }
469  }
470 
471  // callbacks, if needed
472  if (changes)
473  {
474  // stub joint state: multi-dof joints are not modelled in the message,
475  // but we should still trigger the update callbacks
476  sensor_msgs::JointStatePtr joint_state(new sensor_msgs::JointState);
477  for (JointStateUpdateCallback& update_callback : update_callbacks_)
478  update_callback(joint_state);
479  }
480 
481  if (update)
482  {
483  // notify waitForCurrentState() *after* potential update callbacks
484  state_update_condition_.notify_all();
485  }
486 }
487 
488 } // namespace planning_scene_monitor
moveit::core::LinkModel::getJointOriginTransform
const Eigen::Isometry3d & getJointOriginTransform() const
moveit::core::LinkModel
planning_scene_monitor::CurrentStateMonitor::robot_model_
moveit::core::RobotModelConstPtr robot_model_
Definition: current_state_monitor.h:276
planning_scene_monitor
Definition: current_state_monitor.h:47
moveit::core::JointModelGroup::getActiveJointModels
const std::vector< const JointModel * > & getActiveJointModels() const
planning_scene_monitor::CurrentStateMonitor::getCurrentStateTimeHelper
ros::Time getCurrentStateTimeHelper(const std::string &group="") const
Definition: current_state_monitor.cpp:79
ROS_ERROR_THROTTLE_NAMED
#define ROS_ERROR_THROTTLE_NAMED(period, name,...)
moveit::core::RobotState::setJointPositions
void setJointPositions(const std::string &joint_name, const double *position)
moveit::core::RobotState::setVariablePositions
void setVariablePositions(const double *position)
moveit::core::JointModel::getVariableCount
std::size_t getVariableCount() const
epsilon
double epsilon
planning_scene_monitor::CurrentStateMonitor::stopStateMonitor
void stopStateMonitor()
Stop monitoring the "joint_states" topic.
Definition: current_state_monitor.cpp:204
planning_scene_monitor::CurrentStateMonitor::joint_time_
std::map< const moveit::core::JointModel *, ros::Time > joint_time_
Definition: current_state_monitor.h:278
moveit::core::VariableBounds
moveit::core::VariableBounds::max_position_
double max_position_
tf2_eigen.h
moveit::core::RobotState::setVariableVelocities
void setVariableVelocities(const double *velocity)
ros
moveit::core::RobotState::getVariableAccelerations
double * getVariableAccelerations()
moveit::core::RobotState::hasAccelerations
bool hasAccelerations() const
moveit::core::RobotState::hasVelocities
bool hasVelocities() const
planning_scene_monitor::CurrentStateMonitor::state_update_lock_
boost::mutex state_update_lock_
Definition: current_state_monitor.h:285
ros::Subscriber::getTopic
std::string getTopic() const
moveit::core::JointModel::getName
const std::string & getName() const
planning_scene_monitor::CurrentStateMonitor::isActive
bool isActive() const
Check if the state monitor is started.
Definition: current_state_monitor.cpp:199
current_state_monitor.h
planning_scene_monitor::CurrentStateMonitor::haveCompleteStateHelper
bool haveCompleteStateHelper(const ros::Time &oldest_allowed_update_time, std::vector< std::string > *missing_joints, const std::string &group) const
Definition: current_state_monitor.cpp:227
ros::Subscriber::shutdown
void shutdown()
moveit::core::RobotState::getVariableEffort
double * getVariableEffort()
ROS_ERROR_NAMED
#define ROS_ERROR_NAMED(name,...)
moveit::core::RobotState
planning_scene_monitor::CurrentStateMonitor::CurrentStateMonitor
CurrentStateMonitor(const moveit::core::RobotModelConstPtr &robot_model, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer)
Constructor.
Definition: current_state_monitor.cpp:48
moveit::core::VariableBounds::min_position_
double min_position_
planning_scene_monitor::LOGNAME
static const std::string LOGNAME
Definition: planning_scene_monitor.cpp:91
planning_scene_monitor::CurrentStateMonitor::~CurrentStateMonitor
~CurrentStateMonitor()
Definition: current_state_monitor.cpp:67
planning_scene_monitor::CurrentStateMonitor::nh_
ros::NodeHandle nh_
Definition: current_state_monitor.h:274
planning_scene_monitor::JointStateUpdateCallback
boost::function< void(const sensor_msgs::JointStateConstPtr &)> JointStateUpdateCallback
Definition: current_state_monitor.h:81
moveit::core::RobotState::getVariableNames
const std::vector< std::string > & getVariableNames() const
planning_scene_monitor::CurrentStateMonitor::startStateMonitor
void startStateMonitor(const std::string &joint_states_topic="joint_states")
Start monitoring joint states on a particular topic.
Definition: current_state_monitor.cpp:179
moveit::core::JointModel::getType
JointType getType() const
planning_scene_monitor::CurrentStateMonitor
Definition: current_state_monitor.h:84
moveit::core::JointModel::REVOLUTE
REVOLUTE
ros::NodeHandle::resolveName
std::string resolveName(const std::string &name, bool remap=true) const
moveit::core::JointModel::getVariableBounds
const VariableBounds & getVariableBounds(const std::string &variable) const
update
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
ROS_DEBUG_NAMED
#define ROS_DEBUG_NAMED(name,...)
planning_scene_monitor::CurrentStateMonitor::state_update_condition_
boost::condition_variable state_update_condition_
Definition: current_state_monitor.h:286
ros::WallTime::now
static WallTime now()
ROS_ERROR_STREAM_NAMED
#define ROS_ERROR_STREAM_NAMED(name, args)
moveit::core::RobotState::setToDefaultValues
void setToDefaultValues()
planning_scene_monitor::CurrentStateMonitor::update_callbacks_
std::vector< JointStateUpdateCallback > update_callbacks_
Definition: current_state_monitor.h:287
moveit::core::RobotState::setVariableEffort
void setVariableEffort(const double *effort)
moveit::core::RobotState::getJointEffort
const double * getJointEffort(const std::string &joint_name) const
moveit::core::RobotState::setJointEfforts
void setJointEfforts(const JointModel *joint, const double *effort)
planning_scene_monitor::CurrentStateMonitor::jointStateCallback
void jointStateCallback(const sensor_msgs::JointStateConstPtr &joint_state)
Definition: current_state_monitor.cpp:326
planning_scene_monitor::CurrentStateMonitor::setToCurrentState
void setToCurrentState(moveit::core::RobotState &upd) const
Set the state upd to the current state maintained by this class.
Definition: current_state_monitor.cpp:143
ros::NodeHandle::subscribe
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
planning_scene_monitor::CurrentStateMonitor::haveCompleteState
bool haveCompleteState(const std::string &group="") const
Query whether we have joint state information for all DOFs in the kinematic model.
Definition: current_state_monitor.h:131
ros::WallTime
ROS_WARN_STREAM_ONCE_NAMED
#define ROS_WARN_STREAM_ONCE_NAMED(name, args)
planning_scene_monitor::CurrentStateMonitor::waitForCurrentState
bool waitForCurrentState(const ros::Time t=ros::Time::now(), double wait_time=1.0) const
Wait for at most wait_time seconds (default 1s) for a robot state more recent than t.
Definition: current_state_monitor.cpp:272
tf2::transformToEigen
Eigen::Isometry3d transformToEigen(const geometry_msgs::Transform &t)
ROS_WARN_STREAM_NAMED
#define ROS_WARN_STREAM_NAMED(name, args)
planning_scene_monitor::CurrentStateMonitor::error_
double error_
Definition: current_state_monitor.h:282
moveit::core::RobotState::getVariablePositions
double * getVariablePositions()
start
ROSCPP_DECL void start()
planning_scene_monitor::CurrentStateMonitor::tf_connection_
std::shared_ptr< TFConnection > tf_connection_
Definition: current_state_monitor.h:289
planning_scene_monitor::CurrentStateMonitor::tf_buffer_
std::shared_ptr< tf2_ros::Buffer > tf_buffer_
Definition: current_state_monitor.h:275
planning_scene_monitor::CurrentStateMonitor::joint_state_subscriber_
ros::Subscriber joint_state_subscriber_
Definition: current_state_monitor.h:283
moveit::core::RobotState::getVariableVelocities
double * getVariableVelocities()
ros::Time
planning_scene_monitor::CurrentStateMonitor::tfCallback
void tfCallback()
Definition: current_state_monitor.cpp:416
tf_buffer
tf2_ros::Buffer * tf_buffer
std
moveit::core::RobotState::getJointPositions
const double * getJointPositions(const std::string &joint_name) const
moveit::core::LinkModel::jointOriginTransformIsIdentity
bool jointOriginTransformIsIdentity() const
moveit::core::JointModelGroup
moveit::core::RobotState::setJointVelocities
void setJointVelocities(const JointModel *joint, const double *velocity)
ROS_INFO_STREAM_NAMED
#define ROS_INFO_STREAM_NAMED(name, args)
planning_scene_monitor::CurrentStateMonitor::waitForCompleteState
bool waitForCompleteState(double wait_time) const
Wait for at most wait_time seconds until the complete robot state is known.
Definition: current_state_monitor.cpp:294
tf2_geometry_msgs.h
LOGNAME
constexpr char LOGNAME[]
Definition: current_state_monitor.cpp:44
moveit::core::RobotState::setVariableAccelerations
void setVariableAccelerations(const double *acceleration)
planning_scene_monitor::CurrentStateMonitor::getCurrentState
moveit::core::RobotStatePtr getCurrentState() const
Get the current state.
Definition: current_state_monitor.cpp:72
moveit::core::RevoluteJointModel
planning_scene_monitor::CurrentStateMonitor::getCurrentStateValues
std::map< std::string, double > getCurrentStateValues() const
Get the current state values as a map from joint names to joint state values.
Definition: current_state_monitor.cpp:132
planning_scene_monitor::CurrentStateMonitor::robot_state_
moveit::core::RobotState robot_state_
Definition: current_state_monitor.h:277
ros::Duration::sleep
bool sleep() const
planning_scene_monitor::CurrentStateMonitor::clearUpdateCallbacks
void clearUpdateCallbacks()
Clear the functions to be called when an update to the joint state is received.
Definition: current_state_monitor.cpp:174
moveit::core::RobotState::hasEffort
bool hasEffort() const
ros::WallDuration
tf2::TransformException
planning_scene_monitor::CurrentStateMonitor::getCurrentStateAndTime
std::pair< moveit::core::RobotStatePtr, ros::Time > getCurrentStateAndTime(const std::string &group="") const
Get the current state and its time stamp.
Definition: current_state_monitor.cpp:125
ros::Duration
planning_scene_monitor::CurrentStateMonitor::getCurrentStateTime
ros::Time getCurrentStateTime(const std::string &group="") const
Get the time stamp for the current state.
Definition: current_state_monitor.cpp:118
t
geometry_msgs::TransformStamped t
moveit::core::JointModel
planning_scene_monitor::CurrentStateMonitor::monitor_start_time_
ros::Time monitor_start_time_
Definition: current_state_monitor.h:281
planning_scene_monitor::CurrentStateMonitor::copy_dynamics_
bool copy_dynamics_
Definition: current_state_monitor.h:280
ros::NodeHandle
moveit::core::RobotState::getJointVelocities
const double * getJointVelocities(const std::string &joint_name) const
planning_scene_monitor::CurrentStateMonitor::getMonitoredTopic
std::string getMonitoredTopic() const
Get the name of the topic being monitored. Returns an empty string if the monitor is inactive.
Definition: current_state_monitor.cpp:219
ros::Time::now
static Time now()
planning_scene_monitor::CurrentStateMonitor::state_monitor_started_
bool state_monitor_started_
Definition: current_state_monitor.h:279
planning_scene_monitor::CurrentStateMonitor::addUpdateCallback
void addUpdateCallback(const JointStateUpdateCallback &fn)
Add a function that will be called whenever the joint state is updated.
Definition: current_state_monitor.cpp:168


planning
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Sat Apr 27 2024 02:26:03