Here is an example code snippet to implement an Actionlib server in Python that receives a pose goal, gives a float feedback and returns a boolean in the end:
main.py1167 chars32 lines
Here, we define a class PoseActionServer
which contains a function goal_callback
that is called whenever a goal is received by the server. Inside the goal_callback
function, we execute some task and give feedback to the client as the task progresses. Once the task is complete, we set the result of the action and set the server to have succeeded.
Note that we also define the message types PoseAction
, PoseFeedback
and PoseResult
in a separate your_package.msg
file. These messages are used to define the interface between the client and the server.
gistlibby LogSnag