Skip to content

Modifies timers API to select autostart state#1004

Merged
clalancette merged 10 commits intoros2:rollingfrom
Voldivh:voldivh/autostart
Jun 21, 2023
Merged

Modifies timers API to select autostart state#1004
clalancette merged 10 commits intoros2:rollingfrom
Voldivh:voldivh/autostart

Conversation

@Voldivh
Copy link
Contributor

@Voldivh Voldivh commented Aug 26, 2022

Signed-off-by: Voldivh eloyabmfcv@gmail.com

Part of ros2/rclcpp#1980

Basically it gives the timer initialization a variable that enables or disables the autostart on initialization. The variable autostart is defaulted to True in order to avoid any breaks in current use of the API.

Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
@Voldivh Voldivh marked this pull request as draft August 26, 2022 13:31
@Voldivh Voldivh marked this pull request as ready for review August 26, 2022 14:53
Copy link
Contributor

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

Two thoughts:

  • We should add a backwards compatible function.
  • We should make sure that there's new test coverage of the autostart = false path in the timer unit tests.

Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
@Voldivh Voldivh requested a review from clalancette August 31, 2022 17:57
Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

although this is an easy way to support autostart capability for timer, i was expecting we were going to extend the capability like start and stop for the timer. and then autostart can rely on those capabilities?

i was thinking that,

  • with current implementation including ros2/rclcpp#2005
    • creating already canceled timer and start the timer with reset is kinda weird?
  • having start and stop capabilities for the timer.
    • cannot start / stop the canceled timer.
    • canceled timer can be reset only.
    • next_call_time should be calculated and managed internally. (for example, period is 30s timer. after 15s, it can call stop, then left time should be kept. if it starts the timer, 1st period will be 15s and after that 30s period. this is the difference from reset.)
    • autostart flag can call start API internally. in this case, we would add rcl_timer_start/stop APIs as extension, probably avoid to add rcl_timer_init2 to keep the backward compatibility?

There could have been discussion something like this, but i would like to have feedback.

thanks,

@fujitatomoya
Copy link
Collaborator

CC: @ivanpauno @wjwwood

@ivanpauno
Copy link
Member

having start and stop capabilities for the timer.

How would they work exactly?
Those sound like reset and cancel to me, only with different names.
The period of the timer can also be modified.
With that and the possibility of starting a timer "stopped" as this PR is adding, all the start/stop capabilities that I can imagine of a timer are supported.

@ivanpauno
Copy link
Member

for example, period is 30s timer. after 15s, it can call stop, then left time should be kept. if it starts the timer, 1st period will be 15s and after that 30s period. this is the difference from reset.

Ah sorry, you already explained my question.
I think that adding support for that is fine, but I don't think it's related to the functionality added here.
Naming of the new function(s) to achieve that is going to be confusing though ...

@Voldivh
Copy link
Contributor Author

Voldivh commented Sep 26, 2022

Taking into account the proposal of extending the capabilities of timers and some concerns on this PR regarding the use of the reset method. I wanted to show a simple flowchart on how this autostart feature is working at the moment.
image
Basically I'm giving a choice and using current 'states' of the timer to achieve the feature. I do think that in order to start a timer you have to reset it, sounds weird (semantically). However, my concern is that implementing a start() method would imply to basically code the same reset() method or call that method inside a new one (I'm not sure on what would be preferred on this case). Keeping that in mind and assuming we are going to add that start() method, we could differentiate it from the reset function by extending it in order to do the following:
image
That gives the possibility to reset the timer without it being autostarted and the start method is just a way to "uncancel" the timer so it goes to an ongoing state. Let me know what you guys think about this @fujitatomoya @ivanpauno

@Voldivh Voldivh requested review from fujitatomoya and removed request for clalancette October 11, 2022 14:10
@fujitatomoya
Copy link
Collaborator

I believe that the latter one makes more sense. (related to ros2/rclcpp#2006 (comment), adding start / stop would be useful to support these features.)

@ros2/team friendly ping.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

overall lgtm, sorry to be late to get back to this.

@Voldivh are you still working on this? there are conflicts what needs to be addressed.

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 6, 2023

overall lgtm, sorry to be late to get back to this.

@Voldivh are you still working on this? there are conflicts what needs to be addressed.

Hey @fujitatomoya I stopped working on this some time ago. However, I believe it only requires a little final push to get this and the follow up PR's in. I believe I can get back on this later this week. Give me a couple of days to recall the implementation I was doing and solve the conflicts we currently have.

@fujitatomoya
Copy link
Collaborator

@Voldivh thanks for taking care of this, there is build failure https://build.ros2.org/job/Rpr__rcl__ubuntu_jammy_amd64/350/console

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 8, 2023

@Voldivh thanks for taking care of this, there is build failure https://build.ros2.org/job/Rpr__rcl__ubuntu_jammy_amd64/350/console

Yeah I noticed, however, I believe the error is coming from this commit made into rolling. I'm not sure if I should modify something here.

@fujitatomoya
Copy link
Collaborator

@christophebedard Rpr job is supposed to fail because of c43c7ab?

@christophebedard
Copy link
Member

Yeah, it will fail until tracetools is released and available in the testing repo.

@fujitatomoya
Copy link
Collaborator

@Voldivh never mind the rpr job failure, i wll start the CI to verify.

@fujitatomoya
Copy link
Collaborator

fujitatomoya commented Jun 8, 2023

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 13, 2023

Hey @fujitatomoya, I believe the CI build failed because of the branch for ros2/system_tests#508 was outdated. I already sync it with the latest changes from rolling, I think it should fix it.

@fujitatomoya
Copy link
Collaborator

@Voldivh thanks for checking!

CI: 🤞

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 13, 2023

@fujitatomoya well that didn't do the trick :c. I'm not sure on what to do next, this is the error we are getting https://ci.ros2.org/job/ci_linux/18944/console#:~:text=12%3A18%3A46%20%3D%3D%3E,with%20return%20code%20%271%27

@clalancette
Copy link
Contributor

@fujitatomoya well that didn't do the trick :c. I'm not sure on what to do next, this is the error we are getting https://ci.ros2.org/job/ci_linux/18944/console#:~:text=12%3A18%3A46%20%3D%3D%3E,with%20return%20code%20%271%27

There's no package called system_tests, it is called test_rclcpp.

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 13, 2023

There's no package called system_tests, it is called test_rclcpp.

That makes a lot of sense, is that something that is defined when running the CI or do I have to modify something?

@fujitatomoya
Copy link
Collaborator

@Voldivh @clalancette Ah, sorry 😓 i will restart the CI.

@fujitatomoya
Copy link
Collaborator

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@fujitatomoya
Copy link
Collaborator

@Voldivh i think we need to rebase rclcpp, please check https://ci.ros2.org/job/ci_linux/18949/console.

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 14, 2023

@Voldivh i think we need to rebase rclcpp, please check https://ci.ros2.org/job/ci_linux/18949/console.

I agree, it should be fine now after this commit.

@emersonknapp
Copy link
Collaborator

Pulls: #1004, ros2/rclcpp#2005, ros2/system_tests#508, ros2/rclpy#999
Gist: https://gist.githubusercontent.com/emersonknapp/f9353e435d78a1ff796a38b74eaf0547/raw/2a9e6c7645332dcc2c4a6d0fb6f7b66e6b428bb7/ros2.repos
BUILD args: --packages-above-and-dependencies rcl rcl_action rclcpp rclpy test_rclcpp
TEST args: --packages-above rcl rcl_action rclcpp rclpy test_rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/12240

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@Voldivh
Copy link
Contributor Author

Voldivh commented Jun 15, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

I think we had the same issue as before but now with rclpy. I already updated the branch. All branches from the different PR's should be up to date now with the latest updates of rolling.

@emersonknapp
Copy link
Collaborator

Rebuilds build #12240
Running as SYSTEM
Building on the built-in node in workspace /var/lib/jenkins/jobs/ci_launcher/workspace

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@fujitatomoya
Copy link
Collaborator

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I've left three small things to fix.

@fujitatomoya
Copy link
Collaborator

Final? CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
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.

7 participants