1- use ros_z:: { Builder , MessageTypeInfo , Result , WithTypeInfo , entity:: TypeHash , msg:: ProtobufSerdes } ;
1+ use ros_z:: {
2+ Builder , MessageTypeInfo , Result , WithTypeInfo , entity:: TypeHash , msg:: ProtobufSerdes ,
3+ } ;
24use std:: time:: Duration ;
35
46// Import ROS-generated protobuf messages
@@ -38,7 +40,8 @@ fn main() -> Result<()> {
3840
3941 // Part 1: ROS message with protobuf serialization
4042 println ! ( "--- Part 1: ROS geometry_msgs/Vector3 with Protobuf ---" ) ;
41- let ros_pub = node. create_pub :: < Vector3Proto > ( "/vector_proto" )
43+ let ros_pub = node
44+ . create_pub :: < Vector3Proto > ( "/vector_proto" )
4245 . with_serdes :: < ProtobufSerdes < Vector3Proto > > ( )
4346 . build ( ) ?;
4447
@@ -57,7 +60,8 @@ fn main() -> Result<()> {
5760
5861 // Part 2: Custom protobuf message
5962 println ! ( "\n --- Part 2: Custom SensorData message (pure protobuf) ---" ) ;
60- let custom_pub = node. create_pub :: < SensorData > ( "/sensor_data" )
63+ let custom_pub = node
64+ . create_pub :: < SensorData > ( "/sensor_data" )
6165 . with_serdes :: < ProtobufSerdes < SensorData > > ( )
6266 . build ( ) ?;
6367
@@ -74,8 +78,10 @@ fn main() -> Result<()> {
7478 } ;
7579
7680 custom_pub. publish ( & msg) ?;
77- println ! ( " Published SensorData: id={}, temp={:.1}°C, humidity={:.1}%, ts={}" ,
78- msg. sensor_id, msg. temperature, msg. humidity, msg. timestamp) ;
81+ println ! (
82+ " Published SensorData: id={}, temp={:.1}°C, humidity={:.1}%, ts={}" ,
83+ msg. sensor_id, msg. temperature, msg. humidity, msg. timestamp
84+ ) ;
7985 std:: thread:: sleep ( Duration :: from_millis ( 500 ) ) ;
8086 }
8187
0 commit comments