Repository navigation
Conversation
Adds C# Action client and server classes that work with the patched ROS-TCP-Endpoint (comoc/ROS-TCP-Endpoint, main-ros2 branch) to bridge ROS2 Actions through the TCP connection. SysCommand.cs: - 6 new command constants (__action_client, __action_send_goal, __action_get_result, __action_cancel_goal, __action_server, __action_publish_feedback) - 3 new param structs (SysCommand_ActionRegistration, SysCommand_ActionGoalOp, SysCommand_ActionFeedback) ROSActionClient.cs: - ROSActionClient<TGoal, TResult, TFeedback> with async SendGoal() returning ActionGoalHandle - ActionGoalHandle with async GetResult(), Cancel(), and FeedbackReceived event - RegisterFeedbackSubscription<TFeedbackMessage>() for wiring up goal-specific feedback routing via SubscribeByMessageName - GetResultRequestProxy and CancelGoalRequestProxy internal messages - Handles the endpoint's UUID-prepend convention on SendGoal response - Skips int8 status + alignment padding in GetResult response ROSActionServer.cs: - ROSActionServer<TGoal, TResult, TFeedback> with GoalReceived event - ActionServerGoalHandle with PublishFeedback() and SetResult() - Goal routing via __request/__response reusing existing service infrastructure ROSConnection.cs: - AllocateServiceRequest() internal helper for thread-safe srv_id allocation without exposing private fields - QueueRawMessage() internal helper for sending data frames without triggering Publish()'s publisher-registration check - CreateActionClient<>() and CreateActionServer<>() factory methods - TryRouteToActionServer() for __request dispatch to action servers - Action server routing integrated into ReceiveSysCommand's m_SpecialIncomingMessageHandler - FindObjectOfType -> FindAnyObjectByType (deprecation fix) Hand-written Fibonacci message classes for testing: - FibonacciGoal, FibonacciResult, FibonacciFeedback, FibonacciFeedbackMessage (with dual MessageRegistry registration for short and /action/ type name variants) Verified end-to-end: - Action client: Unity -> ROS2 fibonacci_action_server, all 9 feedback messages + result [0,1,1,2,3,5,8,13,21,34,55] - Action server: ros2 action send_goal -> Unity, 4 feedback messages + result [0,1,1,2,3,5] with SUCCEEDED status - Reconnect after endpoint restart works correctly
Add ROS2 Action client and server support
ActionAutoGen now generates a ROS2-style FeedbackMessage class alongside the existing Goal/Result/Feedback classes. The generated class contains: - byte[16] goal_id (UUID for goal routing) - Feedback body (the user-defined Feedback type) - Dual MessageRegistry registration for both the short type name (pkg/Action_FeedbackMessage) and the /action/ variant that __topic_list reports This eliminates the need to hand-write FeedbackMessage classes for each Action type. The class is required by ROSActionClient.RegisterFeedbackSubscription to route feedback to the correct ActionGoalHandle.
|
|
There was a problem hiding this comment.
Pull request overview
Adds ROS2 Action support to the Unity ROS-TCP-Connector by introducing C# action client/server APIs, integrating action routing into ROSConnection, and extending .action code generation to emit ROS2-style *_FeedbackMessage types.
Changes:
- Add
ROSActionClient/ROSActionServerAPIs and integrate action syscommands + routing intoROSConnection. - Add new SysCommand constants/param structs required for action registration and operations.
- Extend
.actioncodegen to generate ROS2FeedbackMessageclasses (UUID + Feedback) with dual type-name registration.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/SysCommand.cs | Adds action-related syscommand constants and payload structs. |
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/ROSConnection.cs | Adds action factories, raw-frame queueing, service-id allocation helper, and action server routing hook; updates deprecated Unity API usage. |
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/ROSActionServer.cs.meta | Unity asset metadata for new action server file. |
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/ROSActionServer.cs | New Unity-side ROS2 action server implementation and goal handle. |
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/ROSActionClient.cs.meta | Unity asset metadata for new action client file. |
| com.unity.robotics.ros-tcp-connector/Runtime/TcpConnector/ROSActionClient.cs | New Unity-side ROS2 action client and goal handle APIs. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciResult.cs.meta | Unity asset metadata for generated message. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciResult.cs | Generated action Result message type. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciGoal.cs.meta | Unity asset metadata for generated message. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciGoal.cs | Generated action Goal message type. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciFeedbackMessage.cs.meta | Unity asset metadata for generated message. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciFeedbackMessage.cs | Generated ROS2 wire-level FeedbackMessage (UUID + Feedback) with dual registration. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciFeedback.cs.meta | Unity asset metadata for generated message. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action/FibonacciFeedback.cs | Generated action Feedback message type. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces/action.meta | Unity folder metadata for generated action message folder. |
| com.unity.robotics.ros-tcp-connector/Runtime/Messages/ActionTutorialsInterfaces.meta | Unity folder metadata for generated message package folder. |
| com.unity.robotics.ros-tcp-connector/Editor/MessageGeneration/ActionAutoGen.cs | Extends .action generation to emit ROS2 FeedbackMessage classes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ROSActionServer: catch goal deserialization/handler exceptions and reply with an empty result when GoalReceived has no subscriber, so the ROS 2 action client is not left hanging - ROSActionServer: remove completed goals from m_ActiveGoals on SetResult - ROSConnection: route goal requests via an internal interface instead of reflection (also safe under IL2CPP stripping) - ROSConnection: use a dedicated MessageSerializer in QueueRawMessage - ROSActionClient: drop goal handles after GetResult / successful Cancel - ActionAutoGen: include FeedbackMessage.cs in GetActionClassPaths Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change(s)
Add ROS2 Action support: C# client/server classes, ROSConnection integration, and .action file code generation. Works with a patched ROS-TCP-Endpoint (PR #178).
New classes
ROSConnection integration
.action code generation
SysCommand additions
6 new constants + 3 param structs for __action_client, __action_send_goal, __action_get_result, __action_cancel_goal, __action_server, __action_publish_feedback
Useful links
Types of change(s)
Testing and Verification
Test Configuration:
Checklist
Notes
Requires companion endpoint changes in PR #178. Fully backwards-compatible — existing functionality unaffected. Wiki documentation available at https://github.com/comoc/ROS-TCP-Connector/wiki