mrpt_reactivenav2d_node.cpp
Go to the documentation of this file.
1 /***********************************************************************************
2  * Revised BSD License *
3  * Copyright (c) 2014-2023, Jose-Luis Blanco <jlblanco@ual.es> *
4  * All rights reserved. *
5  * *
6  * Redistribution and use in source and binary forms, with or without *
7  * modification, are permitted provided that the following conditions are met: *
8  * * Redistributions of source code must retain the above copyright *
9  * notice, this list of conditions and the following disclaimer. *
10  * * Redistributions in binary form must reproduce the above copyright *
11  * notice, this list of conditions and the following disclaimer in the *
12  * documentation and/or other materials provided with the distribution. *
13  * * Neither the name of the Vienna University of Technology nor the *
14  * names of its contributors may be used to endorse or promote products *
15  * derived from this software without specific prior written permission. *
16  * *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  *AND *
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  **
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
22  * DISCLAIMED. IN NO EVENT SHALL Markus Bader BE LIABLE FOR ANY *
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  **
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  **
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31  ***********************************************************************************/
32 
33 #include <geometry_msgs/Polygon.h>
34 #include <geometry_msgs/PoseStamped.h>
35 #include <mrpt/config/CConfigFile.h>
36 #include <mrpt/config/CConfigFileMemory.h>
37 #include <mrpt/kinematics/CVehicleVelCmd_DiffDriven.h>
38 #include <mrpt/maps/CSimplePointsMap.h>
39 #include <mrpt/nav/reactive/CReactiveNavigationSystem.h>
40 #include <mrpt/nav/reactive/TWaypoint.h>
41 #include <mrpt/obs/CObservationOdometry.h>
42 #include <mrpt/ros1bridge/point_cloud2.h>
43 #include <mrpt/ros1bridge/pose.h>
44 #include <mrpt/ros1bridge/time.h>
45 #include <mrpt/system/CTimeLogger.h>
46 #include <mrpt/system/filesystem.h>
47 #include <mrpt/system/os.h>
48 #include <mrpt_msgs/Waypoint.h>
49 #include <mrpt_msgs/WaypointSequence.h>
50 #include <nav_msgs/Odometry.h>
51 #include <ros/ros.h>
52 #include <sensor_msgs/LaserScan.h>
53 #include <sensor_msgs/PointCloud2.h>
56 
57 #include <mutex>
58 
60 #include "tf2_ros/buffer.h"
62 
63 using namespace mrpt::nav;
64 using mrpt::maps::CSimplePointsMap;
65 using namespace mrpt::system;
66 using namespace mrpt::config;
67 
68 // The ROS node
70 {
71  private:
73  {
74  TAuxInitializer(int argc, char** argv)
75  {
76  ros::init(argc, argv, "mrpt_reactivenav2d");
77  }
78  };
79 
80  CTimeLogger m_profiler;
82  ros::NodeHandle m_nh{};
83  ros::NodeHandle m_localn{"~"};
84 
93 
95  tf2_ros::TransformListener m_tf_listener{m_tf_buffer};
98  bool m_1st_time_init = false;
99  double m_target_allowed_distance = 0.40f;
100  double m_nav_period = 0.1;
101 
102  std::string m_sub_topic_reactive_nav_goal = "reactive_nav_goal";
103  std::string m_sub_topic_local_obstacles = "local_map_pointcloud";
104  std::string m_sub_topic_robot_shape{};
105 
106  std::string m_pub_topic_cmd_vel = "cmd_vel";
107  std::string m_sub_topic_wp_seq = "reactive_nav_waypoints";
108  std::string m_sub_topic_odometry = "odom";
109 
110  std::string m_frameid_reference = "map";
111  std::string m_frameid_robot = "base_link";
112 
113  std::string m_plugin_file;
114 
115  bool m_save_nav_log = false;
116 
118 
119  mrpt::obs::CObservationOdometry m_odometry;
120  CSimplePointsMap m_last_obstacles;
122  std::mutex m_odometry_cs;
123 
124  struct MyReactiveInterface : public mrpt::nav::CRobot2NavInterface
125  {
127 
128  MyReactiveInterface(ReactiveNav2DNode& parent) : m_parent(parent) {}
129 
137  mrpt::math::TPose2D& curPose, mrpt::math::TTwist2D& curVel,
138  mrpt::system::TTimeStamp& timestamp,
139  mrpt::math::TPose2D& curOdometry, std::string& frame_id) override
140  {
141  double curV, curW;
142 
143  CTimeLoggerEntry tle(
144  m_parent.m_profiler, "getCurrentPoseAndSpeeds");
145 
146  ros::Duration timeout(0.1);
147 
148  geometry_msgs::TransformStamped tfGeom;
149  try
150  {
151  CTimeLoggerEntry tle2(
152  m_parent.m_profiler,
153  "getCurrentPoseAndSpeeds.lookupTransform_sensor");
154 
155  tfGeom = m_parent.m_tf_buffer.lookupTransform(
156  m_parent.m_frameid_reference, m_parent.m_frameid_robot,
157  ros::Time(0), timeout);
158  }
159  catch (const tf2::TransformException& ex)
160  {
161  ROS_ERROR("%s", ex.what());
162  return false;
163  }
164 
165  tf2::Transform txRobotPose;
166  tf2::fromMsg(tfGeom.transform, txRobotPose);
167 
168  const mrpt::poses::CPose3D curRobotPose =
169  mrpt::ros1bridge::fromROS(txRobotPose);
170 
171  timestamp = mrpt::ros1bridge::fromROS(tfGeom.header.stamp);
172 
173  // Explicit 3d->2d to confirm we know we're losing information
174  curPose = mrpt::poses::CPose2D(curRobotPose).asTPose();
175  curOdometry = curPose;
176 
177  curV = curW = 0;
178  MRPT_TODO("Retrieve current speeds from /odom topic?");
179  ROS_DEBUG(
180  "[getCurrentPoseAndSpeeds] Latest pose: %s",
181  curPose.asString().c_str());
182 
183  // From local to global:
184  curVel = mrpt::math::TTwist2D(curV, .0, curW).rotated(curPose.phi);
185 
186  return true;
187  }
188 
195  const mrpt::kinematics::CVehicleVelCmd& vel_cmd) override
196  {
197  using namespace mrpt::kinematics;
198  const CVehicleVelCmd_DiffDriven* vel_cmd_diff_driven =
199  dynamic_cast<const CVehicleVelCmd_DiffDriven*>(&vel_cmd);
200  ASSERT_(vel_cmd_diff_driven);
201 
202  const double v = vel_cmd_diff_driven->lin_vel;
203  const double w = vel_cmd_diff_driven->ang_vel;
204  ROS_DEBUG(
205  "changeSpeeds: v=%7.4f m/s w=%8.3f deg/s", v,
206  w * 180.0f / M_PI);
207  geometry_msgs::Twist cmd;
208  cmd.linear.x = v;
209  cmd.angular.z = w;
210  m_parent.m_pub_cmd_vel.publish(cmd);
211  return true;
212  }
213 
214  bool stop(bool isEmergency) override
215  {
216  mrpt::kinematics::CVehicleVelCmd_DiffDriven vel_cmd;
217  vel_cmd.lin_vel = 0;
218  vel_cmd.ang_vel = 0;
219  return changeSpeeds(vel_cmd);
220  }
221 
225  virtual bool startWatchdog(float T_ms) override { return true; }
228  virtual bool stopWatchdog() override { return true; }
232  CSimplePointsMap& obstacles,
233  mrpt::system::TTimeStamp& timestamp) override
234  {
235  timestamp = mrpt::Clock::now();
236  std::lock_guard<std::mutex> csl(m_parent.m_last_obstacles_cs);
237  obstacles = m_parent.m_last_obstacles;
238 
239  MRPT_TODO("TODO: Check age of obstacles!");
240  return true;
241  }
242 
243  mrpt::kinematics::CVehicleVelCmd::Ptr getEmergencyStopCmd() override
244  {
245  return getStopCmd();
246  }
247  mrpt::kinematics::CVehicleVelCmd::Ptr getStopCmd() override
248  {
249  mrpt::kinematics::CVehicleVelCmd::Ptr ret =
250  mrpt::kinematics::CVehicleVelCmd::Ptr(
251  new mrpt::kinematics::CVehicleVelCmd_DiffDriven);
252  ret->setToStop();
253  return ret;
254  }
255 
256  void sendNavigationStartEvent() override {}
257  void sendNavigationEndEvent() override {}
259  void sendWaySeemsBlockedEvent() override {}
260  };
261 
263 
264  CReactiveNavigationSystem m_reactive_nav_engine;
266 
267  public:
269  ReactiveNav2DNode(int argc, char** argv)
270  : m_auxinit(argc, argv),
271  m_nh(),
272  m_localn("~"),
273  m_reactive_if(*this),
274  m_reactive_nav_engine(m_reactive_if)
275  {
276  // Load params:
277  std::string cfg_file_reactive;
278  m_localn.param(
279  "cfg_file_reactive", cfg_file_reactive, cfg_file_reactive);
280  m_localn.param(
281  "target_allowed_distance", m_target_allowed_distance,
282  m_target_allowed_distance);
283  m_localn.param("nav_period", m_nav_period, m_nav_period);
284  m_localn.param(
285  "frameid_reference", m_frameid_reference, m_frameid_reference);
286  m_localn.param("frameid_robot", m_frameid_robot, m_frameid_robot);
287  m_localn.param(
288  "topic_robot_shape", m_sub_topic_robot_shape,
289  m_sub_topic_robot_shape);
290 
291  m_localn.param("topic_wp_seq", m_sub_topic_wp_seq, m_sub_topic_wp_seq);
292  m_localn.param(
293  "topic_odometry", m_sub_topic_odometry, m_sub_topic_odometry);
294  m_localn.param(
295  "topic_cmd_vel", m_pub_topic_cmd_vel, m_pub_topic_cmd_vel);
296  m_localn.param(
297  "topic_obstacles", m_sub_topic_local_obstacles,
298  m_sub_topic_local_obstacles);
299 
300  m_localn.param("save_nav_log", m_save_nav_log, m_save_nav_log);
301 
302  m_localn.param("ptg_plugin_files", m_plugin_file, m_plugin_file);
303 
304  if (!m_plugin_file.empty())
305  {
306  ROS_INFO_STREAM("About to load plugins: " << m_plugin_file);
307  std::string errorMsgs;
308  if (!mrpt::system::loadPluginModules(m_plugin_file, errorMsgs))
309  {
310  ROS_ERROR_STREAM("Error loading rnav plugins: " << errorMsgs);
311  }
312  ROS_INFO_STREAM("Pluginns loaded OK.");
313  }
314 
315  ROS_ASSERT(m_nav_period > 0);
317  !cfg_file_reactive.empty(),
318  "Mandatory param 'cfg_file_reactive' is missing!");
320  mrpt::system::fileExists(cfg_file_reactive),
321  "Config file not found: '%s'", cfg_file_reactive.c_str());
322 
323  m_reactive_nav_engine.enableLogFile(m_save_nav_log);
324 
325  // Load reactive config:
326  // ----------------------------------------------------
327  try
328  {
329  CConfigFile cfgFil(cfg_file_reactive);
330  m_reactive_nav_engine.loadConfigFile(cfgFil);
331  }
332  catch (std::exception& e)
333  {
334  ROS_ERROR(
335  "Exception initializing reactive navigation engine:\n%s",
336  e.what());
337  throw;
338  }
339 
340  // load robot shape: (1) default, (2) via params, (3) via topic
341  // ----------------------------------------------------------------
342  // m_reactive_nav_engine.changeRobotShape();
343 
344  // Init this subscriber first so we know asap the desired robot shape,
345  // if provided via a topic:
346  if (!m_sub_topic_robot_shape.empty())
347  {
348  ROS_INFO(
349  "Subscribing to robot shape via topic '%s'...",
350  m_sub_topic_robot_shape.c_str());
351  m_sub_robot_shape = m_nh.subscribe<geometry_msgs::Polygon>(
352  m_sub_topic_robot_shape, 1,
354  }
355  else
356  {
357  // Load robot shape: 1/2 polygon
358  // ---------------------------------------------
359  CConfigFile c(cfg_file_reactive);
360  std::string s = "CReactiveNavigationSystem";
361 
362  std::vector<float> xs, ys;
363  c.read_vector(
364  s, "RobotModel_shape2D_xs", std::vector<float>(), xs, false);
365  c.read_vector(
366  s, "RobotModel_shape2D_ys", std::vector<float>(), ys, false);
367  ASSERTMSG_(
368  xs.size() == ys.size(),
369  "Config parameters `RobotModel_shape2D_xs` and "
370  "`RobotModel_shape2D_ys` "
371  "must have the same length!");
372  if (!xs.empty())
373  {
374  mrpt::math::CPolygon poly;
375  poly.resize(xs.size());
376  for (size_t i = 0; i < xs.size(); i++)
377  {
378  poly[i].x = xs[i];
379  poly[i].y = ys[i];
380  }
381 
382  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
383  m_reactive_nav_engine.changeRobotShape(poly);
384  }
385 
386  // Load robot shape: 2/2 circle
387  // ---------------------------------------------
388  if (const double robot_radius = c.read_double(
389  s, "RobotModel_circular_shape_radius", -1.0, false);
390  robot_radius > 0)
391  {
392  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
393  m_reactive_nav_engine.changeRobotCircularShapeRadius(
394  robot_radius);
395  }
396  }
397 
398  // Init ROS publishers:
399  // -----------------------
400  m_pub_cmd_vel =
401  m_nh.advertise<geometry_msgs::Twist>(m_pub_topic_cmd_vel, 1);
402 
403  // Init ROS subs:
404  // -----------------------
405  // odometry
406  m_sub_odometry = m_nh.subscribe(
407  m_sub_topic_odometry, 1, &ReactiveNav2DNode::onOdometryReceived,
408  this);
409  // waypoints
410  m_sub_wp_seq = m_nh.subscribe(
411  m_sub_topic_wp_seq, 1, &ReactiveNav2DNode::onWaypointSeqReceived,
412  this);
413  // "/reactive_nav_goal", "/move_base_simple/goal" (
414  // geometry_msgs/PoseStamped )
415  m_sub_nav_goal = m_nh.subscribe<geometry_msgs::PoseStamped>(
416  m_sub_topic_reactive_nav_goal, 1,
418  m_sub_local_obs = m_nh.subscribe<sensor_msgs::PointCloud2>(
419  m_sub_topic_local_obstacles, 1,
421 
422  // Init timers:
423  // ----------------------------------------------------
424  m_timer_run_nav = m_nh.createTimer(
426  this);
427 
428  } // end ctor
429 
434  void navigateTo(const mrpt::math::TPose2D& target)
435  {
436  ROS_INFO(
437  "[navigateTo] Starting navigation to %s",
438  target.asString().c_str());
439 
440  CAbstractPTGBasedReactive::TNavigationParamsPTG navParams;
441 
442  CAbstractNavigator::TargetInfo target_info;
443  target_info.target_coords.x = target.x;
444  target_info.target_coords.y = target.y;
445  target_info.targetAllowedDistance = m_target_allowed_distance;
446  target_info.targetIsRelative = false;
447 
448  // API for multiple waypoints:
449  //...
450  // navParams.multiple_targets.push_back(target_info);
451 
452  // API for single targets:
453  navParams.target = target_info;
454 
455  // Optional: restrict the PTGs to use
456  // navParams.restrict_PTG_indices.push_back(1);
457 
458  {
459  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
460  m_reactive_nav_engine.navigate(&navParams);
461  }
462  }
463 
466  {
467  // 1st time init:
468  // ----------------------------------------------------
469  if (!m_1st_time_init)
470  {
471  m_1st_time_init = true;
472  ROS_INFO(
473  "[ReactiveNav2DNode] Initializing reactive navigation "
474  "engine...");
475  {
476  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
477  m_reactive_nav_engine.initialize();
478  }
479  ROS_INFO(
480  "[ReactiveNav2DNode] Reactive navigation engine init done!");
481  }
482 
483  CTimeLoggerEntry tle(m_profiler, "onDoNavigation");
484  // Main nav loop (in whatever state nav is: IDLE, NAVIGATING, etc.)
485  m_reactive_nav_engine.navigationStep();
486  }
487 
488  void onOdometryReceived(const nav_msgs::Odometry& msg)
489  {
490  std::lock_guard<std::mutex> csl(m_odometry_cs);
491  tf2::Quaternion quat(
492  msg.pose.pose.orientation.x, msg.pose.pose.orientation.y,
493  msg.pose.pose.orientation.z, msg.pose.pose.orientation.w);
494  tf2::Matrix3x3 mat(quat);
495  double roll, pitch, yaw;
496  mat.getRPY(roll, pitch, yaw);
497  m_odometry.odometry = mrpt::poses::CPose2D(
498  msg.pose.pose.position.x, msg.pose.pose.position.y, yaw);
499 
500  m_odometry.velocityLocal.vx = msg.twist.twist.linear.x;
501  m_odometry.velocityLocal.vy = msg.twist.twist.linear.y;
502  m_odometry.velocityLocal.omega = msg.twist.twist.angular.z;
503  m_odometry.hasVelocities = true;
504 
505  ROS_DEBUG_STREAM("Odometry updated");
506  }
507 
508  void updateWaypointSequence(const mrpt_msgs::WaypointSequence& msg)
509  {
510  mrpt::nav::TWaypointSequence wps;
511 
512  for (const auto& wp : msg.waypoints)
513  {
514  tf2::Quaternion quat(
515  wp.target.orientation.x, wp.target.orientation.y,
516  wp.target.orientation.z, wp.target.orientation.w);
517  tf2::Matrix3x3 mat(quat);
518  double roll, pitch, yaw;
519  mat.getRPY(roll, pitch, yaw);
520  auto waypoint = mrpt::nav::TWaypoint(
521  wp.target.position.x, wp.target.position.y, wp.allowed_distance,
522  wp.allow_skip);
523 
524  if (yaw == yaw && !wp.ignore_heading) // regular number, not NAN
525  waypoint.target_heading = yaw;
526 
527  wps.waypoints.push_back(waypoint);
528  }
529 
530  ROS_INFO_STREAM("New navigateWaypoints() command");
531  {
532  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
533  m_reactive_nav_engine.navigateWaypoints(wps);
534  }
535  }
536  void onWaypointSeqReceived(const mrpt_msgs::WaypointSequence& wps)
537  {
538  updateWaypointSequence(wps);
539  }
540 
541  void onRosGoalReceived(const geometry_msgs::PoseStampedConstPtr& trg_ptr)
542  {
543  geometry_msgs::PoseStamped trg = *trg_ptr;
544 
545  ROS_INFO(
546  "Nav target received via topic sub: (%.03f,%.03f, %.03fdeg) "
547  "[frame_id=%s]",
548  trg.pose.position.x, trg.pose.position.y,
549  trg.pose.orientation.z * 180.0 / M_PI, trg.header.frame_id.c_str());
550 
551  // Convert to the "m_frameid_reference" frame of coordinates:
552  if (trg.header.frame_id != m_frameid_reference)
553  {
554  ros::Duration timeout(0.2);
555  try
556  {
557  geometry_msgs::TransformStamped ref_to_trgFrame =
558  m_tf_buffer.lookupTransform(
559  trg.header.frame_id, m_frameid_reference, ros::Time(0),
560  timeout);
561 
562  tf2::doTransform(trg, trg, ref_to_trgFrame);
563  }
564  catch (const tf2::TransformException& ex)
565  {
566  ROS_ERROR("%s", ex.what());
567  return;
568  }
569  }
570 
571  this->navigateTo(mrpt::math::TPose2D(
572  trg.pose.position.x, trg.pose.position.y, trg.pose.orientation.z));
573  }
574 
575  void onRosLocalObstacles(const sensor_msgs::PointCloud2::ConstPtr& obs)
576  {
577  std::lock_guard<std::mutex> csl(m_last_obstacles_cs);
578  mrpt::ros1bridge::fromROS(*obs, m_last_obstacles);
579  // ROS_DEBUG("Local obstacles received: %u points", static_cast<unsigned
580  // int>(m_last_obstacles.size()) );
581  }
582 
583  void onRosSetRobotShape(const geometry_msgs::Polygon::ConstPtr& newShape)
584  {
586  "[onRosSetRobotShape] Robot shape received via topic: "
587  << *newShape);
588 
589  mrpt::math::CPolygon poly;
590  poly.resize(newShape->points.size());
591  for (size_t i = 0; i < newShape->points.size(); i++)
592  {
593  poly[i].x = newShape->points[i].x;
594  poly[i].y = newShape->points[i].y;
595  }
596 
597  {
598  std::lock_guard<std::mutex> csl(m_reactive_nav_engine_cs);
599  m_reactive_nav_engine.changeRobotShape(poly);
600  }
601  }
602 
603 }; // end class
604 
605 int main(int argc, char** argv)
606 {
607  ReactiveNav2DNode the_node(argc, argv);
608  ros::spin();
609  return 0;
610 }
ReactiveNav2DNode::m_timer_run_nav
ros::Timer m_timer_run_nav
Definition: mrpt_reactivenav2d_node.cpp:117
ReactiveNav2DNode::MyReactiveInterface::startWatchdog
virtual bool startWatchdog(float T_ms) override
Definition: mrpt_reactivenav2d_node.cpp:225
ros::Publisher
ReactiveNav2DNode::m_sub_wp_seq
ros::Subscriber m_sub_wp_seq
Definition: mrpt_reactivenav2d_node.cpp:88
ROS_ERROR_STREAM
#define ROS_ERROR_STREAM(args)
ReactiveNav2DNode::TAuxInitializer::TAuxInitializer
TAuxInitializer(int argc, char **argv)
Definition: mrpt_reactivenav2d_node.cpp:74
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ReactiveNav2DNode::navigateTo
void navigateTo(const mrpt::math::TPose2D &target)
Issue a navigation command.
Definition: mrpt_reactivenav2d_node.cpp:434
ReactiveNav2DNode::m_reactive_if
MyReactiveInterface m_reactive_if
Definition: mrpt_reactivenav2d_node.cpp:262
tf2::fromMsg
void fromMsg(const A &, B &b)
s
XmlRpcServer s
ReactiveNav2DNode::onOdometryReceived
void onOdometryReceived(const nav_msgs::Odometry &msg)
Definition: mrpt_reactivenav2d_node.cpp:488
ros.h
ReactiveNav2DNode::onRosGoalReceived
void onRosGoalReceived(const geometry_msgs::PoseStampedConstPtr &trg_ptr)
Definition: mrpt_reactivenav2d_node.cpp:541
ReactiveNav2DNode::ReactiveNav2DNode
ReactiveNav2DNode(int argc, char **argv)
Definition: mrpt_reactivenav2d_node.cpp:269
ReactiveNav2DNode::MyReactiveInterface::sendNavigationEndDueToErrorEvent
void sendNavigationEndDueToErrorEvent() override
Definition: mrpt_reactivenav2d_node.cpp:258
buffer.h
ReactiveNav2DNode::m_profiler
CTimeLogger m_profiler
Definition: mrpt_reactivenav2d_node.cpp:80
ReactiveNav2DNode::m_frameid_robot
std::string m_frameid_robot
Definition: mrpt_reactivenav2d_node.cpp:111
ReactiveNav2DNode::onWaypointSeqReceived
void onWaypointSeqReceived(const mrpt_msgs::WaypointSequence &wps)
Definition: mrpt_reactivenav2d_node.cpp:536
main
int main(int argc, char **argv)
Definition: mrpt_reactivenav2d_node.cpp:605
ReactiveNav2DNode::m_sub_nav_goal
ros::Subscriber m_sub_nav_goal
Definition: mrpt_reactivenav2d_node.cpp:89
ReactiveNav2DNode::m_sub_local_obs
ros::Subscriber m_sub_local_obs
Definition: mrpt_reactivenav2d_node.cpp:90
ReactiveNav2DNode::m_sub_robot_shape
ros::Subscriber m_sub_robot_shape
Definition: mrpt_reactivenav2d_node.cpp:91
ROS_DEBUG_STREAM
#define ROS_DEBUG_STREAM(args)
ReactiveNav2DNode::onRosSetRobotShape
void onRosSetRobotShape(const geometry_msgs::Polygon::ConstPtr &newShape)
Definition: mrpt_reactivenav2d_node.cpp:583
ReactiveNav2DNode::TAuxInitializer
Definition: mrpt_reactivenav2d_node.cpp:72
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
f
f
ReactiveNav2DNode::MyReactiveInterface::changeSpeeds
bool changeSpeeds(const mrpt::kinematics::CVehicleVelCmd &vel_cmd) override
Definition: mrpt_reactivenav2d_node.cpp:194
ReactiveNav2DNode::MyReactiveInterface::m_parent
ReactiveNav2DNode & m_parent
Definition: mrpt_reactivenav2d_node.cpp:126
ReactiveNav2DNode::MyReactiveInterface::stopWatchdog
virtual bool stopWatchdog() override
Definition: mrpt_reactivenav2d_node.cpp:228
tf2_ros::TransformListener
tf2::Matrix3x3::getRPY
void getRPY(tf2Scalar &roll, tf2Scalar &pitch, tf2Scalar &yaw, unsigned int solution_number=1) const
ReactiveNav2DNode::MyReactiveInterface::getStopCmd
mrpt::kinematics::CVehicleVelCmd::Ptr getStopCmd() override
Definition: mrpt_reactivenav2d_node.cpp:247
ReactiveNav2DNode::m_last_obstacles_cs
std::mutex m_last_obstacles_cs
Definition: mrpt_reactivenav2d_node.cpp:121
ROS_DEBUG
#define ROS_DEBUG(...)
ReactiveNav2DNode::m_sub_odometry
ros::Subscriber m_sub_odometry
Definition: mrpt_reactivenav2d_node.cpp:87
Quaternion.h
ReactiveNav2DNode::m_auxinit
TAuxInitializer m_auxinit
Just to make sure ROS is init first.
Definition: mrpt_reactivenav2d_node.cpp:81
tf2::Transform
ReactiveNav2DNode::m_pub_cmd_vel
ros::Publisher m_pub_cmd_vel
Definition: mrpt_reactivenav2d_node.cpp:92
ROS_ASSERT_MSG
#define ROS_ASSERT_MSG(cond,...)
ReactiveNav2DNode::onDoNavigation
void onDoNavigation(const ros::TimerEvent &)
Definition: mrpt_reactivenav2d_node.cpp:465
ReactiveNav2DNode::MyReactiveInterface::MyReactiveInterface
MyReactiveInterface(ReactiveNav2DNode &parent)
Definition: mrpt_reactivenav2d_node.cpp:128
ReactiveNav2DNode::m_odometry_cs
std::mutex m_odometry_cs
Definition: mrpt_reactivenav2d_node.cpp:122
ReactiveNav2DNode::m_tf_buffer
tf2_ros::Buffer m_tf_buffer
Definition: mrpt_reactivenav2d_node.cpp:94
ReactiveNav2DNode::MyReactiveInterface::sendNavigationStartEvent
void sendNavigationStartEvent() override
Definition: mrpt_reactivenav2d_node.cpp:256
tf2_ros::Buffer
ros::TimerEvent
ROS_INFO_STREAM
#define ROS_INFO_STREAM(args)
ReactiveNav2DNode::m_reactive_nav_engine_cs
std::mutex m_reactive_nav_engine_cs
Definition: mrpt_reactivenav2d_node.cpp:265
ReactiveNav2DNode::MyReactiveInterface
Definition: mrpt_reactivenav2d_node.cpp:124
ReactiveNav2DNode::MyReactiveInterface::sendWaySeemsBlockedEvent
void sendWaySeemsBlockedEvent() override
Definition: mrpt_reactivenav2d_node.cpp:259
ReactiveNav2DNode::m_plugin_file
std::string m_plugin_file
Definition: mrpt_reactivenav2d_node.cpp:113
ReactiveNav2DNode::MyReactiveInterface::senseObstacles
bool senseObstacles(CSimplePointsMap &obstacles, mrpt::system::TTimeStamp &timestamp) override
Definition: mrpt_reactivenav2d_node.cpp:231
transform_listener.h
ReactiveNav2DNode::MyReactiveInterface::sendNavigationEndEvent
void sendNavigationEndEvent() override
Definition: mrpt_reactivenav2d_node.cpp:257
ReactiveNav2DNode::onRosLocalObstacles
void onRosLocalObstacles(const sensor_msgs::PointCloud2::ConstPtr &obs)
Definition: mrpt_reactivenav2d_node.cpp:575
ros::Time
tf2::doTransform
void doTransform(const T &data_in, T &data_out, const geometry_msgs::TransformStamped &transform)
ReactiveNav2DNode::MyReactiveInterface::getEmergencyStopCmd
mrpt::kinematics::CVehicleVelCmd::Ptr getEmergencyStopCmd() override
Definition: mrpt_reactivenav2d_node.cpp:243
ReactiveNav2DNode::m_odometry
mrpt::obs::CObservationOdometry m_odometry
Definition: mrpt_reactivenav2d_node.cpp:119
ReactiveNav2DNode::m_reactive_nav_engine
CReactiveNavigationSystem m_reactive_nav_engine
Definition: mrpt_reactivenav2d_node.cpp:264
ROS_ERROR
#define ROS_ERROR(...)
tf2::Quaternion
ReactiveNav2DNode::MyReactiveInterface::getCurrentPoseAndSpeeds
bool getCurrentPoseAndSpeeds(mrpt::math::TPose2D &curPose, mrpt::math::TTwist2D &curVel, mrpt::system::TTimeStamp &timestamp, mrpt::math::TPose2D &curOdometry, std::string &frame_id) override
Definition: mrpt_reactivenav2d_node.cpp:136
tf2_geometry_msgs.h
ReactiveNav2DNode::MyReactiveInterface::stop
bool stop(bool isEmergency) override
Definition: mrpt_reactivenav2d_node.cpp:214
ros::spin
ROSCPP_DECL void spin()
ReactiveNav2DNode::m_last_obstacles
CSimplePointsMap m_last_obstacles
Definition: mrpt_reactivenav2d_node.cpp:120
ReactiveNav2DNode
Definition: mrpt_reactivenav2d_node.cpp:69
cmd
string cmd
tf2::Matrix3x3
ReactiveNav2DNode::updateWaypointSequence
void updateWaypointSequence(const mrpt_msgs::WaypointSequence &msg)
Definition: mrpt_reactivenav2d_node.cpp:508
tf2::TransformException
ROS_INFO
#define ROS_INFO(...)
ROS_ASSERT
#define ROS_ASSERT(cond)
ReactiveNav2DNode::m_frameid_reference
std::string m_frameid_reference
Definition: mrpt_reactivenav2d_node.cpp:110
ros::Duration
Matrix3x3.h
ros::Timer
tf2_ros::Buffer::lookupTransform
virtual geometry_msgs::TransformStamped lookupTransform(const std::string &target_frame, const ros::Time &target_time, const std::string &source_frame, const ros::Time &source_time, const std::string &fixed_frame, const ros::Duration timeout) const
ros::NodeHandle
ros::Subscriber


mrpt_reactivenav2d
Author(s): Jose-Luis Blanco-Claraco
autogenerated on Tue Sep 17 2024 02:10:24