Commit Graph

308 Commits

Author SHA1 Message Date
Martin Škoudlil c23e2eb1f6 Add panic to sim time examples 2024-03-22 18:38:51 +01:00
Martin Dahl 0fd206ca4f Replace feature with cfg based on whether clock message is compiled 2024-03-22 10:40:15 +01:00
Martin Škoudlil 62897e2afe Add examples showing usage of sim time 2024-03-20 17:39:33 +01:00
Martin Škoudlil 951db6caae Add methods to access TimeSource and shared ROS clock 2024-03-20 17:39:33 +01:00
Martin Škoudlil 0b86dda116 Enable simulated time when the node is started with use_sim_time parameter
add `--ros-args -p use_sim_time:=true` to starting command line
2024-03-20 17:39:32 +01:00
Martin Škoudlil af27aa07fc Initialize TimeSource in node 2024-03-20 17:39:32 +01:00
Martin Škoudlil fd04760aeb Add time_source module to manage RosTime clocks
The TimeSource subscribes to /clock topic and publishes the time to all
attached clocks (by default only clock used by create_timer is attached).

This module is feature gated because the clock is published in message
rosgraph_msgs::msg::Clock and rosgraph_msgs needs to be specified as
dependency by the end users.
2024-03-20 17:39:32 +01:00
Martin Škoudlil 1acaadd34d Prepare clock to support simulated time
Added feature flag sim-time because functions that are feature gated does
not make sense without TimeSource that is implemented in later commit
and needs the feature flag.
2024-03-20 17:39:31 +01:00
Martin Škoudlil 66af3f49c9 Allow creating timers of type ClockType::RosTime
This adds Node::create_timer() method. The method is similar to
already existing Node::create_wall_timer(), but the timer is based on
ClockType::RosTime rather than on ClockType::SteadyTime.

The advantage of ClockType::RosTime is that one can drive the clock
from a different time source. This will be used in the next commits to
implement for clock source on the /clock topic.
2024-03-20 13:27:09 +01:00
Martin Škoudlil 04c24bf47b Changed Timer_ to not require clock ownership
This allows to implement timers that can share single clock among them.

This commit is preparation for feature sim time.
2024-03-20 13:27:09 +01:00
Martin Škoudlil db7aa0b6fd Pin timer_handle to avoid SIGSEGV in _rcl_timer_time_jump() callback
This commit is preparation for next commit with timer using RosTime clock.

In the previous implementation the function rcl_timer_init is called
with zero initialized timer handle being stored on stack and after
initialization with rcl_timer_init the timer handle is moved by rust
inside Timer_ struct.

The problem occurs if the type of clock being passed to rcl_timer_init()
is RosTime because the function also registers callbacks in the clock
that would notify the timer about sudden time change (jump callback).
In RCL the jump callback is registered with rcl_clock_add_jump_callback()
and the argument callback.user_data is pointer to timer handle that in
our case references timer stored om stack. When returning from function
create_wall_timer() the pointer becomes dangling and therefore when the
callback is actually called (by function _rcl_timer_time_jump) it could
result in SIGSEGV or could access some variable that happens to be in
the same place as the timer_handle was on stack.

This is fixed by storing timer_handle inside pinned box to prevent
moving the handle.
2024-03-20 13:27:09 +01:00
Martin Dahl 03c873c22d Release 0.8.4 2024-03-19 13:30:06 +01:00
Martin Dahl 2052ee2afd wait a bit for publisher info in test. 2024-03-19 12:11:47 +01:00
Földi Tamás 285853a1e5 chore: use BEST_AVAILABLE QoS in rolling 2024-03-19 11:54:19 +01:00
Martin Dahl 8a1444d8f6 Update readme. 2024-02-09 15:39:27 +01:00
Martin Dahl 8bd4e0b5e0 Add ros2 iron 2024-02-09 14:53:18 +01:00
Martin Dahl 3ae831acb3 Release 0.8.3 2024-01-14 10:48:21 +01:00
Martin Dahl fe5066fa44 Update readme. 2024-01-11 21:07:45 +01:00
Martin Dahl fe258169dd cargo fmt 2024-01-11 21:03:41 +01:00
NerdToMars b3e4a58eca
add get_publishers_info_by_topic (#80)
* add get_publishers_info_by_topic
2024-01-11 20:55:33 +01:00
Michael Hoy cb87b9c01c
Add raw publisher, convert Context to singleton (#76)
* Add raw publisher

* Add raw publisher examples

* Add more tests. Convert Context into singleton to avoid memory corruption when creatin multiple Context instances
2024-01-07 11:46:59 +01:00
Michael Hoy 3d6936e70a
Add rcl_publisher_get_subscription_count related methods (#75)
* Add rcl_publisher_get_subscription_count related methods

* Update implementation of publisher to handle wait_for_inter_process_subscribers
2023-12-27 23:14:09 +01:00
Martin Dahl d5f2ef0eac `from_serialized_bytes` for WrappedNativeMsgUntyped 2023-12-19 20:41:50 +01:00
Martin Dahl 3518ac9215 Update readme, `tokio_raw_subscriber` example, cargo fmt. 2023-12-18 08:38:34 +01:00
Martin Dahl 3b42626dcb
Merge pull request #74 from mchhoy/message_serialization_helpers
Message serialization helpers
2023-12-14 09:17:18 +01:00
Martin Dahl fb08e1f94b Add deserialization benchmark. 2023-12-13 17:05:12 +01:00
Michael Hoy eb1f461943 Add missing descructors 2023-12-13 22:59:16 +08:00
Michael Hoy f5ba556e2e Move location of from_rcl_error to avoid the need for r2r::Error to be Clone 2023-12-13 22:51:57 +08:00
Michael Hoy 2e17b8ed40 Add comment 2023-12-13 22:44:45 +08:00
Michael Hoy d9cab1058e Merge branch 'master' of github.com:mchhoy/r2r into message_serialization_helpers 2023-12-13 22:42:31 +08:00
Michael Hoy 8b627fa53b Add functions to_serialized_bytes and from_serialized_bytes 2023-12-13 22:42:22 +08:00
Martin Dahl 7b6c8009c4 Update readme. 2023-12-13 14:54:45 +01:00
Martin Dahl 39b9f59fe7 Fix elided_lifetimes_in_associated_constant compiler warning.
Will become an error in a future rust release. https://github.com/rust-lang/rust/issues/115010
2023-12-13 14:52:32 +01:00
Martin Dahl e81f706abe Break out raw subscription test to own file and remove panics. 2023-12-13 12:44:17 +01:00
Martin Dahl 4c38bce214 Reuse the msg buffer to reduce allocations. Added example. cargo fmt 2023-12-13 11:27:52 +01:00
Michael Hoy 21a6551d81 Added raw message subscriber 2023-12-13 11:28:25 +08:00
Martin Dahl 6bc1f5f27b Release 0.8.2 2023-12-11 15:29:35 +01:00
Martin Dahl 01c5d4b626 Prepare for release 2023-12-11 15:25:30 +01:00
Martin Dahl 4e546cda63
Merge pull request #71 from alecrivers/fix-include-directories
Fix include directory parsing on Linux in some cases
2023-12-10 20:36:39 +01:00
Alec Rivers 9664d920ad Fix include directory parsing on Linux in some cases 2023-12-09 22:07:25 -08:00
Martin Dahl 50b5f9da27 Fix ROS expired keys for foxy and galactic images. 2023-12-05 10:38:23 +01:00
Martin Dahl be617d1a16 Add github action for building r2r_minimal_node with colcon. 2023-12-05 09:57:43 +01:00
Martin Dahl 27cc6450cd Fix bug in r2r_cargo 2023-12-05 09:46:44 +01:00
Martin Dahl b685b30af1 Update changelog + version numbers in readme and cmake file. 2023-11-30 14:28:24 +01:00
Martin Dahl 2316022f02 Release 0.8.1 2023-11-30 13:00:43 +01:00
Martin Dahl 7fc96e3eb2 Revert cmake include dirs behaviour 2023-11-30 12:38:49 +01:00
Martin Dahl 4d9da2b7a7 Release 0.8.0 2023-10-05 11:44:22 +02:00
Martin Dahl 6d144337e5 Disable bindgen layout tests 2023-10-05 11:32:59 +02:00
Martin Dahl ae20d3c33b Re-export RosParams macro. 2023-10-05 11:30:54 +02:00
Martin Dahl f2c8a67c0c Prepare for release 0.8.0 2023-10-05 10:51:38 +02:00