Angular Velocity PrimeHub #1735
-
Hey guys, i am using pybricks with a Spike Prime and am looking for a way of tracking the position of my robot. In the documentation (https://docs.pybricks.com/en/stable/hubs/primehub.html) is a function for the angular_velocity() of the hub mentioned. But with this I was wondering which radius I am supposed to use to get the linear velocity. I didnt really find anything about that in the documentation. So I would greatly appreciate if anyone could help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
A gyroscope can only measure rotation, not translation. You could use the distance driven by the wheels to get an estimate of your movements. |
Beta Was this translation helpful? Give feedback.
You can get the acceleration with
hub.imu.acceleration()
. https://docs.pybricks.com/en/stable/hubs/primehub.html#pybricks.hubs.PrimeHub.imu.accelerationBut based on my experience, I don't think the sensor is accurate enough and/or can be sampled fast enough to get an accurate velocity from integrating the acceleration over time.
Laurens' suggestion of using the rotation sensors on the motors will be more accurate.