Commit Graph

317 Commits

Author SHA1 Message Date
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
Martin Dahl 81adeb15d0 Update README. 2023-10-05 09:37:54 +02:00
Martin Dahl e33a57c6eb Remove special cases from bindgen path management 2023-10-05 09:37:08 +02:00
Michal Sojka 00d7a3db0b Derive ROS parameter description from field doc comments
With this change, adding doc comments to fields of structures used
with `#[derive(RosParams)]` results in those comments being used as
parameter description.

See r2r/examples/parameters_derive.rs for how to use and test this
feature.

*BREAKING CHANGE*

This commit changes r2r public API. Previously Node::params contained
HashMap<String, ParameterValue>, now it contains HashMap<String, Parameter>.

If you previously used the ParameterValue from this HashMap, now you
can get the same by using the .value field of the Parameter structure.
2023-10-05 08:34:22 +02:00
Michal Sojka c12a6fdb76 r2r_macros: Remove TODO
The code is already merged, so renaming makes little sense.
2023-10-05 08:34:22 +02:00
Michal Sojka 804bae7866 Minimal implementation of GetParameterTypes and DescribeParameters services
With this, the parameters are shown in Rqt or Foxglove Studio.
2023-10-05 08:34:22 +02:00
Martin Dahl 0a6e0f571a Restore old cmake integration functionality on windows 2023-09-26 22:14:36 +02:00
Martin Dahl 45e862b79e Workaround for _Check_return_ annotation 2023-09-26 22:14:36 +02:00
Nadhmi JAZI 64bc6af718 add windows support + use cmake_path to have colcon-cargo working
correctly
2023-09-26 22:14:36 +02:00
Martin Dahl 29404f1982 Update README 2023-09-22 08:47:46 +02:00
Michal Sojka 98550c76f7 doc: Parameter handling is no longer "rudimentary" 2023-09-22 08:42:29 +02:00
Michal Sojka a3fe422cd6 Implement derive(RosParams) macro and surrounding infrastructure
With this, declaring and handling node parameters becomes easy. One
just needs to define a structure(s) containing the parameters such as:

    #[derive(RosParams, Default, Debug)]
    struct Params {
        par1: f64,
        par2: i32,
        str: String,
    }

And then instantiate and register it with:

    let params = Arc::new(Mutex::new(Params::default()));
    let (paramater_handler, _) = node.make_derived_parameter_handler(params.clone())?;

This will add three parameters `par1`, `par2` and `str` to the node.
Their type will be `Double`, `Integer` and `String` respectively.
Other Rust types such as `f32` or differently sized integers, e.g.
`u16` are also supported and registered as appropriate ROS parameter
types.

After spawning the handler, e.g.:

    spawner.spawn_local(paramater_handler)?;

changing a parameter with external ROS tools (e.g. `ros2 param set`)
will result in changing the appropriate field in the `Params`
structure. Type conversion is handled automatically. For example,
setting an `i8` field (represented as `Integer` ROS parameter) will
succeed if the value is in range -128 to 127 and fail with appropriate
error message for other values.

The other direction also works: Changing a value in the `Params`
structure will be visible outside of the Node via the `get_parameters`
service.

It is also possible to organize the parameters as several nested
structures with parameters. Then, parameter names of different nesting
levels will be separated by `.`. For example `nested.par3`. See the
full example in `parameters_derive.rs`.
2023-09-22 08:42:29 +02:00
Martin Dahl 1c22daf8a9 Update readme. 2023-09-07 13:34:00 +02:00
passchaos b75607a46e feat: eliminate compiler warnings about virtual workspace's resolver 2023-09-07 10:49:53 +02:00
Martin Dahl 70d5b1b83c
Merge pull request #64 from wentasah/list-parameters
Implement rcl_interfaces::srv::ListParameters service
2023-09-07 10:48:39 +02:00
Michal Sojka 61856047fc Implement rcl_interfaces::srv::ListParameters service
With this, one can list node parameters by `ros2 param list`. It also
allows modifying the parameters with rig_reconfigure [1]. Without this
change, none of these was possible.

The functionality should match the corresponding code from rclcpp [2].

Note that `ros2 param list --param-type` and `ros2 param describe`
still doesn't work, because it needs
`rcl_interfaces::srv::DescribeParameters` to be implemented.

[1]: https://github.com/teamspatzenhirn/rig_reconfigure
[2]: 689e510cf0/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp (L922-L964)
2023-09-04 18:47:04 +02:00
Martin Dahl cc84beb17d Release 0.7.5 2023-06-27 23:54:46 +02:00
Martin Dahl bb6f171495 Move regex compilation to static thread locals 2023-06-27 22:29:26 +02:00
Martin Dahl f5f41baa25 Don't generate msg_includes.h in parallel with bindgen generation. 2023-06-26 22:23:51 +02:00
Martin Dahl fd8f466c6e Fix camel case to snake case conversion.
Replace general camel case to snake case conversion with a specific
implementation from rosidl.
2023-06-26 21:08:32 +02:00
Martin Dahl c58fbbcd5f Release 0.7.4 2023-06-26 15:55:15 +02:00
Martin Dahl 892dd4ab48 rustfmt 2023-06-26 13:33:41 +02:00
Martin Dahl 93cd1756cd Update readme 2023-06-26 12:16:21 +02:00
Martin Dahl a54682ec93 Refresh bindings 2023-06-26 12:05:55 +02:00
Martin Dahl f19b256139 Generate formatted bindings + fix dead code warnings 2023-06-26 12:05:21 +02:00
Martin Dahl d720848bb6 Refresh bindings bash script 2023-06-26 12:03:58 +02:00
Martin Dahl ce2ff76e7e
Merge pull request #59 from jerry73204/refresh-bindings
Refresh bindings with new codegen by #58
2023-06-26 10:29:53 +02:00
aeon 7800f0ac5b Refresh bindings with new codegen by #58 2023-06-26 04:31:38 +08:00
aeon fd4524c67e Refresh saved bindings for docs 2023-06-25 21:56:12 +02:00
aeon 228f713f14 Allow doc-only feature to work without ROS 2023-06-25 21:46:54 +02:00
aeon e8dd2bf9ab Run rustfmt 2023-06-25 21:46:52 +02:00
aeon a042dc8c55 Refactor codegen using syn and quote 2023-06-25 21:46:11 +02:00
aeon c2c365fa77 Don't check AMENT_PREFIX_PATH and ROS_DISTRO and doc-only feature is on 2023-06-25 21:45:46 +02:00
aeon fd0e9a7291 Fix linkage issue when doc-only feature is on 2023-06-25 21:45:46 +02:00
aeon a4d04a5017 Replace DeserializeOwned with Deserialize<'de> trait bound 2023-06-25 21:45:46 +02:00
Jiangeng Dong fd13c82aa2 int: replace the (e)println! with log 2023-06-25 10:56:57 -07:00
Martin Dahl c576ead3c1 Release 0.7.3 2023-06-20 11:22:13 +02:00
Martin Dahl dedbf11486 Fix mistake in docs generatation and CI docs test 2023-06-20 11:13:59 +02:00
Martin Dahl 5c78ecaebe Release 0.7.2 2023-06-20 10:32:42 +02:00
Martin Dahl 87db2a0344 Update readme 2023-06-20 10:16:27 +02:00
Martin Dahl 2a7a4ad249 Avoid running duplicate actions in pull requests 2023-06-20 08:58:45 +02:00
Martin Dahl a24d6980f1 Refresh saved bindings for docs. 2023-06-20 08:43:06 +02:00