return value in action server
Hi, I'm following this tutorial http://wiki.ros.org/actionlib , and my question is,
The server can return a value to the client? How can I do?
thanks!!
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hi, I'm following this tutorial http://wiki.ros.org/actionlib , and my question is,
The server can return a value to the client? How can I do?
thanks!!
There's a short snippet sn section 5 of the page you linked:
# Define the goal
uint32 dishwasher_id # Specify which dishwasher we want to use
---
# Define the result
uint32 total_dishes_cleaned
---
# Define a feedback message
float32 percent_complete
See the line with # Define the result
? The return type of this action is uint32
and the name of the return value is total_dishes_cleaned
.
To set this return value have a look at the setSucceeded()
signature found here:
void actionlib::SimpleActionServer< ActionSpec >::setSucceeded(const Result & result = Result(),
const std::string &
text = std::string("")
)
You can call setSucceeded()
with a result as parameter. In this result object you can set the return members.
In Python it works the same.
Asked: 2015-02-19 06:40:31 -0500
Seen: 906 times
Last updated: Feb 20 '15
How to cancel goals from within an action server?
Latency when sending goal to move_base and it starting
Python action client does not connect properly
Action Client Not Picking Up Messages from Action Server
Why does SimpleActionClient abort?
rosjava actionlib waitForResult() function [closed]