-
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
AUTO-763 fix smoother accel decel #19
AUTO-763 fix smoother accel decel #19
Conversation
double v_component_max; | ||
double v_component_min; | ||
|
||
// Accelerating if magnitude of v_cmd is above magnitude of v_curr | ||
// and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | ||
// Deccelerating otherwise | ||
if (v_curr * v_cmd >= 0.0) { | ||
if (abs(v_cmd) >= abs(v_curr)) { | ||
v_component_max = accel / smoothing_frequency_; | ||
v_component_min = -accel / smoothing_frequency_; | ||
} else { | ||
v_component_max = -decel / smoothing_frequency_; | ||
v_component_min = decel / smoothing_frequency_; | ||
} | ||
} else { | ||
v_component_max = -decel / smoothing_frequency_; | ||
v_component_min = decel / smoothing_frequency_; | ||
} |
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.
double v_component_max; | |
double v_component_min; | |
// Accelerating if magnitude of v_cmd is above magnitude of v_curr | |
// and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | |
// Deccelerating otherwise | |
if (v_curr * v_cmd >= 0.0) { | |
if (abs(v_cmd) >= abs(v_curr)) { | |
v_component_max = accel / smoothing_frequency_; | |
v_component_min = -accel / smoothing_frequency_; | |
} else { | |
v_component_max = -decel / smoothing_frequency_; | |
v_component_min = decel / smoothing_frequency_; | |
} | |
} else { | |
v_component_max = -decel / smoothing_frequency_; | |
v_component_min = decel / smoothing_frequency_; | |
} | |
double v_component_max = -decel / smoothing_frequency_; | |
double v_component_min = decel / smoothing_frequency_; | |
// Accelerating if magnitude of v_cmd is above magnitude of v_curr | |
// and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | |
// Deccelerating otherwise | |
if (v_curr * v_cmd >= 0.0 && abs(v_cmd) >= abs(v_curr)) { | |
v_component_max = accel / smoothing_frequency_; | |
v_component_min = -accel / smoothing_frequency_; | |
} |
Above reads a little better for me as it shows there is one well defined case to ever accelerate at a glance.
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.
Reads better but less efficient, v_component_max
/ v_component_min
are computed twice ~50% of the time
Mirror of ros-navigation#3529
To test:
ros2 launch arri_bringup twist_pipeline.launch.py
edited with (low max linear accel):
Generate twist on
/cmd_vel_protected
with:ros2 run rqt_robot_steering rqt_robot_steering
Observe output with plotjuggler (test config: smoother_test.zip )