Expand description
Parameter server for nros
This crate provides a ROS 2 compatible parameter server for embedded systems.
Parameters live in storage the CALLER places and lends to the server
(ParameterStorage / ParameterTable); MAX_PARAMETERS is only the
default capacity of that storage.
§Example
// The store's operations are behind `ParameterServerOps`;
// a `nros` user reaches parameters through its `Node` instead.
use nros_params::{
NodeKey, ParameterDescriptor, ParameterServer, ParameterServerOps as _, ParameterStorage,
ParameterType, ParameterValue,
};
// Storage is CALLER-OWNED: place it (a `static`, a struct
// field, a local), then lend it. `ParameterStorage` defaults to
// `MAX_PARAMETERS` slots; any length works, and the server's capacity is
// whatever it is handed.
let mut storage = ParameterStorage::<8>::new();
let mut server = ParameterServer::new_in(storage.as_table());
// Every per-parameter call names the NODE it is about, so
// two nodes composed onto one executor never share a name.
let node = NodeKey::PRIMARY;
// Declare a simple parameter
server.declare(node, "max_speed", ParameterValue::Double(1.0));
// Declare a parameter with constraints
let desc = ParameterDescriptor::new("velocity", ParameterType::Double)
.unwrap()
.with_description("Maximum velocity in m/s")
.with_float_range(0.0, 10.0, 0.1);
server.declare_with_descriptor(node, "velocity", ParameterValue::Double(5.0), Some(desc));
// Get and set parameters
assert_eq!(server.get_double(node, "max_speed"), Some(1.0));
server.set_double(node, "max_speed", 2.0);§Features
alloc- Enable heap allocation
Re-exports§
pub use declared::DeclaredParamMismatch;pub use declared::DeclaredParams;pub use launch_text::LaunchTextError;pub use launch_text::LaunchTextType;pub use launch_text::launch_text_extent;pub use launch_text::launch_text_type;pub use ops::ParameterServerOps;pub use server::DeclarationError;pub use server::LegacyParameterBuilder;pub use server::MAX_ON_SET_CALLBACKS;pub use server::OnSetContext;pub use server::OnSetParameterFn;pub use server::OnSetParameterHandle;pub use server::PARAMETER_EVENT_LOG_LEN;pub use server::ParameterEventKind;pub use server::ParameterServer;pub use server::ParameterSlot;pub use server::ParameterStorage;pub use server::ParameterTable;pub use server::PendingParameterEvent;pub use typed::UndeclaredParameters;Deprecated pub use typed::MandatoryParameter;pub use typed::OptionalParameter;pub use typed::ParameterBuilder;pub use typed::ParameterError;pub use typed::Parameters;pub use typed::RangeConvertible;pub use typed::ReadOnlyParameter;pub use types::SetParameterResult;Deprecated pub use types::DescriptorText;pub use types::FloatingPointRange;pub use types::IMPLIED_STORE_SLOTS;pub use types::IntegerRange;pub use types::MAX_ARRAY_LEN;pub use types::MAX_BYTE_ARRAY_LEN;pub use types::MAX_PARAM_CONSTRAINTS_LEN;pub use types::MAX_PARAM_DESCRIPTION_LEN;pub use types::MAX_PARAM_NAME_LEN;pub use types::MAX_PARAMETERS;pub use types::MAX_STRING_ARRAY_LEN;pub use types::MAX_STRING_VALUE_LEN;pub use types::NodeFlags;pub use types::NodeKey;pub use types::PARAM_EVENTS_DEPTH;pub use types::Parameter;pub use types::ParameterDescriptor;pub use types::ParameterRange;pub use types::ParameterType;pub use types::ParameterValue;pub use types::ParameterVariant;pub use types::STOCK_STORE_SLOTS;pub use types::fit_description;
Modules§
- declared
- The parameters a node’s contract DECLARES, checked when the code declares one.
- launch_
text - The ONE reading of a launch parameter’s baked text.
- ops
ParameterServer’s operations, behind a sealed trait.- request_
size - What a parameter-service REQUEST costs on the wire, from a node’s declared
parameter shape and the parameter store’s capacities.
The ONE formula for the request side. nros-node’s
param_sizing::node_boundprices every parameter-service message with it (the inbox slot and the build-time check that a stated slot fits), andnros buildprices the same requests from the contract to suggest a slot size before any build script runs. Two readers, one function: a second spelling of this arithmetic is how one formula’s inputs drift apart. - server
- Parameter server implementation
- typed
- Typed parameter API
- types
- Parameter types for ROS 2 compatible parameter handling
Constants§
- STORE_
NOT_ CARVED - The build-time refusal of an image that serves the parameter services
while its build carves no store (
IMPLIED_STORE_SLOTSis 0), which thenros::main!expansion const-asserts. It ends inSTORE_SIZE_REMEDY, so the build and every runtime report name the knob in the same words. - STORE_
SIZE_ DERIVED - When the store’s size is derived instead of stated. The second line of the
report; see
STORE_SIZE_KNOB. - STORE_
SIZE_ KNOB - The knob that sizes the parameter store, in every spelling a user writes.
- STORE_
SIZE_ REMEDY STORE_SIZE_KNOBandSTORE_SIZE_DERIVEDas one text, for a report with no record limit (an error’sDisplay).