c0pperdragon/EV3Basic

[question] Calibrate Gyro Sensor

datatags opened this issue · 3 comments

Is it possible to launch an EV3G program or even another EV3Basic program from an EV3Basic program? I was wondering because I want to force a recalibration of a gyro sensor during the program. I have a "new" gyro sensor so according to this document I have to read from it as an infrared sensor and then a gyro sensor to recalibrate it. As far as I can tell, EV3Basic doesn't let me force a sensor type on a port, so I was going to create my recalibration program in EV3G and the rest of it in EV3Basic. Then I would just have the EV3Basic launch the recalibrator separately. But I can't figure out how to do that. I tried using EV3.SystemCall to just type the path as if it were an executable. It gave me exit code 127 which should be that it can't find that file if I'm not mistaken, but I triple-checked the path was right and tried both absolute paths and relative paths and neither worked. Is this even possible? Is there a better way?

Thanks!

Sorry, EV3 Basic does not support calling external VM-based programs. It does support running arbitrary linux commands, but this is a quite advanced feature that need very good knowledge of the underlying linux operating system and will probably still not help you here anyway.

But maybe you can already do the necessary actions with the Sensor.SetMode command. I am not sure how this "force a sensor to a specific type" works from EV3G, but I guess it will probably use the same commands that are exposed by EV3 Basic also (since both compile down to bytecode being executed by the same interpreter). So it may be just doing the same thing as my SetMode internally.

Please try the provided example SensorInfo.sb with the gyro sensor on port 1 and see what you can read from there and if switching the sensor mode (with the up and down keys) has any usable effect.

To follow up, I was unable to get the new gyro sensor version to recalibrate and ended up using an older one that recalibrates easier. I’ll try forking my own version and seeing if I can get it to work. Thanks for your time.

For anyone else looking for the solution I found, set the gyro sensor to mode 4, then mode for the new ones. Don't know how I missed it originally, but yeah.