robotics_signals/navigation/mod.rs
1use crate::{
2 geometry::{Point, Pose, PoseStamped, PoseWithCovariance, TwistWithCovariance},
3 standard::{Header, Timestamp},
4};
5use cdds_derive::*;
6use cyclonedds_rs::*;
7use serde_derive::{Deserialize, Serialize};
8
9#[repr(C)]
10#[derive(Serialize, Deserialize, Topic)]
11pub struct GridCells {
12 pub header: Header,
13 /// width of each cell
14 pub cell_width: f32,
15 /// height of each cell
16 pub cell_height: f32,
17 /// each cell is represented by the point at the centre
18 /// of the cell
19 pub cells: Vec<Point>,
20}
21
22#[repr(C)]
23#[derive(Serialize, Deserialize)]
24pub struct MapMetadata {
25 /// time at which the map is loaded
26 pub map_load_time: Timestamp,
27
28 /// the map resolution [m/cell]
29 pub resolution: f32,
30
31 /// map width in cells
32 pub width: u32,
33
34 /// map height in cells
35 pub height: u32,
36
37 /// The origin of the map [m,m, rad]. This is the real
38 /// world post of the bottom left corner of cell (0,0)
39 /// in the map.
40 pub origin: Pose,
41}
42
43#[repr(C)]
44#[derive(Serialize, Deserialize, Topic)]
45pub struct OccupancyGrid {
46 pub header: Header,
47
48 pub info: MapMetadata,
49
50 /// The map data, in row-major order, starting with (0,0).
51 /// Cell (1,0) will be listed second, representing the next cell in
52 /// the x direction. Cell (0,1) will be at the index equal to info.width, followed
53 /// by (1,1)
54 pub data: Vec<u8>,
55}
56
57/// This represents an estimate of a position and velocity in free space.
58/// The pose in this message should be specified in the coordinate frame given by header.frame_id
59/// The twist in this message should be specified in the coordinate frame given by the child_frame_id
60#[repr(C)]
61#[derive(Serialize, Deserialize, Topic)]
62pub struct Odometry {
63 pub header: Header,
64
65 /// Frame id the pose points to. The twist is in this coordinate frame.
66 pub child_frame_id: String,
67
68 /// Estimated pose that is typically relative to a fixed world frame.
69 pub pose: PoseWithCovariance,
70
71 /// Estimated linear and angular velocity relative to child_frame_id.
72 pub twist: TwistWithCovariance,
73}
74
75#[repr(C)]
76#[derive(Serialize, Deserialize, Topic)]
77pub struct Path {
78 pub header: Header,
79
80 /// Array of poses to follow.
81 pub poses: Vec<PoseStamped>,
82}