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

Fix/speed limit - clipped steer rate limit #61

Merged
merged 5 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/publish_control_board_rev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ void PublishControlBoardRev2::publish_steering_message(const sensor_msgs::Joy::C
speed_mutex.unlock();

if (speed_valid)
speed_scale = STEER_OFFSET - fabs(
(current_speed / (max_veh_speed * STEER_SCALE_FACTOR))); // Never want to reach 0 speed scale.
if (current_speed < max_veh_speed)
speed_scale = STEER_OFFSET - fabs(
(current_speed / (max_veh_speed * STEER_SCALE_FACTOR))); // this could go negative.
else
speed_scale = 0.33333; // clips the equation assuming 1 offset and 1.5 scale_factor

steer_msg.angular_position = (range_scale * max_rot_rad) * msg->axes[axes[steering_axis]];
steer_msg.angular_velocity_limit = steering_max_speed * speed_scale;
Expand Down
7 changes: 5 additions & 2 deletions src/publish_control_board_rev3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ void PublishControlBoardRev3::publish_steering_message(const sensor_msgs::Joy::C
speed_mutex.unlock();

if (speed_valid)
speed_scale = STEER_OFFSET - fabs(
(current_speed / (max_veh_speed * STEER_SCALE_FACTOR))); // Never want to reach 0 speed scale.
if (current_speed < max_veh_speed)
speed_scale = STEER_OFFSET - fabs(
(current_speed / (max_veh_speed * STEER_SCALE_FACTOR))); // this could go negative.
else
speed_scale = 0.33333; // clips the equation assuming 1 offset and 1.5 scale_factor

steer_msg.command = (range_scale * max_rot_rad) * msg->axes[axes[steering_axis]];
steer_msg.rotation_rate = steering_max_speed * speed_scale;
Expand Down