Commit Graph

346 Commits

Author SHA1 Message Date
Martin Dahl 455ea630ec Release 0.9.5 2025-04-22 10:27:18 +02:00
Martin Dahl aa180c5b15
Add `/set_parameters_atomically` (#120, #121)
* Fixed failing `ros2 param ...` on r2r nodes for Jazzy (#120)

Add `/set_parameters_atomically` service to `make_parameter_handler_internal` in `nodes.rs` to fix failing `ros2 param ...` on r2r nodes for Jazzy.

* Atomic behavior for `set_parameters_atomically` (#121).

---------

Co-authored-by: Desmond Germans <desmond@germansmedia.nl>
2025-04-22 10:20:32 +02:00
Benjamin Bjerken 56acba5dd5 Update bindgen 0.63.0 -> 0.71.1 (#116)
This fixes #116 by now generating the missing primitive sequence functions.
Tested to be working on Ubuntu 22.04 with ROS2 Humble and Iron.
2025-04-17 09:54:48 +02:00
Martin Dahl ad25b72e76 Release 0.9.4 2024-11-21 13:56:42 +01:00
Martin Dahl 94db799db2 fix message generation for WChar idl type 2024-11-21 13:45:13 +01:00
Martin Dahl 74ad4410c7 single-':' cargo syntax for compability with rust versions < 1.77 2024-11-19 12:12:33 +01:00
Martin Dahl b1134a6ef0 Release 0.9.3 2024-11-09 09:54:48 +01:00
Shaw Drastin 4517663f27 Expose WrongParameterType 2024-11-09 09:49:52 +01:00
Martin Dahl e6f805b3d3 Update readme 2024-11-02 10:02:01 +01:00
Martin Dahl 1f8e739803 add destroy publisher functions 2024-10-30 20:52:59 +01:00
Martin Dahl 2236b2ac12 Release 0.9.2 2024-10-13 11:30:34 +02:00
Martin Dahl 5ecf4d9123 Update README and fix build docs mistake. 2024-10-13 11:23:06 +02:00
Martin Dahl 4cb5bd362e Silence cfg and ffi warnings. Fixes #108. 2024-10-13 11:02:19 +02:00
James Carl d8fe90b61d
More convinent one time parameter access (#107)
* Implement TryInto for ParameterValue

* Add `get_parameter` method.

* Consolidate 'ParameterNotSet' into 'ParamterWrongType' error

* Add support for optional parameters

* Add example for get_parameter.
2024-10-13 10:51:47 +02:00
Martin Dahl 09c8a8ae11 Release 0.9.1 2024-10-12 10:18:47 +02:00
Tobias Stark 94ceec8cf6 Use copy_nonoverlapping for more efficient sequence filling 2024-10-12 09:45:05 +02:00
Tobias Stark 6311c2013f Add additional assertions to rcl wrapper 2024-10-12 09:45:05 +02:00
Tobias Stark a35d541378 Copy topic name before deleting subscription.
This fixes undefined behaviour, as the
rcl_subscription_get_topic_name documentation
states that the topic is no longer valid when
the subscription dies
2024-10-12 09:39:01 +02:00
Martin Dahl 89cec03d07 Remove dead code. 2024-07-04 18:18:40 +02:00
Desmond Germans cae671ccda Add ros2 jazzy support. 2024-07-04 17:42:07 +02:00
Tobias Stark 05d2c194d0 Avoid memory leak in loaned-message return path 2024-06-18 09:35:08 +02:00
Martin Dahl 21948154fe Release 0.9.0 2024-05-17 12:17:43 +02:00
Martin Dahl 4ef57ccebb Update README 2024-05-17 11:48:49 +02:00
Martin Dahl f7bbf8563f rustfmt 2024-05-17 11:47:26 +02:00
Martin Dahl 381f810d54 Check for null in `from_raw_parts` which rust 1.78 does not like.
Revert temporary fix for CI. Closes #96.
2024-05-17 11:40:05 +02:00
Martin Dahl 33b82da466 Temporary fix for CI until #96 is resolved. 2024-05-17 08:31:46 +02:00
TijlJappens a02a78fbf0
Expose qos profiles for service clients and servers. (#95)
Adds a QosProfile parameter for `Node::create_client` and `Node::node.create_service`.

`QosProfile::default()` can be passed when updating existing code.
2024-05-17 08:27:47 +02:00
Martin Dahl e2d6aba259 Update README 2024-04-29 20:53:47 +02:00
Michal Sojka 6f02234c69 Make order of derived parameters independent of CLI arguments
The previous commit made the order of parameters deterministic
(defined by so called insertion order), but the order still depends on
whether or not some parameters were set from the command line. Command
line parameters are inserted to the IndexMap at Node creation time,
while other RosParams-derived parameters later, during the call to
make_derived_parameter_handler().

This commit ensures that parameters processed by
make_derived_parameter_handler() are always inserted in the same
order, even if some of them were already inserted before due to CLI
arguments.
2024-04-29 20:33:50 +02:00
Michal Sojka e9f375e8f6 Make the order of parameters deterministic
GUI tools for working with parameters (at least Foxglove Studio, rqt
and rig_reconfigure) show the parameters in the same order as returned
by the ListParameters service. r2r stores the parameters in a HashMap,
which iterates keys and values in arbitrary order. The result is that
the GUI tools show the parameters in different order after every node
invocation, which can be quite annoying.

To make the order deterministic, we change the parameter storage from
HashMap to IndexMap, which iterates the map in insertion order.
According to the indexmap documentation, IndexMap is a drop-in
replacement of HashMap so this change should not require code changes
in applications using r2r. At least r2r examples and my projects
needed no changes.
2024-04-29 20:33:50 +02:00
aeon b46e3744b2 Add an r2r_info example to dump the ROS environment report 2024-04-17 08:23:20 +02:00
aeon 28e89bf256 [r2r_common] Remove println!() that taints the build script output 2024-04-17 08:23:20 +02:00
aeon 95fdea3b9c Run rustfmt using new configuration 2024-04-08 12:57:34 +02:00
aeon aad542fd3e Add "edition" and other options in rustfmt.toml 2024-04-08 12:57:34 +02:00
aeon bd998ab880 Fix several clippy warnings 2024-04-08 12:56:47 +02:00
passchaos 17584344c2 feat: remove is_available's node mut-ref dependency, also remove the !Sync constraint
on the future returned
2024-04-08 12:55:52 +02:00
Martin Dahl 13902524f7 Update README. 2024-03-25 08:10:14 +01:00
Martin Škoudlil 11ec445164 Add macro to fail compilation if sim time is not supported
cfg(r2r__rosgraph_msgs__msg__Clock) attribute is not propagated to user
code so this macro can be used to intentionally fail compilation if
sim time is not supported.
2024-03-22 18:45:27 +01:00
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