-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Action support #410
base: main
Are you sure you want to change the base?
[WIP] Action support #410
Commits on Sep 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f6ced1e - Browse repository at this point
Copy the full SHA f6ced1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for f279041 - Browse repository at this point
Copy the full SHA f279041View commit details -
Configuration menu - View commit details
-
Copy full SHA for 483164a - Browse repository at this point
Copy the full SHA 483164aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f555bbf - Browse repository at this point
Copy the full SHA f555bbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for a89c196 - Browse repository at this point
Copy the full SHA a89c196View commit details -
Configuration menu - View commit details
-
Copy full SHA for 203b252 - Browse repository at this point
Copy the full SHA 203b252View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b0bf4d - Browse repository at this point
Copy the full SHA 0b0bf4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1cc545e - Browse repository at this point
Copy the full SHA 1cc545eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9fe3169 - Browse repository at this point
Copy the full SHA 9fe3169View commit details -
Configuration menu - View commit details
-
Copy full SHA for e685f83 - Browse repository at this point
Copy the full SHA e685f83View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1b5dd0c - Browse repository at this point
Copy the full SHA 1b5dd0cView commit details -
Configuration menu - View commit details
-
Copy full SHA for eaa47f1 - Browse repository at this point
Copy the full SHA eaa47f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3740a27 - Browse repository at this point
Copy the full SHA 3740a27View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e4e718 - Browse repository at this point
Copy the full SHA 3e4e718View commit details -
Configuration menu - View commit details
-
Copy full SHA for 747f05d - Browse repository at this point
Copy the full SHA 747f05dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e1c837c - Browse repository at this point
Copy the full SHA e1c837cView commit details -
Configuration menu - View commit details
-
Copy full SHA for af46ec4 - Browse repository at this point
Copy the full SHA af46ec4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e6fd1b - Browse repository at this point
Copy the full SHA 3e6fd1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 55edf88 - Browse repository at this point
Copy the full SHA 55edf88View commit details -
Fix rclrs to compile after rebase
Update uses of a `Mutex<rcl_node_t>` with a `NodeHandle`, as was done elsewhere in the crate. Also, correct the documented UUID size to 16 rather than 24. The minimal_action_client compiles, but the minimal_action_server does not yet, complaining about expecting the `rmw` versions of messages rather than the idiomatic ones.
Configuration menu - View commit details
-
Copy full SHA for dccc667 - Browse repository at this point
Copy the full SHA dccc667View commit details -
Sketch out action server construction and destruction
This follows generally the same pattern as the service server. It required adding a typesupport function to the Action trait and pulling in some more rcl_action bindings.
Configuration menu - View commit details
-
Copy full SHA for 573754d - Browse repository at this point
Copy the full SHA 573754dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3733e5e - Browse repository at this point
Copy the full SHA 3733e5eView commit details -
Pass rcl_clock_t from Node to ActionServer
This is needed to initialize the rcl_action_server_t. In rclcpp, the clock ends up stored in the Server itself (by way of ServerBase and ServerBaseImpl); we'll see if that ends up being necessary here.
Configuration menu - View commit details
-
Copy full SHA for ac4cc64 - Browse repository at this point
Copy the full SHA ac4cc64View commit details -
Configuration menu - View commit details
-
Copy full SHA for 018ef66 - Browse repository at this point
Copy the full SHA 018ef66View commit details -
Configuration menu - View commit details
-
Copy full SHA for 279bd8a - Browse repository at this point
Copy the full SHA 279bd8aView commit details -
Begin implementing ActionServerGoalHandle functions
So far, none of the implemented functionality actually depends on the action type. It could be separated out into a concrete type like is done in rclcpp, in case that reduces the cost of monomorphization.
Configuration menu - View commit details
-
Copy full SHA for 8b76a0e - Browse repository at this point
Copy the full SHA 8b76a0eView commit details -
Configuration menu - View commit details
-
Copy full SHA for a45b8ba - Browse repository at this point
Copy the full SHA a45b8baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 03b9b74 - Browse repository at this point
Copy the full SHA 03b9b74View commit details -
Configuration menu - View commit details
-
Copy full SHA for 045a66d - Browse repository at this point
Copy the full SHA 045a66dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 38c5b95 - Browse repository at this point
Copy the full SHA 38c5b95View commit details -
Take goal, cancel, and accepted callbacks in ActionServer
I'm not sure that this is actually the signature that we'll want, but we'll start from there.
Configuration menu - View commit details
-
Copy full SHA for a323bd0 - Browse repository at this point
Copy the full SHA a323bd0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0319419 - Browse repository at this point
Copy the full SHA 0319419View commit details -
Add action client/server entities to wait set
They still aren't handled in the .wait() method, though.
Configuration menu - View commit details
-
Copy full SHA for b6c8b47 - Browse repository at this point
Copy the full SHA b6c8b47View commit details -
Handle action server/client readiness in WaitSet and executor
Currently, action servers and clients that are ready in multiple ways are returned to the executor as a list of pairs, with one readiness mode per entry. This could alternatively be encoded as a bitfield or similar struct, with any given client/server only occurring once in the list. However, to ensure that the executor has control over execution order, we would need to expose individual `execute_readiness_mode()` methods from the client and server, rather than a unified `execute(Mode)` method. That's fine too, but something to keep in mind.
Configuration menu - View commit details
-
Copy full SHA for 2fbd496 - Browse repository at this point
Copy the full SHA 2fbd496View commit details -
There's one error code, ActionNameInvalid, that conflicts with the EventInvalid code. We should consult with upstream about this, as it causes issues for representing error codes as enum values. These two error codes are probably never returned by the same function, but it would be better to keep them unique.
Configuration menu - View commit details
-
Copy full SHA for d5fc2f3 - Browse repository at this point
Copy the full SHA d5fc2f3View commit details -
Add ActionImpl trait with internal messages and services
This is incomplete, since the service types aren't yet being generated.
Configuration menu - View commit details
-
Copy full SHA for e72d1c9 - Browse repository at this point
Copy the full SHA e72d1c9View commit details -
[WIP] Start defining server/client execute functions
This is just the basic layout. I'm trying to avoid defining the `take_*` functions that rclcpp has to link taking messages to executing on them. I'm not sure if that's actually worthwhile yet. This area should also be revisited once it's functional to see whether portions can be moved into the non-polymorphic subfunctions. Doing so could reduce compile times by avoiding excessive monomorphization.
Configuration menu - View commit details
-
Copy full SHA for 02dcc7a - Browse repository at this point
Copy the full SHA 02dcc7aView commit details -
Split srv.rs.em into idiomatic and rmw template files
This results in the exact same file being produced for services, except for some whitespace changes. However, it enables actions to invoke the respective service template for its generation, similar to how the it works for services and their underlying messages.
Configuration menu - View commit details
-
Copy full SHA for edebb76 - Browse repository at this point
Copy the full SHA edebb76View commit details -
Configuration menu - View commit details
-
Copy full SHA for c9a28f7 - Browse repository at this point
Copy the full SHA c9a28f7View commit details -
Add runtime trait to get the UUID from a goal request
C++ uses duck typing for this, knowing that for any `Action`, the type `Action::Impl::SendGoalService::Request` will always have a `goal_id` field of type `unique_identifier_msgs::msg::UUID` without having to prove this to the compiler. Rust's generics are more strict, requiring that this be proven using type bounds. The `Request` type is also action-specific as it contains a `goal` field containing the `Goal` message type of the action. We therefore cannot enforce that all `Request`s are a specific type in `rclrs`. This seems most easily represented using associated type bounds on the `SendGoalService` associated type within `ActionImpl`. To avoid introducing to `rosidl_runtime_rs` a circular dependency on message packages like `unique_identifier_msgs`, the `ExtractUuid` trait only operates on a byte array rather than a more nicely typed `UUID` message type. I'll likely revisit this as we introduce more similar bounds on the generated types.
Configuration menu - View commit details
-
Copy full SHA for dc8781c - Browse repository at this point
Copy the full SHA dc8781cView commit details -
Use rcl-allocated goal handle pointer in ServerGoalHandle
The `rcl_action_accept_new_goal()` function returns a pre-allocated `rcl_action_goal_handle_t` pointer, which is also stored within the action server proper. This means we cannot store a non-pointer version of this in the `ServerGoalHandle`. Instead, we'll keep a mutex-guarded mutable pointer. The `Arc` is unnecessary since this pointer is never shared with anyone. Also, we need to clean up the goal handle by calling `rcl_action_goal_handle_fini()` when the `ServerGoalHandle` is dropped.
Configuration menu - View commit details
-
Copy full SHA for 9d6a8b8 - Browse repository at this point
Copy the full SHA 9d6a8b8View commit details -
Split execute_goal_request() out into three functions
The logic in `execute_goal_request()` was starting to get unwieldy, so I split it into three functions. The idea is that the first, `take_goal_request()`, should handle everything up until we call the user's callback. Meanwhile, `send_goal_response()` handles everything after the user callback, sending the response and, if accepted, setting everything up for the action server. `execute_goal_request()` is the overall function coordinating all of this. It passes request data from the `take*` function to the user callback and passes the returned response into the `send*` function. In addition to splitting the logic into digestible pieces, this means we could also easily make the goal-request callback asynchronous by delaying the `send*` function until the user has given their asynchronous response.
Configuration menu - View commit details
-
Copy full SHA for 5425072 - Browse repository at this point
Copy the full SHA 5425072View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9595b6e - Browse repository at this point
Copy the full SHA 9595b6eView commit details -
Add DropGuard convenience wrapper
This provides a convenient RAII-style way to ensure that a function is always called when a specific value gets dropped.
Configuration menu - View commit details
-
Copy full SHA for 5496b10 - Browse repository at this point
Copy the full SHA 5496b10View commit details -
Complete implementation of ActionServer::publish_status()
This skips some of the steps that rclcpp performs, as they appear to be unnecessary. Testing should reveal whether that's true or not.
Configuration menu - View commit details
-
Copy full SHA for 46e7093 - Browse repository at this point
Copy the full SHA 46e7093View commit details -
Move goal acceptance logic back into execute_goal_request()
This trims the send_goal_response() function down to only be a wrapper around the rcl_action equivalent. In addition to improving logical separation, this also simplifies control flow when handling rejection.
Configuration menu - View commit details
-
Copy full SHA for b15c0c5 - Browse repository at this point
Copy the full SHA b15c0c5View commit details -
Integrate RMW message methods into ActionImpl
Rather than having a bunch of standalone traits implementing various message functions like `ExtractUuid` and `SetAccepted`, with the trait bounds on each associated type in `ActionImpl`, we'll instead add these functions directly to the `ActionImpl` trait. This is simpler on both the rosidl_runtime_rs and the rclrs side.
Configuration menu - View commit details
-
Copy full SHA for f8fedbc - Browse repository at this point
Copy the full SHA f8fedbcView commit details -
Add UUID->GoalHandle hash-map to action server
This requires a mutex to enable simultaneous goal acceptance in a multithreaded executor. We also make ServerGoalHandles implement Send and Sync, since they will be accessed by multiple threads during callbacks. Due to containing a raw pointer field, the type doesn't automatically implement Send/Sync; however, we guarantee that the uses of this pointer is safe and synchronized, allowing us to safely implement the traits.
Configuration menu - View commit details
-
Copy full SHA for 241f642 - Browse repository at this point
Copy the full SHA 241f642View commit details -
Add rosidl_runtime_rs::ActionImpl::create_feedback_message()
Adds a trait method to create a feedback message given the goal ID and the user-facing feedback message type. Depending on how many times we do this, it may end up valuable to define a GoalUuid type in rosidl_runtime_rs itself. We wouldn't be able to utilize the `RCL_ACTION_UUID_SIZE` constant imported from `rcl_action`, but this is pretty much guaranteed to be 16 forever. Defining this method signature also required inverting the super-trait relationship between Action and ActionImpl. Now ActionImpl is the sub-trait as this gives it access to all of Action's associated types. Action doesn't need to care about anything from ActionImpl (hopefully).
Configuration menu - View commit details
-
Copy full SHA for 1e75ce8 - Browse repository at this point
Copy the full SHA 1e75ce8View commit details -
Add ActionServer::publish_feedback() method
This still needs to be hooked up to the ActionServerGoalHandle, though.
Configuration menu - View commit details
-
Copy full SHA for ea04dcb - Browse repository at this point
Copy the full SHA ea04dcbView commit details -
Configuration menu - View commit details
-
Copy full SHA for b06c14c - Browse repository at this point
Copy the full SHA b06c14cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 249d5ec - Browse repository at this point
Copy the full SHA 249d5ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 213f891 - Browse repository at this point
Copy the full SHA 213f891View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7c45fc - Browse repository at this point
Copy the full SHA a7c45fcView commit details -
Implement ActionImpl trait methods in generator
These still don't build without errors, but it's close.
Configuration menu - View commit details
-
Copy full SHA for a33ec48 - Browse repository at this point
Copy the full SHA a33ec48View commit details -
Configuration menu - View commit details
-
Copy full SHA for e98882f - Browse repository at this point
Copy the full SHA e98882fView commit details -
Hook up ServerGoalHandle callbacks into the ActionServer
These aren't actually implemented as callbacks like in rclcpp, but rather just regular method calls. This required making some of the ActionServer and ActionServerBase methods use an Arc receiver, but the ActionServer is only ever created within an Arc, so this is fine.
Configuration menu - View commit details
-
Copy full SHA for 4ff9fd4 - Browse repository at this point
Copy the full SHA 4ff9fd4View commit details -
Replace set_result_response_status with create_result_response
rclrs needs to be able to generically construct result responses, including the user-defined result field.
Configuration menu - View commit details
-
Copy full SHA for d8a0a1d - Browse repository at this point
Copy the full SHA d8a0a1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d597c8 - Browse repository at this point
Copy the full SHA 4d597c8View commit details -
Hook up goal termination methods for goal handles
These now call into the action server to send a response to prior (queued) and future goal result requests. There are still some synchronization tweaks needed for this to be correct.
Configuration menu - View commit details
-
Copy full SHA for be5b7e1 - Browse repository at this point
Copy the full SHA be5b7e1View commit details -
Implement client-side trait methods for action messages
This adds methods to ActionImpl for creating and accessing action-specific message types. These are needed by the rclrs ActionClient to generically read and write RMW messages. Due to issues with qualified paths in certain places (rust-lang/rust#86935), the generator now refers directly to its service and message types rather than going through associated types of the various traits. This also makes the generated code a little easier to read, with the trait method signatures from rosidl_runtime_rs still enforcing type-safety.
Configuration menu - View commit details
-
Copy full SHA for 75fd275 - Browse repository at this point
Copy the full SHA 75fd275View commit details