Skip to content
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

Populate Transitions in Transition Events #1140

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from

Conversation

CursedRock17
Copy link
Contributor

Meant to resolve #1019 this PR adds the timestamp and transition portion of a TransitionEvent to the rcl_lifecycle_com_interface_publish_notification function

Unfortunately, it looks like in order to do this we will have to break the ABI with either changes or additions to that function's parameters.

Signed-off-by: CursedRock17 <[email protected]>
@CursedRock17 CursedRock17 changed the title Populate Transitions Populate Transitions in Transition Events Mar 26, 2024
@CursedRock17 CursedRock17 marked this pull request as draft March 27, 2024 00:50
Signed-off-by: CursedRock17 <[email protected]>
@CursedRock17 CursedRock17 marked this pull request as ready for review March 28, 2024 01:17
const rcl_lifecycle_state_t * start, const rcl_lifecycle_state_t * goal)
{
// Get the current system time based on the rcl_clock
rcutils_time_point_value_t current_time;
rcutils_ret_t time_ret = rcutils_system_time_now(&current_time);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clock works, but will the result of rcutils_system_time_now serve as the correct time? The transition timestamp is meant to be

The time point at which this event occurred.

Which needs to be set during the period of notification. I can't image trying to pass down a clock through multiple layers of API so that the user could set the time that way though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will publish the system time only, but i think LifecycleNode.clock_interface should be used. more like, rck_lifecycle_com_interface should be initialized with the same clock with lifecycle node. so that if the node is configured with simulation time, we can also publish the simulation time in the message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely agree that this would be the best route to go, but will it be problematic making API changes? As the rcl_lifecycle_com_interface is changed that means all functions initializing com_interface must be changed to include a rcl_clock_t * argument. This would include adding an argument to rcl_lifecycle_state_machine_init and all the functions it calls down the line.

Comment on lines +82 to 83
const char * transition_label, uint8_t transition_id,
const rcl_lifecycle_state_t * start, const rcl_lifecycle_state_t * goal);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a curiosity, does that make more sense if that takes const rcl_lifecycle_transition_t * transition which includes everything but com_interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would, but originally I just wanted more transparency with what I was adding, that'll be fixed.

const rcl_lifecycle_state_t * start, const rcl_lifecycle_state_t * goal)
{
// Get the current system time based on the rcl_clock
rcutils_time_point_value_t current_time;
rcutils_ret_t time_ret = rcutils_system_time_now(&current_time);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will publish the system time only, but i think LifecycleNode.clock_interface should be used. more like, rck_lifecycle_com_interface should be initialized with the same clock with lifecycle node. so that if the node is configured with simulation time, we can also publish the simulation time in the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transition events don't populate transition id, label, or timestamp
2 participants