Skip to content

Commit d835fc2

Browse files
committed
Format
1 parent 531aa48 commit d835fc2

File tree

11 files changed

+71
-76
lines changed

11 files changed

+71
-76
lines changed

crates/booster/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ use serde::{Deserialize, Serialize};
88
Clone, Debug, Default, Serialize, Deserialize, PathSerialize, PathDeserialize, PathIntrospect,
99
)]
1010
pub struct LowState {
11-
pub imu_state: ImuState, // IMU feedback.
12-
pub motor_state_parallel: Vec<MotorState>, // Parallel structure joint feedback.
13-
pub motor_state_serial: Vec<MotorState>, // Serial structure joint feedback.
11+
/// IMU feedback
12+
pub imu_state: ImuState,
13+
/// Parallel structure joint feedback
14+
pub motor_state_parallel: Vec<MotorState>,
15+
/// Serial structure joint feedback
16+
pub motor_state_serial: Vec<MotorState>,
1417
}
1518

1619
#[derive(

crates/ros2/src/builtin_interfaces/duration.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
/// Duration defines a period between two time points.
22
/// Messages of this datatype are of ROS Time following this design:
33
/// https://design.ros2.org/articles/clock_and_time.html
4-
5-
/// The seconds component, valid over all int32 values.
6-
74
use serde::{Deserialize, Serialize};
85

96
#[derive(Debug, Serialize, Deserialize)]
107
pub struct Duration {
8+
/// The seconds component, valid over all int32 values.
119
pub sec: i32,
1210

1311
/// The nanoseconds component, valid in the range [0, 1e9), to be added to the seconds component.

crates/ros2/src/builtin_interfaces/time.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/// This message communicates ROS Time defined here:
22
/// https://design.ros2.org/articles/clock_and_time.html
3-
4-
/// The seconds component, valid over all int32 values.
53
use serde::{Deserialize, Serialize};
64

75
#[derive(Debug, Serialize, Deserialize)]
86
pub struct Time {
7+
/// The seconds component, valid over all int32 values.
98
pub sec: i32,
109

1110
/// The nanoseconds component, valid in the range [0, 1e9), to be added to the seconds component.

crates/ros2/src/geometry_msgs/quaternion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// This represents an orientation in free space in quaternion form.
2-
32
use serde::{Deserialize, Serialize};
43

54
#[derive(Debug, Serialize, Deserialize)]

crates/ros2/src/geometry_msgs/transform.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// This represents the transform between two coordinate frames in free space.
2-
32
use serde::{Deserialize, Serialize};
43

54
use crate::geometry_msgs::{quaternion::Quaternion, vector3::Vector3};

crates/ros2/src/geometry_msgs/transform_stamped.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
/// The child_frame_id is necessary in addition to the frame_id
99
/// in the Header to communicate the full reference for the transform
1010
/// in a self contained message.
11-
12-
/// The frame id in the header is used as the reference frame of this transform.
13-
1411
use serde::{Deserialize, Serialize};
1512

1613
use crate::{geometry_msgs::transform::Transform, std_msgs::header::Header};
1714

1815
#[derive(Debug, Serialize, Deserialize)]
1916
pub struct TransformStamped {
17+
/// The frame id in the header is used as the reference frame of this transform.
2018
pub header: Header,
2119

2220
/// The frame id of the child frame to which this transform points.

crates/ros2/src/geometry_msgs/vector3.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/// This represents a vector in free space.
2-
2+
///
33
/// This is semantically different than a point.
44
/// A vector is always anchored at the origin.
55
/// When a transform is applied to a vector, only the rotational component is applied.
6-
76
use serde::{Deserialize, Serialize};
87

98
#[derive(Debug, Serialize, Deserialize)]

crates/ros2/src/geometry_msgs/vector3_stamped.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/// This represents a Vector3 with reference coordinate frame and timestamp
2-
2+
///
33
/// Note that this follows vector semantics with it always anchored at the origin,
44
/// so the rotational elements of a transform are the only parts applied when transforming.
5-
65
use serde::{Deserialize, Serialize};
76

87
use crate::{geometry_msgs::vector3::Vector3, std_msgs::header::Header};

crates/ros2/src/sensor_msgs/camera_info.rs

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,36 @@
2121
/// If the camera is uncalibrated, the matrices D, K, R, P should be left
2222
/// zeroed out. In particular, clients may assume that K[0] == 0.0
2323
/// indicates an uncalibrated camera.
24-
25-
/// Time of image acquisition, camera coordinate frame ID
24+
///
25+
/// # Calibration Parameters
26+
///
27+
/// These are fixed during camera calibration. Their values will be the
28+
/// same in all messages until the camera is recalibrated. Note that
29+
/// self-calibrating systems may "recalibrate" frequently.
30+
///
31+
/// The internal parameters can be used to warp a raw (distorted) image
32+
/// to:
33+
/// 1. An undistorted image (requires D and K)
34+
/// 2. A rectified image (requires D, K, R)
35+
/// The projection matrix P projects 3D points into the rectified image.
36+
///
37+
/// The image dimensions with which the camera was calibrated.
38+
/// Normally this will be the full camera resolution in pixels.
2639
use serde::{Deserialize, Serialize};
2740

2841
use crate::{sensor_msgs::region_of_interest::RegionOfInterest, std_msgs::header::Header};
2942

3043
#[derive(Debug, Serialize, Deserialize)]
3144
pub struct CameraInfo {
32-
pub header: Header,
45+
/// Time of image acquisition, camera coordinate frame ID
3346
/// Header timestamp should be acquisition time of image
3447
/// Header frame_id should be optical frame of camera
48+
pub header: Header,
49+
3550
/// origin of frame should be optical center of camera
3651
/// +x should point to the right in the image
3752
/// +y should point down in the image
3853
/// +z should point into the plane of the image
39-
40-
///######################################################################
41-
/// Calibration Parameters #
42-
///######################################################################
43-
/// These are fixed during camera calibration. Their values will be the #
44-
/// same in all messages until the camera is recalibrated. Note that #
45-
/// self-calibrating systems may "recalibrate" frequently. #
46-
/// #
47-
/// The internal parameters can be used to warp a raw (distorted) image #
48-
/// to: #
49-
/// 1. An undistorted image (requires D and K) #
50-
/// 2. A rectified image (requires D, K, R) #
51-
/// The projection matrix P projects 3D points into the rectified image.#
52-
///######################################################################
53-
54-
/// The image dimensions with which the camera was calibrated.
55-
/// Normally this will be the full camera resolution in pixels.
5654
pub height: u32,
5755
pub width: u32,
5856

@@ -79,58 +77,63 @@ pub struct CameraInfo {
7977
/// A rotation matrix aligning the camera coordinate system to the ideal
8078
/// stereo image plane so that epipolar lines in both stereo images are
8179
/// parallel.
82-
pub r: [f64; 9],
8380
/// 3x3 row-major matrix
81+
pub r: [f64; 9],
8482

8583
/// Projection/camera matrix
8684
/// [fx' 0 cx' Tx]
8785
/// P = [ 0 fy' cy' Ty]
8886
/// [ 0 0 1 0]
8987
/// By convention, this matrix specifies the intrinsic (camera) matrix
90-
/// of the processed (rectified) image. That is, the left 3x3 portion
91-
/// is the normal camera intrinsic matrix for the rectified image.
88+
/// of the processed (rectified) image. That is, the left 3x3 portion
89+
/// is the normal camera intrinsic matrix for the rectified image.
90+
///
9291
/// It projects 3D points in the camera coordinate frame to 2D pixel
93-
/// coordinates using the focal lengths (fx', fy') and principal point
94-
/// (cx', cy') - these may differ from the values in K.
92+
/// coordinates using the focal lengths (fx', fy') and principal point
93+
/// (cx', cy') - these may differ from the values in K.
94+
///
9595
/// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will
96-
/// also have R = the identity and P[1:3,1:3] = K.
96+
/// also have R = the identity and P[1:3,1:3] = K.
97+
///
9798
/// For a stereo pair, the fourth column [Tx Ty 0]' is related to the
98-
/// position of the optical center of the second camera in the first
99-
/// camera's frame. We assume Tz = 0 so both cameras are in the same
100-
/// stereo image plane. The first camera always has Tx = Ty = 0. For
101-
/// the right (second) camera of a horizontal stereo pair, Ty = 0 and
102-
/// Tx = -fx' * B, where B is the baseline between the cameras.
99+
/// position of the optical center of the second camera in the first
100+
/// camera's frame. We assume Tz = 0 so both cameras are in the same
101+
/// stereo image plane. The first camera always has Tx = Ty = 0. For
102+
/// the right (second) camera of a horizontal stereo pair, Ty = 0 and
103+
/// Tx = -fx' * B, where B is the baseline between the cameras.
104+
///
103105
/// Given a 3D point [X Y Z]', the projection (x, y) of the point onto
104-
/// the rectified image is given by:
105-
/// [u v w]' = P * [X Y Z 1]'
106-
/// x = u / w
107-
/// y = v / w
108-
/// This holds for both images of a stereo pair.
109-
pub p: [f64; 12],
106+
/// the rectified image is given by:
107+
/// [u v w]' = P * [X Y Z 1]'
108+
/// x = u / w
109+
/// y = v / w
110+
/// This holds for both images of a stereo pair.
111+
///
110112
/// 3x4 row-major matrix
113+
pub p: [f64; 12],
111114

112-
///######################################################################
113-
/// Operational Parameters #
114-
///######################################################################
115-
/// These define the image region actually captured by the camera #
116-
/// driver. Although they affect the geometry of the output image, they #
117-
/// may be changed freely without recalibrating the camera. #
118-
///######################################################################
119-
115+
/// # Operational Parameters
116+
///
117+
/// These define the image region actually captured by the camera
118+
/// driver. Although they affect the geometry of the output image, they
119+
/// may be changed freely without recalibrating the camera.
120+
///
120121
/// Binning refers here to any camera setting which combines rectangular
121-
/// neighborhoods of pixels into larger "crate-pixels." It reduces the
122-
/// resolution of the output image to
123-
/// (width / binning_x) x (height / binning_y).
122+
/// neighborhoods of pixels into larger "crate-pixels." It reduces the
123+
/// resolution of the output image to
124+
/// (width / binning_x) x (height / binning_y).
125+
///
124126
/// The default values binning_x = binning_y = 0 is considered the same
125-
/// as binning_x = binning_y = 1 (no subsampling).
127+
/// as binning_x = binning_y = 1 (no subsampling).
126128
pub binning_x: u32,
127129
pub binning_y: u32,
128130

129131
/// Region of interest (subwindow of full camera resolution), given in
130-
/// full resolution (unbinned) image coordinates. A particular ROI
131-
/// always denotes the same window of pixels on the camera sensor,
132-
/// regardless of binning settings.
132+
/// full resolution (unbinned) image coordinates. A particular ROI
133+
/// always denotes the same window of pixels on the camera sensor,
134+
/// regardless of binning settings.
135+
///
133136
/// The default setting of roi (all values 0) is considered the same as
134-
/// full resolution (roi.width = width, roi.height = height).
137+
/// full resolution (roi.width = width, roi.height = height).
135138
pub roi: RegionOfInterest,
136139
}

crates/ros2/src/sensor_msgs/image.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use crate::std_msgs::header::Header;
88
pub struct Image {
99
/// Header timestamp should be acquisition time of image
1010
/// Header frame_id should be optical frame of camera
11+
/// If the frame_id here and the frame_id of the CameraInfo
12+
/// message associated with the image conflict
13+
/// the behavior is undefined
1114
pub header: Header,
1215

1316
/// origin of frame should be optical center of cameara
1417
/// +x should point to the right in the image
1518
/// +y should point down in the image
1619
/// +z should point into to plane of the image
17-
/// If the frame_id here and the frame_id of the CameraInfo
18-
/// message associated with the image conflict
19-
/// the behavior is undefined
2020
/// image height, that is, number of rows
2121
pub height: u32,
2222
/// image width, that is, number of columns

0 commit comments

Comments
 (0)