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

setting marker for given period time fails

asked 2016-09-10 04:25:50 -0500

dinesh gravatar image

updated 2016-09-10 04:26:50 -0500

I am trying to visualize a specific marker for few period of time, but when i try this code it shows error:

 error: no match for ‘operator=’ (operand types are ‘visualization_msgs::Marker_<std::allocator<void> >::_lifetime_type {aka ros::Duration}’ and ‘int’)
     points.scale.y = 0.01; points.lifetime=1;

My codes are:

 visualization_msgs::Marker points, line_strip, line_list;
     points.header.frame_id = line_strip.header.frame_id = line_list.header.frame_id = "/camera_depth_frame";    points.header.stamp = line_strip.header.stamp = line_list.header.stamp = ros::Time::now();
        points.ns = line_strip.ns = line_list.ns = "lines";
    points.action =line_strip.action = line_list.action = visualization_msgs::Marker::ADD;
    points.pose.orientation.w = line_strip.pose.orientation.w = line_list.pose.orientation.w = 1.0;
    points.id = 0;
    line_strip.id = 1;
    line_list.id = 2;
    points.type = visualization_msgs::Marker::POINTS;
    line_strip.type = visualization_msgs::Marker::LINE_STRIP;

line_list.type = visualization_msgs::Marker::LINE_LIST;
points.scale.x = 0.01; 
points.scale.y = 0.01; points.lifetime=1;

How can i use this lifetime parameter? For eg. here i was trying to set lifetime of points as 1 sec.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-09-10 07:48:04 -0500

kramer gravatar image

Read the error message. You cannot set (that is, use the = operator) the field points.lifetime (which is an object of type ros::Duration) to an int.

You can, however, set points.lifetime to ros::Duration(1.0).

edit flag offensive delete link more

Comments

i have did that also points.lifetime=ros::Duration(0.5) but the points were staying for more than 0.5 sec so. But i'll try it again, re test.

dinesh gravatar image dinesh  ( 2016-09-10 10:01:35 -0500 )edit

ok it looks like it works, but the previous points are again appearing after being replaced by another point.

dinesh gravatar image dinesh  ( 2016-09-11 12:24:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-10 04:25:50 -0500

Seen: 430 times

Last updated: Sep 10 '16