Help With a Proportional Control system using a V2 brain

Hi,

We were following the tutorial by team Caution Tape(@gamania), but realized it used the external gyro sensor. I was wondering if anyone has a version that works with the internal V2 brain sensor. I tried just replacing the part, but my robot is not preforming the desired behavor at all.

Original tutorial:

Gyro and inertial sensors are reversed direction. You need to reverse the formula.

2 Likes

Sorry I meant replacing the code block for the Gyro to the internal sensor*

Wow thanks, @gamania I wasn’t expecting a reply from the creator. Sorry for such a basic question, but which part of the code needs to be reversed? Do I multiply the rotation reading by a negative one in the output section?
Or does

Left motor velocity = Heading - gyrorotation

Change to

Left motor velocity =Heading + Output

?

Thank you for the content you have put out. It has really helped us in our first year.

Hi @Macauman.
If you want to change the gyro to an inertial sensor you can use this code.


In this area, you should switch the “Gyro rotation in degrees” for this.

See if that works, and if it doesn’t, try sending a video of what is happening along with your code
Thanks

1 Like

Hi Penguin,

Could you explain why the minus 0 is needed? Am I subtracting the rotation from 0 to flip the rotation?

The 0 - BrainInertial rotation in degrees is so that it reverses the value that is coming in.
Ex. The brain inertial gets that it is rotated 35 degrees, if you do 0 - BrainInertial rotation in degrees it will be -35. So it reverses the output allowing for minimal changes to your code.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.