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

Revision history [back]

click to hide/show revision 1
initial version

Therefore, my question is: can I use a ros::Timer inside the action server class?

Yes (at least, if you're referring to your own action server class here, not something like SimpleActionServer).

If possible, what I have to do in order to run the server callback and the timer callback asynchronously? An asynchronous spinner is enough?

It should be, yes.

So far so good. Now, imagine I want to implement a safety layer. That is, while tracking the robot trajectory I detect that the robot reached a forbidden position and I want to halt the robot by stopping publishing velocity commands.

are you describing a valve here? So your node receives velocity commands, checks whether everything is ok. If ok, forward, if not ok, stop forwarding.

Therefore, my question is: can I use a ros::Timer inside the action server class?

Yes (at least, if you're referring to your own action server class here, not something like SimpleActionServer).

If possible, what I have to do in order to run the server callback and the timer callback asynchronously? An asynchronous spinner is enough?

It should be, yes.

If it doesn't work, post back here.

So far so good. Now, imagine I want to implement a safety layer. That is, while tracking the robot trajectory I detect that the robot reached a forbidden position and I want to halt the robot by stopping publishing velocity commands.

are you describing a valve here? So your node receives velocity commands, checks whether everything is ok. If ok, forward, if not ok, stop forwarding.

Therefore, my question is: can I use a ros::Timer inside the action server class?

Yes (at least, if you're referring to your own action server class here, not something like SimpleActionServer).

If possible, what I have to do in order to run the server callback and the timer callback asynchronously? An asynchronous spinner is enough?

It should be, yes.

If it doesn't work, post back here.

So far so good. Now, imagine I want to implement a safety layer. That is, while tracking the robot trajectory I detect that the robot reached a forbidden position and I want to halt the robot by stopping publishing velocity commands.

are you describing a valve here? So your node receives velocity commands, checks whether everything is ok. If ok, forward, if not ok, stop forwarding.


Edit:

Regarding the last question, my idea was that the action server publishes as feedback the robot pose. Then, the client cancels the goal if the robot reached a forbidden position. Does it make sense to you?

not really, but it probably does to you, so that is fine.

if the node is not a controller, where does it get its velocity commands from? And if the feedback of the robot is joint_states, couldn't your client subscribe to that topic? Or are you looking at Cartesian poses here? In that case: TF?