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

pointer for sensor_msgs::LaserScan

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

navderm gravatar image

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

ngrennan gravatar image

So,

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
3

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

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

Stats

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

Seen: 587 times

Last updated: Jan 25 '13