-
Notifications
You must be signed in to change notification settings - Fork 196
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
add AHRS interfaces for vehicle attitude control #299
base: dev
Are you sure you want to change the base?
Conversation
How is this different from the existing |
The reason's for this change are described #298 with a real world example. To put it simply, in my experience the less bus transactions, the better. Also there is no error indicator on the measurement done! How are we sure all bytes came through OK? This is solved adding a |
I'm not sure about this. I'd probably buy |
@ysoldak Sounds reasonable. |
6357deb
to
03856c8
Compare
I'm not sure about the name either, but actually I don't think we need to define it anywhere anyway. (Although it would be good for documentation). I do see the issue and I considered when I originally defined the interface. At the time I thought a simple
I think we should define the All in all I agree this is a good idea. It does require a bit more memory to store the result, but this is very minimal (maybe 24 bytes total). Regarding the update method, I would suggest the name // in the drivers package
type Measurement uint32
const (
Temperature = 1 << iota
Humidity
Rotation
Acceleration
MagneticField // not sure about this name
// ...etc
)
// In a driver
// Update reads the various measurements in one batch, as far as possible.
func (d *Device) Update(which Measurement) error {
if which & drivers.Temperature != 0 {
// read temperature
}
}
// In a user package
device := ...
for {
err := device.Update(drivers.Acceleration | drivers.Rotation)
if err != nil { handle }
ax, ay, az := device.Acceleration()
rx, ry, rz := device.Rotation()
time.Sleep(time.Second)
} Some devices have multiple sensors, not all of which would be useful to update all the time. For example, the BMI160 supports temperature, acceleration, and rotation, but most people will only be interested in just acceleration and rotation. So we need a way to pick only some measurements. Maybe there is a simpler way than a bitfield? |
I personally really like That said I believe it is worth discussing the side effects of
I'm unsure on the impact of either, although the second does feel less like magic. |
03856c8
to
052e66e
Compare
Drivers level type to aid in the standarization of vehicle attitude, position estimation.
For sensors with rotation in degrees such as the MPU6050 we could add an additional type
I've created a sample library for how this would look like in implementations: https://github.com/soypat/ahrs