-
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
Emergency braking #16
base: main-old-sim
Are you sure you want to change the base?
Conversation
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.
Good initial PR! There's a concern I have about how speed is calculated, but your logic is sound
EmergencyBraking() : Node("emergency_braking_node") { | ||
brake_pub_ = this->create_publisher<ackermann_msgs::msg::AckermannDriveStamped>("drive", 10); | ||
scan_sub_ = this->create_subscription<sensor_msgs::msg::LaserScan>("scan", 10, std::bind(&EmergencyBraking::scan_callback, this, _1)); | ||
odom_sub_ = this->create_subscription<nav_msgs::msg::Odometry>("ego_racecar/odom", 10, std::bind(&EmergencyBraking::odom_callback, this, _1)); |
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.
I think relying on odom here isn't a good idea:
The ego_racecar/odom reading is only "100% accurate" in simulation, in real-life the SLAM subteam computes odom estimates. This mean that the data you're using for emergency braking may be unreliable depending on how good SLAM is, which is spooky because if something goes wrong in SLAM the emergency braking would also not work properly.
The idea is that emergency braking acts as a "standalone last resort" component which kicks in regardless of what any of the other components are saying. So I think it's a better idea to only use lidar readings.
I.e. instead of getting speed from the odom reading, you can calculate the speed using how the lidar measurements change over time.
If this doesn't make sense then you can just ping me on the server and we can hop in a call / I can clarify further! Sorry about the confusion, but this is arguably the most important part in the system so that we don't wreck our car :)) Thanks for your work!
# Install the meshes folder | ||
#install(DIRECTORY assets/ | ||
# DESTINATION share/${PROJECT_NAME}/assets | ||
#) |
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.
# Install the meshes folder | |
#install(DIRECTORY assets/ | |
# DESTINATION share/${PROJECT_NAME}/assets | |
#) |
void scan_callback(const sensor_msgs::msg::LaserScan::ConstSharedPtr scan_msg) { | ||
// calculate TTC | ||
bool brake = false; | ||
double threshold = 1; |
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.
S: Make this a class constant. Itll be easier to find & tweak in the future if we need this to be more/less conservative.
@hepromark