Commit Graph

41 Commits

Author SHA1 Message Date
Martin Dahl 4d9da2b7a7 Release 0.8.0 2023-10-05 11:44:22 +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
passchaos b75607a46e feat: eliminate compiler warnings about virtual workspace's resolver 2023-09-07 10:49:53 +02:00
aeon e39887b038 Create a proper Cargo worksace and move r2r source to r2r/ dir 2022-11-25 00:14:14 +08:00
Martin Dahl bacd94c6e9 Bump version numbers fix 2022-08-22 11:48:37 +02:00
Martin Dahl 9166d99050 Bump version numbers 2022-08-22 11:36:38 +02:00
Martin Dahl 474b9d9482 Remove dependency on retain_mut since its now in the std lib 2022-08-19 15:52:54 +02:00
Martin Dahl b6c61f282e bump version numbers 2022-02-08 11:16:53 +01:00
Martin Dahl 174fb233c1 add #[serde(default)] to msg types
allows skipping fields when deserializing from json.
2022-01-26 13:27:25 +01:00
Martin Dahl a88505efd1 Bump version numbers, update readme and licenses. 2022-01-13 11:53:30 +01:00
Midnight Exigent f22d29d02f Migrate to Rust 2021 2022-01-07 04:15:21 +01:00
Martin Dahl 76612460c3 Bump version numbers 2021-09-20 10:37:55 +02:00
Martin Dahl 1e0a368d33 Cleanup package names and imports 2021-09-02 11:50:16 +02:00
Martin Dahl fe557e1bcb Package metadata 2021-09-01 23:47:08 +02:00
Martin Dahl 4bc034518f Remove failing doctest 2021-09-01 23:31:09 +02:00
Martin Dahl f6f3f68a8c Bump the version. 2021-09-01 23:20:50 +02:00
Martin Dahl 3f0571abb5 version bump 2021-08-29 19:47:09 +02:00
Martin Dahl 80c0db3f35 impl Send for Action client goals 2021-08-19 14:26:32 +02:00
Martin Dahl cf2006d6c1 Export ClientGoal types 2021-08-19 13:50:20 +02:00
Martin Dahl c9585f7a28 Untyped action clients 2021-08-18 14:58:49 +02:00
Martin Dahl 7853cb7161 Async api for waiting on services and action servers.
Implemented via polling in spin_once. Can be improved.
2021-08-18 10:02:59 +02:00
Martin Dahl 58e68bc359 Bump r2r version 2021-08-17 13:38:02 +02:00
Martin Dahl ac51828cad action servers are now streams 2021-08-17 13:00:15 +02:00
Martin Dahl e4dcb4d6ca Change services api to be a stream of requests. Updated examples.
The requests can be processed asynchronously which is demonstrated in
the service example.
2021-08-03 11:34:33 +02:00
Martin Dahl 8abcb5632b bump version numbers to 0.1.0 2021-06-18 14:20:30 +02:00
Martin Dahl 49c2a0ea7b fix tokio example 2021-06-16 09:57:19 +02:00
Martin Dahl d82efff0fe cleanups + start of async api 2021-06-15 13:10:50 +02:00
Martin Dahl c3be77224e minimal action clients. no handling or failed goals or canceling. 2021-06-12 08:09:39 +02:00
Martin Dahl 3d04cbdf93 Switch from failure to thiserror. Closes #2 2021-05-11 16:30:38 +02:00
Martin Dahl 79d3d70608 Fix drop for Context and implement Context::is_valid(). Closes #8 2021-05-11 11:48:21 +02:00
Martin Dahl 5427f318f4 Add new env vars for use from cmake for colcon integration.
Closes #5
2021-05-10 14:33:05 +02:00
achary 37f3cdd1d4
Bumping version of referenced creates to latest versions. (#4)
Co-authored-by: Adam Charytoniuk <adam.charytoniuk@five.ai>
2021-02-16 08:29:03 +01:00
Martin Dahl 5260d3ba8e Bump version to 0.0.5 2020-07-07 10:38:22 +02:00
Martin Dahl f27b90effb Add support for the rcl logging api 2020-07-04 11:13:24 +02:00
Kristofer Bengtsson d1aa8a6162 Revert "Generate one source file per ros package"
This reverts commit 4d1d223ece.
2020-04-07 08:45:44 +02:00
Kristofer Bengtsson f83541a24c A fix to better support rust-analyzer and type support.
This probably generates a large file to compile, so we need to look into that when we need to
2020-03-28 15:21:09 +01:00
Martin Dahl 321068aa1b Error type which is simply copy paste:d from the generated bindings 2019-08-29 11:50:20 +02:00
Martin Dahl 3ae38ed3a9 Support for querying the network and working with "untyped" msgs
It's currently a huge hack that came about because I wanted to
implement a rostopic echo function. For this we need to look up the
ros msg name during runtime. We use serde_json to store these
"untyped" messages.
2019-08-27 13:33:30 +02:00
Martin Dahl f88bd94eb5 Removed 'headers' feature flag from Cargo files 2019-08-26 14:49:32 +02:00
Martin Dahl b789ee9e36 Started adding support for arrays and nested messages. More derives!
Serde derives should maybe be a feature that can be toggled.
2019-08-20 11:07:09 +02:00
Martin Dahl 2ebeaf8682 Initial experiments with bindings and msg generation. 2019-08-19 21:05:26 +02:00