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

Arduino reports encoder ticks directly. #7

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mike-matera
Copy link

Hello friends. This is my favorite kind of feature request. The kind that comes with code!

This patch to Arduino changes the way that odometry is reported. The updated code reports encoder ticks and a timestamp instead of calculating distance and velocity. Having the raw encoder ticks is essential for having proper PID control in abridge. I will be submitting a pull request against the Swarmathon-ROS repo with the corresponding host-side code.

I loathe the idea of using custom Arduino code. I imagine it's a hassle on competition day too, with calibration and everything. If you merge this patch I'll send another that performs automatic calibration of the magnetometer without having to load a separate sketch.

@mike-matera
Copy link
Author

Hello again!

I have added the automatic calibration feature to the Arduino code. Here's how it works:

When the IMU is initialized the EEPROM is checked for stored calibration. If there is stored calibration and it is valid (passes a CRC32 check) then the calibration is loaded into the min/max vectors. If the calibration is invalid the default values are loaded.

During normal operation the max/min values are constantly tracked and recorded. The recorded min/max values are not used until the store calibration command is given. This way the calibration is not corrupted by driving the rover.

This change adds the following commands to the Arduino:

'C' - Store the observed max/min values into the EEPROM
'X' - Clear the EEPROM so that default calibration values will be used.
'P' - Print the stored and operational calibration values (for debugging)

Don't forget, this includes the change in the way that odometry is reported. Because this also changes the ROS side of the code, please also check for my pull request to that repo. It contains the changes needed to make this all work.

@mike-matera
Copy link
Author

The latest commit enables the start-calibration command and a corresponding commit is in the ROS repo.

Copy link
Contributor

@gmfricke gmfricke left a comment

Choose a reason for hiding this comment

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

@kristiana-rendon has tested these changes. The only downside is that there is no feedback on when the calibration is complete. The user has to guess.

@mike-matera
Copy link
Author

@gmfricke we confirmed calibration by using the rover GUI by spinning the robot around and eyeballing the accuracy. Hardly scientific but effective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants