Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add willCheckConsistency option to enable/disable message consistency checking #947

Merged
merged 6 commits into from
Feb 4, 2024

Conversation

minggangw
Copy link
Member

@minggangw minggangw commented Dec 27, 2023

Currently, when a publisher/client sends a topic/request, it will check the consistency of the message to be sent. For example, the following code will lead to an exception:

  const pub_ = this.node.createPublisher('sensor_msgs/msg/JointState', 'topic_js');
  const stringMsgObject = rclnodejs.createMessageObject('sensor_msgs/msg/JointState');
  stringMsgObject.header.frame_id = '0';

Because the stamp in header is not initialized.

This patch adds an additional option for node when initializing, which is willCheckConsistency (default is false), so the code above can run as expected with the stamp initialized with default value. Meanwhile, user can set it to true to check the consistency intentionally.

To achieve, this patch implements:

  1. Add willCheckConsistency to the node option.
  2. Update message.dot accordingly to check the consistency based on the node option above.
  3. Update the unit tests:
    • test/test-security-related.js

Fix: #937

@minggangw minggangw changed the base branch from develop to iron-irwini December 29, 2023 03:19
@minggangw minggangw changed the base branch from iron-irwini to develop December 29, 2023 03:19
@minggangw minggangw changed the base branch from develop to iron-irwini January 22, 2024 05:01
@minggangw minggangw changed the base branch from iron-irwini to develop January 22, 2024 05:02
@minggangw minggangw changed the title Mark primitive messages initialized if no default value provided Add willCheckConsistency option to enable/disable message consistency checking Feb 4, 2024
@minggangw minggangw merged commit e4ce8e6 into RobotWebTools:develop Feb 4, 2024
2 of 6 checks passed
minggangw added a commit that referenced this pull request Feb 4, 2024
… checking (#947)

Currently, when a publisher/client sends a topic/request, it will check the consistency of the message to be sent. For example, the following code will lead to an exception:

```js
  const pub_ = this.node.createPublisher('sensor_msgs/msg/JointState', 'topic_js');
  const stringMsgObject = rclnodejs.createMessageObject('sensor_msgs/msg/JointState');
  stringMsgObject.header.frame_id = '0';
```
Because the `stamp` in `header` is not initialized.

This patch adds an additional option for node when initializing, which is `willCheckConsistency` (default is `false`), so the code above can run as expected with the  `stamp` initialized with default value. Meanwhile, user can set it to `true` to check the consistency intentionally.

To achieve, this patch implements:

1.  Add `willCheckConsistency` to the node option.
2. Update `message.dot` accordingly to check the consistency based on the node option above.
3. Update the unit tests:
   - test/test-security-related.js

Fix: #937
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autofill JointState msg header when object is created
1 participant