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

Using service client to get data in rviz2 plguin

asked 2023-03-13 07:45:41 -0600

bvbdort gravatar image

In a custom rviz2 plugin, I try to display data received by client from server.

I got the following error.

terminate called after throwing an instance of 'std::runtime_error' what(): spin_once() called while already spinning

My code is similar to the following

https://github.com/introlab/rtabmap_r...

Is it possible at the moment to use client in rviz2 plugin to get receive data.

This is related to rviz2 not on user level code.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-03-17 18:53:31 -0600

ChuiV gravatar image

You're gonna need to either use asynchronous requests, or make a new rclcpp::Node, and create your client off of it, and spin that node.

For reference, the async_send_requestmethod does take a second argument, which is the callback to run when the response is relieved. See https://github.com/ros2/examples/blob... for an example.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-03-13 07:45:41 -0600

Seen: 480 times

Last updated: Mar 17 '23