#viam.components.base.Base.spin() Causes Rover to Drift off Target due to Inconsistent Results

1 messages · Page 1 of 1 (latest)

west gulch
#

Hello Viam Team,

I'm leveraging viam.components.base.Base class in order for my rover to navigate discretely onto each 1sq ft tile per this video here: https://drive.google.com/file/d/1IVypqppalG14-0eJbcz-Ek4Cq9YNToiw/view
As you can see, I'm not able to navigate to the tile marked as X because my successive calls to spin() doesn't yield exactly a 90 degree turn, causing my rover to drift away from its target. Can this be remediated or is it impossible to get precise results each time due to environment constraints?

FYI, here's the script that I used to produce those results in the video: https://github.com/KesMath/DGMD-S-17-Autonomous-Indoor-Rover-Final-Project/blob/main/motor_driver.py
As you can notice, within spin_right_90_degrees(base) at line 31, for some reason I couldn't use 90 degrees cause it cause the rover to over-rotate, so I compensated by downsizing the value= 80 degrees instead. Is this simply due to imperfection caused by encoder sensors that's causing
this over-rotation to occur??

GitHub

Developing an Autonomous Reconnaissance Robot Used to Navigate Indoor Spaces Using LiDAR based SLAM and Subsequently Stream and Persist Live Video Stream To the Cloud. This is the final project for...

#

viam.components.base.Base.spin() Causes Rover to Drift off Target due to Inconsistent Results

quartz prism
#

hi @west gulch someone should reply shortly.

strange vortex
#

I've noticed similar behavior in my rover. I noticed even when driving perfectly straight on a hard flat clean surface, then coder values can be different on the right and left motors.

One theory I had was that the encoders are using light, and there could potentially be interference from overhead building/etc lights because the encoders are exposed open air on these motors.

I've seen other similar motors with encoders that have caps on the end. I plan on eventually doing an experiment and 3D printing caps to see if it makes any difference

west gulch
#

I like that theory @strange vortex ... I just spoke with my TA from class about this and she mentioned that this can be corrected by using a gyroscope as the source of truth. The goal would be to create a feedback control loop in which after every turn, you measure the angle reading from the gyroscope and keep on performing spin operations until the gyroscope reads your desired output (being 90deg)... https://www.watelectronics.com/pid-controller/

This Article Helps us to Understand PID Controller Working, Circuit, Block Diagram, PID In Arduino, Applications and Advantages

#

it would be nice if the rover came with an accelerometer coupled with a gyroscope and had this feedback-control loop built in to the spin() call so adjustments would be automatic but the current accelerometer it comes with is surely swappable (attached via double sided sticky tape)

strange vortex
#

I mean.. I would think the accelerometer would correct for drifts and telling it to go exactly due forward should be close to perfectly straight

#

But I'm following anyways to see what their engineers say! Shutting up now lol

sharp crane