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

Deprecated issue in electric regarding one of scan member functions

asked 2011-12-24 08:22:42 -0500

alfa_80 gravatar image

updated 2011-12-25 01:25:41 -0500

joq gravatar image

I have a line of code that has deprecated issue in electric and I would like to know what is its better substitute.

Issue:

=> scan.set_ranges_size((int)(90/0.25));

[Warning:‘void sensor_msgs::LaserScan_<containerallocator>::set_ranges_size(uint32_t) [with ContainerAllocator = std::allocator<void>]’ is deprecated (declared at /opt/ros/electric/stacks/common_msgs/sensor_msgs/msg_gen/cpp/include/ sensor_msgs/LaserScan.h:85)]

P/S: Waiting for @joq's answer for he has done it already. This post is a refactor one.

edit retag flag offensive close merge delete

Comments

It would probably work better for others with similar problems to divide this into two separate questions: one for set_ranges_size and another for the btQuaternion constructor.
joq gravatar image joq  ( 2011-12-24 09:38:47 -0500 )edit
I've just divided them, could you please cut and paste your previous answer accordingly. Thanks in advance.
alfa_80 gravatar image alfa_80  ( 2011-12-24 19:46:35 -0500 )edit
@joq: Thanks a lot for the suggesting of dividing them. Yes, it's indeed better for the community.
alfa_80 gravatar image alfa_80  ( 2011-12-24 21:03:21 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2011-12-24 09:25:25 -0500

joq gravatar image

updated 2011-12-25 01:23:55 -0500

Use the std::vector resize method directly:

scan.ranges.resize((int)(90/0.25));

Be careful of that (int) cast. I believe the floating point result will be exact in this example, so truncation should not be an issue. Generally, it is better to round explicitly.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-12-24 08:22:42 -0500

Seen: 267 times

Last updated: Dec 25 '11