RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
311 stars 70 forks source link

autofill JointState msg header when object is created #937

Closed kuriousDesign closed 4 months ago

kuriousDesign commented 9 months ago

Pretty new to submitting features requests so please be patient!

I am developing an app with react frontend that with communicates with a backend over socketio. The backend connects to ROS2 using rclnodejs.

My feature request involves auto-populating the header data in the JointState msg object. I cannot get my code to work without autofilling the header data as shown below:

  const pub_ = this.node.createPublisher('sensor_msgs/msg/JointState', 'topic_js');
  const stringMsgObject = rclnodejs.createMessageObject('sensor_msgs/msg/JointState');
  stringMsgObject.header.stamp.sec = 0.0;
  stringMsgObject.header.stamp.nanosec = 0.0;
  stringMsgObject.header.frame_id = '0';
minggangw commented 9 months ago

@kuriousDesign thanks for your feedback, I will take a look after my holidays.

minggangw commented 8 months ago

@kuriousDesign sorry for the delay, I didi some testing and it seems that removing the validation can meet your requirement https://github.com/RobotWebTools/rclnodejs/blob/795e36dfb22b5f2911b7275f0f71e597a2ca4eaa/rosidl_gen/templates/message.dot#L368-L370

But I haven't done more testing to check if any side-effect.