0
$\begingroup$

Rosanswers logo

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


Originally posted by navderm on ROS Answers with karma: 78 on 2013-01-25

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

if (scan_msg->ranges.empty()) { ... }

Originally posted by joq with karma: 25443 on 2013-01-25

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.