-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
new CLI argument for boat_simulator: |
Nice work so far! It would be great if you could also configure the mock data node using the sailbot_workspace/src/boat_simulator/boat_simulator/nodes/data_collection/data_collection_node.py Line 80 in 6c5d7f3
|
src/boat_simulator/boat_simulator/nodes/mock_data/mock_data_node.py
Outdated
Show resolved
Hide resolved
I have added the following parameters to
and added logic so the node only publishes mock data to the topics that have a true value in 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 |
write_period_sec: 0.5 | ||
|
||
mock_data_node: |
There was a problem hiding this comment.
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
# 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. |
There was a problem hiding this comment.
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
self.get_logger().info( | ||
f"Publishing to {self.desired_heading_pub.topic} " | ||
+ f"a mock desired heading of {heading} degrees" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for +
here. https://stackoverflow.com/a/48881390
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" | ||
) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
Description
Verification
enable-mock-data:=true
to ensure argument logic is correctResources