ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

pointer for sensor_msgs::LaserScan

asked 2013-01-25 02:56:17 -0500

navderm gravatar image

updated 2014-01-28 17:14:59 -0500

ngrennan gravatar image


I have sensor_msgs::LaserScanPtr& scan_msg being passed in a function. the first line is BOOST::ASSERT(!scan_msg); the second line is BOOST::ASSERT(!scan_msg->ranges);

Problem: it has a compilation error : ! not defined for shared pointer so, I make a change BOOST::ASSERT(!scan_msg->ranges.get()) Now it has compilation error : get not defined for ranges .

What am I supposed to do to see if ranges is not empty ??? (I have considered operator precendence and applied all the parenthesis I could, to no avail).

~Cheers! navderm

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2013-01-25 03:56:02 -0500

joq gravatar image

The ranges field is just a std::vector. Try this:

if (scan_msg->ranges.empty()) { ... }
edit flag offensive delete link more

Question Tools


Asked: 2013-01-25 02:56:17 -0500

Seen: 564 times

Last updated: Jan 25 '13