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

pbio/drivebase: Reverse turn rate for negative drive speed. #212

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
- Added `MoveHub.imu.tilt()` ([support#539]).
- Enabled hub init orientation support for Move Hub ([support#539]).

### Changed
- Changed steering direction with `DriveBase.drive()` when reversing. Now,
a positive angle or turn rate means the robot travels along a circle to
its right. The speed or radius can be negated to travel in reverse along
that same circle ([support#1191]).

### Fixed
- Fixed Move Hub accelerometer not working since v3.3.0b5 ([support#1269]).
- Fixed Bluetooth chip locking up on Technic and City hubs when broadcasting ([support#1095]).
Expand Down
6 changes: 6 additions & 0 deletions lib/pbio/src/drivebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,12 @@ static pbio_error_t pbio_drivebase_drive_time_common(pbio_drivebase_t *db, int32
return err;
}

// When reversing, also reverse steering. This way, driving backwards without
// changing the steering sign means driving along the same circle, backwards.
if (drive_speed < 0) {
turn_speed = -turn_speed;
}

err = pbio_control_start_timed_control(&db->control_heading, time_now, &state_heading, duration, turn_speed, on_completion);
if (err != PBIO_SUCCESS) {
return err;
Expand Down