|
|
| RealtimeServerGoalHandle (std::shared_ptr< GoalHandle > &gh, const ResultSharedPtr &preallocated_result=nullptr, const FeedbackSharedPtr &preallocated_feedback=nullptr) |
| |
|
| RealtimeServerGoalHandle (std::shared_ptr< GoalHandle > &gh, const ResultSharedPtr &preallocated_result, const FeedbackSharedPtr &preallocated_feedback, rclcpp::Logger logger) |
| |
|
void | setAborted (ResultSharedPtr result=nullptr) |
| |
|
void | setCanceled (ResultSharedPtr result=nullptr) |
| |
|
void | setSucceeded (ResultSharedPtr result=nullptr) |
| |
| bool | setFeedback (FeedbackSharedPtr feedback=nullptr) |
| | Set feedback to be published by runNonRealtime().
|
| |
| template<typename FeedbackUpdateCallback > |
| bool | trySetFeedback (FeedbackUpdateCallback &&update_feedback) |
| | Update preallocated feedback to be published by runNonRealtime().
|
| |
|
void | execute () |
| |
|
bool | valid () |
| |
|
void | runNonRealtime () |
| |
|
|
std::shared_ptr< GoalHandle > | gh_ |
| |
|
ResultSharedPtr | preallocated_result_ |
| |
|
FeedbackSharedPtr | preallocated_feedback_ |
| |
◆ setFeedback()
Set feedback to be published by runNonRealtime().
This method uses a non-blocking lock acquisition with try_to_lock() and is safe to call from real-time context without causing thread blocking or priority inversion. If the lock cannot be acquired (because runNonRealtime() is holding it), the update is silently skipped to avoid blocking the real-time thread.
The feedback pointer is stored and the non-RT thread will publish it on the next runNonRealtime() call, provided the goal handle is in executing state.
- Parameters
-
| feedback | Shared pointer to feedback message. Can be nullptr to clear pending feedback. If a valid pointer is provided, the caller must not modify it while this handle may publish it. Use trySetFeedback() to safely reuse the handle's preallocated feedback message. |
- Returns
- true if the lock was acquired and feedback was successfully set, false if the lock could not be acquired (feedback update was dropped).
- Note
- If the mutex lock cannot be acquired, the feedback update is dropped without notification. This is intentional to preserve real-time guarantees. Check the return value if you need to know whether the update succeeded.
-
Feedback is only published if the goal is currently executing. If feedback is set after the goal transitions out of executing state, it will be discarded.
- See also
- runNonRealtime() for the counterpart that publishes the feedback.
-
trySetFeedback() for safe preallocated feedback reuse.
◆ trySetFeedback()
template<class Action >
template<typename FeedbackUpdateCallback >
Update preallocated feedback to be published by runNonRealtime().
The callback runs while holding the same mutex used by runNonRealtime(), ensuring that the feedback cannot be modified while it is being published. The lock is acquired without blocking and the callback is not invoked if it cannot be acquired.
- Parameters
-
| update_feedback | Callback receiving a mutable reference to the preallocated feedback message. |
- Returns
- true if the feedback was updated, false if the lock could not be acquired.
The documentation for this class was generated from the following file: