Holonomic Drive with Heading

So my conundrum is this:

I have a robot that uses a holonomic x-drive and it works very well. The only problem is that the driver is not used to controlling a robot that can move anywhere in the XY plane and gets confused when the robot is facing him.

I recently had the idea of keeping track of the amount of rotation that has occurred since starting and adjust the joystick controls accordingly. This could be accomplished with the VEX Yaw Rate Gyroscope.

My question to you is how can I use the angular acceleration from the sensor to calculate the difference in position which can be added or subtracted from a heading value?

Once I have a value for the relative position (perhaps since the last sample?) I think I can manage finding the heading value and applying that to the control code. I just need help reading and interfacing with the sensor.

Thanks in advance,
Eric - 4558A

So it’s really not that hard. ROBOTC and EasyC both integrate the gyro raw data into an absolute value in the range 0 to 360 degrees. You can use this to modify the user control, here is an excerpt from some old code that did this.

void
DriveSystemMecanumTask()
{
    int forward, right, turn;
    int temp;
    float theta;

    // Get joystick values
    DriveSystemGetControlValues( &forward, &right, &turn );

    // Field centric control
    if( theDrive.type == Mecanum4MotorFieldCentric )
    {
        // Get gyro angle in radians
        theta = degreesToRadians( GyroGetAngle() );

        // rotate coordinate system
        temp  = forward * cos(theta) - right * sin(theta);
        right = forward * sin(theta) + right * cos(theta);
        forward = temp;
    }

    // Send to drive
    DriveSystemMecanumDrive( forward, turn, right );
}

forward, turn and right are variables that are obtained from the joystick. These are modified by the gyro heading and then sent to the usual holo calculations for the wheels.

another excerpt.

    // Set drive
    drive_l_front = forward + turn + right;
    drive_l_back  = forward + turn - right;

    drive_r_front = forward - turn - right;
    drive_r_back  = forward - turn + right;

This code was used on the “Open source robot” project, full code is here, see the file DriveLib.c

https://github.com/jpearman/OSR_1