Skip to content

Gyro sensor implementation incorrect? #10

Closed
@dsharlet

Description

@dsharlet

According to the documentation at http://www.ev3dev.org/docs/sensors/lego-ev3-gyro-sensor/, the GYRO-G&A mode should have the angle in value0, and rate in value1. However, the ev3dev.h implementation is:

// The number of degrees that the sensor has been rotated
// since it was put into this mode.
int angle() {
  set_mode(mode_gyro_ang);
  return value(0);
}

// The rate at which the sensor is rotating, in degrees/second.
int rate() {
  set_mode(mode_gyro_rate);
  return value(0);
}

(from https://github.com/ddemidov/ev3dev-lang-cpp/blob/master/ev3dev.h#L473)

Isn't this going to make it impossible to use the GYRO-G&A mode? Any attempt to call angle() and rate() will change the mode away from G&A mode. Aside from that, calling angle() and rate() repeatedly and alternating will cause the gyro to reset and recalibrate, correct?

It seems like a workaround is to use value(0) and value(1) directly... but it seems like it should be possible to use the more descriptive functions in all modes. At best (if working as intended), the API is misleading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions