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

Implemented mock data node #453

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

alberto-escobar
Copy link
Contributor

@alberto-escobar alberto-escobar commented Nov 2, 2024

Description

Verification

  • Mock data appearing on console when running package and previous warning messages regarding not all subscribers are active in the physics engine node have diminished.
  • tested node with and without mock data node cli argument enable-mock-data:=true to ensure argument logic is correct

Resources

  • my big ol'brain

@SPDonaghy
Copy link
Contributor

Resources:
image

@alberto-escobar
Copy link
Contributor Author

Resources: image

HAHAHAHAAHAHA

@alberto-escobar
Copy link
Contributor Author

alberto-escobar commented Nov 3, 2024

new CLI argument for boat_simulator:
enable-mock-data:=true

@alberto-escobar alberto-escobar self-assigned this Nov 3, 2024
@eomielan
Copy link
Member

eomielan commented Nov 4, 2024

Nice work so far! It would be great if you could also configure the mock data node using the globals.yml file. Ideally, we should be able to specify which topics to publish mock data to, the exact data to publish, and the frequency at which it’s published. For an example of how this configuration was added for the data collection node, please refer to #222. Within the node, you’ll need to use ROS parameters to access the values defined in globals.yml. You can see how these parameters are used in the data collection node in this section:

@alberto-escobar
Copy link
Contributor Author

alberto-escobar commented Nov 16, 2024

Nice work so far! It would be great if you could also configure the mock data node using the globals.yml file. Ideally, we should be able to specify which topics to publish mock data to, the exact data to publish, and the frequency at which it’s published. For an example of how this configuration was added for the data collection node, please refer to #222. Within the node, you’ll need to use ROS parameters to access the values defined in globals.yml. You can see how these parameters are used in the data collection node in this section:

I have added the following parameters to globals.yaml:

mock_data_node:
   ros__parameters:
      qos_depth: 10
      mock_desired_heading: True
      mock_sail_trim_tab: False
      pub_period_sec: 1.0

and added logic so the node only publishes mock data to the topics that have a true value in globals.yaml

we discussed in person that adding a parameter to specify the specific topics to publish too may be complex and take a long time to implement. So mock data node will only specifically publish to the DesiredHeading and SailCmd topics.

Comment on lines 78 to +80
write_period_sec: 0.5

mock_data_node:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove space here to group with the rest of the boat simulator parameters

Comment on lines +10 to +14
# based on following:
# https://docs.ros.org
# /en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.html
# the purpose of this node is to publish to all topics that there is
# subscribers in physics engine node so send goal code can work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to a docstring for the MockDataNode class

Comment on lines +75 to +78
self.get_logger().info(
f"Publishing to {self.desired_heading_pub.topic} "
+ f"a mock desired heading of {heading} degrees"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +88 to +91
self.get_logger().info(
f"Publishing to {self.sail_trim_tab_angle_pub.topic} "
+ f"a mock trim tab angle of {trim_tab_angle_degrees} degrees"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


def publish_mock_desired_heading(self):
"""Publishes mock wind sensor data."""
heading = random.uniform(-179.99, 180.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please make the interval configurable through globals.yaml as well. This would make it easier to adjust on the fly and help avoid the need to rebuild the boat simulator package every time it's changed.


def publish_mock_sail_trim_tab_angle(self):
"""Publishes mock wind sensor data."""
trim_tab_angle_degrees = random.uniform(-40, 40)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the interval here

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.

Mock data node
3 participants