Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

use odom gearset/drivescales when available#464

Merged
Octogonapus merged 5 commits into
OkapiLib:developfrom
dcieslak19973:462_buildCCPID
Dec 23, 2020
Merged

use odom gearset/drivescales when available#464
Octogonapus merged 5 commits into
OkapiLib:developfrom
dcieslak19973:462_buildCCPID

Conversation

@dcieslak19973
Copy link
Copy Markdown
Contributor

@dcieslak19973 dcieslak19973 commented Nov 29, 2020

Description of the Change

When using geared drivetrains and odom, the odom drivescales are not used, leading to inaccurate movements

Motivation

Correct behavior described above

Possible Drawbacks

N/A

Verification Process

Physical test

Applicable Issues

Fixes #462

use odom gearset/drivescales when available
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 29, 2020

Codecov Report

Merging #464 (7c26423) into develop (3311b1b) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #464      +/-   ##
===========================================
+ Coverage    88.72%   88.81%   +0.09%     
===========================================
  Files          140      140              
  Lines         5878     5880       +2     
===========================================
+ Hits          5215     5222       +7     
+ Misses         663      658       -5     

@theol0403
Copy link
Copy Markdown
Member

auto ccGearset = gearset;
auto ccDriveScales = driveScales;
if(differentOdomScales) {
ccDriveScales = odomScales;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just use odomScales in either case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will test whether that works.

auto ccDriveScales = driveScales;
if(differentOdomScales) {
ccDriveScales = odomScales;
ccGearset = AbstractMotor::gearset::green;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hard-code green?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that may not be necessary. will test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Octogonapus - During physical testing I ran into issues with an externally geared chassis which I've also resolved in this PR. Feedback?

Ran into issues testing on a physical robot that has an externally geared drivetrain. This produces correct behavior
mode = distance;

const double newTarget = itarget.convert(meter) * scales.straight * gearsetRatioPair.ratio;
const double newTarget = itarget.convert(meter) * scales.straight;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change (and the one below) backwards compatible for people that don't call withDimensions with a GearsetRatioPair?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if one does .withDimensions(AbstractMotor::gearset::green, {{4.0_in,10_in}, imev5GreenTPR}) it will create with a gearsetRatioPair with a 1.0 gear ratio defaulted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure where the external ratio is accounted for, then. It seems like it is always discarded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Octogonapus - you are correct. Latest commit should fix this. The chassisControllerPID now works physically with both external tracking wheels and configured to use the drive train as the odom source.

I've phyically tested this with both configurations

Fixed CCPID issue with integrated odom vs tracking wheel
Copy link
Copy Markdown
Member

@Octogonapus Octogonapus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this rats nest 👍

@Octogonapus Octogonapus merged commit 1ab1dc7 into OkapiLib:develop Dec 23, 2020
@dcieslak19973 dcieslak19973 deleted the 462_buildCCPID branch December 23, 2020 01:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants