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

Example real-time concurreny timer and subscription #329

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

JanStaschulat
Copy link
Contributor

@JanStaschulat JanStaschulat commented Feb 7, 2023

See discussion in Slack https://micro-ros.slack.com/archives/CNC141G0N/p1675765402361599

The execution time of the subscription alternates (1ms, 900ms). It receives data every 1000ms. A slow timer with 100ms timeout is also defined. You can see from the results, that the timer events, while the subscription callback consumes 900ms, are lost and that there is no queue of timer events. That is, the there is no catch-up when there would be sufficient time when the subscription callback only needs 1ms.

Sample output:

$:~/github_ros_ws$ ros2 run rclc_examples example_short_timer_long_subscription 

[INFO] [1675775675.196181864] []: Created a timer with period 1000 ms.
Created timer with timeout 1000 ms.
[INFO] [1675775675.196259744] []: Created a timer with period 100 ms.
Created timer with timeout 100 ms.
Created subscriber topic_0:
Debug: number of DDS handles: 3

shorttimer 0
shorttimer 1
shorttimer 2
shorttimer 3
shorttimer 4
shorttimer 5
shorttimer 6
shorttimer 7
shorttimer 8
shorttimer 9
Callback: I heard: 1
shorttimer 10
shorttimer 11
Callback: I heard: 2
shorttimer 12
shorttimer 13
shorttimer 14
shorttimer 15
shorttimer 16
shorttimer 17
shorttimer 18
shorttimer 19
shorttimer 20
shorttimer 21
Callback: I heard: 3
shorttimer 22
shorttimer 23
Callback: I heard: 4

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
@codecov-commenter
Copy link

Codecov Report

Merging #329 (c5f85a6) into master (1d31f43) will decrease coverage by 0.15%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #329      +/-   ##
==========================================
- Coverage   69.20%   69.06%   -0.15%     
==========================================
  Files          16       16              
  Lines        2715     2715              
  Branches      765      765              
==========================================
- Hits         1879     1875       -4     
- Misses        450      452       +2     
- Partials      386      388       +2     
Impacted Files Coverage Δ
rclc/src/rclc/action_goal_handle.c 58.59% <0.00%> (-2.55%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@JanStaschulat
Copy link
Contributor Author

@mergify backport humble foxy

@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2023

backport humble foxy

✅ Backports have been created

@JanStaschulat JanStaschulat merged commit fd648d9 into master Feb 7, 2023
@JanStaschulat JanStaschulat deleted the feature/example_short_timer_long_subscription branch February 7, 2023 16:30
mergify bot pushed a commit that referenced this pull request Feb 7, 2023
* initial example short timer long subscription duration

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* added delay in subscription

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* updated README

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

---------

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
(cherry picked from commit fd648d9)
mergify bot pushed a commit that referenced this pull request Feb 7, 2023
* initial example short timer long subscription duration

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* added delay in subscription

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* updated README

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

---------

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
(cherry picked from commit fd648d9)

# Conflicts:
#	rclc_examples/CMakeLists.txt
JanStaschulat added a commit that referenced this pull request Feb 7, 2023
* initial example short timer long subscription duration

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* added delay in subscription

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* updated README

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

---------

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
(cherry picked from commit fd648d9)

Co-authored-by: Jan Staschulat <jan.staschulat@de.bosch.com>
JanStaschulat added a commit that referenced this pull request Feb 8, 2023
…331)

* Example real-time concurreny timer and subscription (#329)

* initial example short timer long subscription duration

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* added delay in subscription

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

* updated README

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

---------

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
(cherry picked from commit fd648d9)

# Conflicts:
#	rclc_examples/CMakeLists.txt

* resolved merge conflict

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>

---------

Signed-off-by: Jan Staschulat <jan.staschulat@de.bosch.com>
Co-authored-by: Jan Staschulat <jan.staschulat@de.bosch.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.

None yet

3 participants