Gyrometer and Arcade Control Help

  1. 6 weeks ago

    Does anyone know how to code a gyro sensor into your program and how to code arcade control on your left joystick? If anyone could tell me what exactly I could use the pyrometer for that would be awesome!

  2. [TVA]Connor

    Dec 5 South Texas 1814D

    @bbot Does anyone know how to code a gyro sensor into your program and how to code arcade control on your left joystick? If anyone could tell me what exactly I could use the pyrometer for that would be awesome!

    Are you using the VEX CORTEX or VEX V5? What coding platform?

  3. Kselva20

    Dec 5 5249Z

    What exactly do you need help with when it comes to the gyroscope? And what do you want your joystick to do (strictly forward and backward motion, include turning)?

  4. @[TVA]Connor and @Kselva20, Our robot is a V5 robot. We want to figure out how to turn. We want it to turn so we can hit flags more effectively in autonomous! We do not need it to go back and forth, if you could tell us that it would be awesome. More info the merrier!!!

  5. Kselva20

    Dec 7 5249Z

    The following code is for forward and backward motion with the left joystick and turning with the right joystick.

    int leftSpeedMainUser = int(MainUser.Axis3.position(vex::percentUnits::pct)) + ((MainUser.Axis1.position(vex::percentUnits::pct)) + (MainUser.Axis2.position(vex::percentUnits::pct)));
            int rightSpeedMainUser = int(MainUser.Axis3.position(vex::percentUnits::pct)) - ((MainUser.Axis1.position(vex::percentUnits::pct)) + (MainUser.Axis2.position(vex::percentUnits::pct)));
            
            int leftSpeedSecondUser = int(SecondUser.Axis3.position(vex::percentUnits::pct)) + ((SecondUser.Axis1.position(vex::percentUnits::pct)) + (SecondUser.Axis2.position(vex::percentUnits::pct)));
            int rightSpeedSecondUser = int(SecondUser.Axis3.position(vex::percentUnits::pct)) - ((SecondUser.Axis1.position(vex::percentUnits::pct)) + (SecondUser.Axis2.position(vex::percentUnits::pct)));
            
            if(leftSpeedSecondUser > 30 or leftSpeedSecondUser < -30){
                LeftChassis.spin(vex::directionType::fwd,leftSpeedSecondUser,vex::velocityUnits::pct);
            }
            else if(leftSpeedMainUser > 10 or leftSpeedMainUser < -10){
                LeftChassis.spin(vex::directionType::fwd,leftSpeedMainUser,vex::velocityUnits::pct);
            }
            else{
                LeftChassis.spin(vex::directionType::fwd,0,vex::velocityUnits::pct);
            }
            
            if(rightSpeedSecondUser > 30 or rightSpeedSecondUser < -30){
                RightChassis.spin(vex::directionType::fwd,rightSpeedSecondUser,vex::velocityUnits::pct);
            }
            else if(rightSpeedMainUser > 10 or rightSpeedMainUser < -10){
                RightChassis.spin(vex::directionType::fwd,rightSpeedMainUser,vex::velocityUnits::pct);
            }
            else{
                RightChassis.spin(vex::directionType::fwd,0,vex::velocityUnits::pct);
            }

    As for the gyroscope, you use it as any other sensor. You should calibrate it for 5 seconds by using the startCalibration method and then the vex task sleep method. Then, the gyroscope start from 0 and going immediately to right will make the values positive and the left will make them negative. There is no way to zero the gyroscope. To obtain the current value of the gyroscope, use the analogUnits with the data type of range12bit. This will return the value in tenths of a degree, so 180 degrees equals 1800 . If you have any other questions feel free to ask. I hope this helped.

  6. 4 weeks ago

    @[TVA]Connor V5

 

or Sign Up to reply!