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

There is no possible way of resetting the gyro sensor #25

Open
Jensonbruins opened this issue Oct 1, 2019 · 4 comments
Open

There is no possible way of resetting the gyro sensor #25

Jensonbruins opened this issue Oct 1, 2019 · 4 comments

Comments

@Jensonbruins
Copy link

No description provided.

@dnlmlr
Copy link
Contributor

dnlmlr commented Oct 1, 2019

You can just save the value at the point where you would like to do a reset and then calculate the offset from that.

@Jensonbruins
Copy link
Author

Yes you can, but i think there should be a function for doing so

@dnlmlr
Copy link
Contributor

dnlmlr commented Oct 4, 2019

The problem here is that the functions for interacting with the sensors are basically just sending a command to the hardware and return the response of said hardware. This prevents us from modifying the returned data like the gyro sensor rotation. The value you get from readSensorValue is directly provided by the sensor.

Since I don't think it would be a good idea to start adding wrapper functions for specific sensors, the only way I can see this getting implemented inside the API is with a sensor command.

So if you are aware of a sensor command code that allows resetting, feel free to implement it and create a pull request. Or alternatively provide some info if you have seen it somewhere else. Still this would have to be implemented for the SetSensorMode function to stay consistant with the current API. To reset the values you would do something like SetSensorMode(GYRO_RST).

@simonedegiacomi
Copy link
Contributor

You can reset the sensor switching back and forth from angle to rate mode. I found this reading the implementation used in lejos and confirmed it from my experiments.
I implemented it in my fork and the code to reset the sensor is already present in this pull request: #22

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

No branches or pull requests

3 participants