Serialize a pose update for TCP wire. Returns: type(0x02) + x(f64 LE) + y(f64 LE) + theta(f64 LE)
(x: f64, y: f64, theta: f64)
| 48 | /// Serialize a pose update for TCP wire. |
| 49 | /// Returns: type(0x02) + x(f64 LE) + y(f64 LE) + theta(f64 LE) |
| 50 | pub fn encode_pose(x: f64, y: f64, theta: f64) -> Vec<u8> { |
| 51 | let mut buf = Vec::with_capacity(25); |
| 52 | buf.push(MSG_POSE); |
| 53 | buf.extend_from_slice(&x.to_le_bytes()); |
| 54 | buf.extend_from_slice(&y.to_le_bytes()); |
| 55 | buf.extend_from_slice(&theta.to_le_bytes()); |
| 56 | buf |
| 57 | } |
| 58 | |
| 59 | /// Parse the next message from a byte buffer. |
| 60 | /// Returns (message, bytes_consumed) or None if incomplete. |
no test coverage detected