Ask Your Question
0

How to call a service with begin and end time as request/input

asked 2018-03-16 10:02:51 -0500

BhanuKiran.Chaluvadi gravatar image

updated 2018-03-16 10:04:45 -0500

Hi,

I am looking to call laser_assembler call back service -AssembleScans .

time begin
time end
---
sensor_msgs/PointCloud cloud
  std_msgs/Header header
    uint32 seq
    time stamp
    string frame_id
  geometry_msgs/Point32[] points
    float32 x
    float32 y
    float32 z
  sensor_msgs/ChannelFloat32[] channels
    string name
    float32[] values

I am looking to call this service in my velocity call back function but not how to input choose the start and end time.

There is an example in laser_assembler package using timer call back

void timerCallback(const ros::TimerEvent& e)
{
    AssembleScans srv;
    srv.request.begin = e.last_real;
    srv.request.end   = e.current_real;
    client_.call(srv)
}

Now I am looking the same service from a velocity call back

void  velocity_cb (const geometry_msgs::Twist& cmd_vel)
{
    AssembleScans srv;
    srv.request.begin = ???;
    srv.request.end   = ???;
}

Not sure how to input srv.request.begin , srv.request.end .

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-21 15:48:11 -0500

knxa gravatar image

I don't know anything about the laser_assembler, but a ros time object can be instantiated like in this example :

srv.request.begin = ros::Time::now();
srv.request.end = ros::Time::now() + ros::Duration(59);

See ros time

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-16 10:02:51 -0500

Seen: 41 times

Last updated: Mar 21 '18