-
Notifications
You must be signed in to change notification settings - Fork 0
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
Velocity port done #20
base: main
Are you sure you want to change the base?
Conversation
# Bubbles for updating acceleration based on position | ||
# represented as {x-pos, y-pos, radius, velocity} | ||
# imported from checkpoints.json | ||
checkpoints_path = "/rb_ws/src/buggy/scripts/simulator/checkpoints.json" |
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.
needs to be environment-variable-ized. do we have a process for that now? @mehulgoel873 or @TiaSinghania
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.
Yeah, let me quickly add that in.
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.
The path is now environment-variable-ized!
|
||
# Declare parameters with default values | ||
self.declare_parameter('init_vel', 12) | ||
self.declare_parameter('buggy_name', 'SC') |
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.
we want to be able to do this for NAND too, right?
need to environment-variable-ize
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.
That's the default variable, it can change based on the parameter itself
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.
We can change the variable "buggy_name" in the xml launch file to make it run for NAND. Maybe there is a way to run two velocity_updater nodes to make it change velocity of SC and NAND at the same time, but I am not sure.
# Bubbles for updating acceleration based on position | ||
# represented as {x-pos, y-pos, radius, velocity} | ||
# imported from checkpoints.json | ||
checkpoints_path = "/rb_ws/src/buggy/scripts/simulator/checkpoints.json" |
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.
Yeah, let me quickly add that in.
|
||
# Declare parameters with default values | ||
self.declare_parameter('init_vel', 12) | ||
self.declare_parameter('buggy_name', 'SC') |
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.
That's the default variable, it can change based on the parameter itself
What type of PR is this? (check all applicable)
Description
This velocity-port branch is created to avoid the conflicting files on the old simulation-velocity-port branch. velocity_updater.py and its related files including checkpoints.json (the checkpoints data), sim_2d_single_velocity.xml (the launch file) and an edited CMakeList.txt are copy-pasted from the old branch. The old branch is an undone refactor from velocity_updater.py and velocity_ui.py from RoboBuggy2 repo.
velocity_updater.py subscribes to sim_2d/utm to get position data and publishes to sim/velocity for the velocity to be subscribed and used by the simulator in engine.py. It reads from checkpoints.json to get a list of checkpoints, and use the velocity corresponding to the checkpoints to update velocity, instead of the old method of depending on the currently not working velocity.ui (which is now deleted) and instead of calculating from acceleration corresponding to checkpoints (which is now also deleted).
This feature would allow us to take the change in the velocity of the buggy in different parts of the course into consideration when doing simulation. The added feature of reading from json would allow us to give the change in velocity data to the simulator in a simpler way.
QA Instructions, Screenshots, Recordings
The changes are tested by running the simulator and monitoring the "SC/sim/velocity" topic in foxglove. For the current checkpoints, the buggy should start at velocity of 15, then change to velocity of 12.345, then continue the course after the first turn with velocity of 17.234. The simulation results are expected.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above.
have not been included
[optional] Are there any post deployment tasks we need to perform?
The checkpoints.json file is currently filled with made-up data for debugging. The data needs to be later updated to fit in actual change in buggy velocity on the course. Maybe another function that reads from a rosbag to record the velocity data into a json file can be later implemented to get accurate data of the change in velocity.