Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

USARBot.P2DX


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
class P2DX extends SkidSteeredRobot config(USARBot);

var float lastAng;
var float steerAng;
var byte count;

replication
{
    reliable if(Role == ROLE_Authority)
        steerAng;
}

simulated function Tick(float Delta)
{
    local KRigidBodyState WheelState;
    local vector wheelLinVel, ChassisX;

    Super.Tick(Delta);

    if (Role == ROLE_Authority) {
        Parts[2].KGetRigidBodyState(WheelState);
        wheelLinVel = KRBVecToVector(WheelState.LinVel);
        if (VSize(wheelLinVel) < 0.2)
            return;

        ChassisX = QuatRotateVector(KGetRBQuaternion(), vect(1, 0, 0));
        steerAng = (ACos(Normal(wheelLinVel) Dot ChassisX)) * 32768 / 3.14;
        if (abs(lastAng - steerAng) > 16384) {
            if (steerAng > 16384)
                steerAng -= 32768;
            else if (steerAng < -16384)
                steerAng += 32768;
        }
    }

    count++;
    if (abs(lastAng-steerAng) > 200 || count == 4) {
        lastAng = steerAng;
        KCarWheelJoint(Joints[2]).KSteerAngle = steerAng;
    }
    if (count==4) count=0;
}

defaultproperties
{
  //---Wheel information.  Since the P2DX has two skid-steered wheels, we have two of these definitions
  // The next two definitions will create a 2-wheel skid steer P2DX where all the wheels are locked (cannot be steered)

    // Number=0 indicates that this wheel is the first JointPart defined in USARBot.ini (ORDER MATTERS!)
    // Power=Right_Powered tells USARSim to spin this wheel using the right throttle
    // Note that since the variables SteerType and MaxSteerAngle are not defined, this wheel is not steered (steering is locked)
    Wheels(0)=(Number=0,PowerType=Right_Powered);

    // Number=1 indicates that this wheel is the second JointPart defined in USARBot.ini (ORDER MATTERS!)
    // Power=Left_Powered tells USARSim to spin this wheel using the left throttle
    // Note that since the variables SteerType and MaxSteerAngle are not defined, this wheel is not steered (steering is locked)
    Wheels(1)=(Number=1,PowerType=Left_Powered);
  //---

  //--Other Robot's Properties
    bDebug=false
    StaticMesh=StaticMesh'USARSim_Vehicles_Meshes.P2DX.P2DXBody'
    DrawScale=4.762
    DrawScale3D=(X=1.0,Y=1.0,Z=1.0)
    AmbientGlow=128

    ChassisMass=1.000000

    // Configuration Parameters. Note: these variables need to be correspond to your robot's model.
    WheelRadius=0.0825                      // Wheel Radius, in unreal units. Note: Value is in meters
    Dimensions=(X=0.4430,Y=0.3814,Z=0.2313) // X=Length=0.4430m, Y=Width=0.3814m, Z=Height=0.2313m
    maxSpinSpeed=21.82                     // Maximum wheel's spin speed is 1.8/0.0825 = 21.82 rad/sec

    TireRollFriction=15.000000
    TireLateralFriction=15.000000
    TireRollSlip=0.0600
    TireLateralSlip=0.0600000
    TireMinSlip=0.001000
    TireSlipRate=0.0050000
    TireSoftness=0.000005
    TireAdhesion=0.000000
    TireRestitution=0.000000

    Begin Object Class=KarmaParamsRBFull Name=KParams0
        KInertiaTensor(0)=20.18000
        KInertiaTensor(3)=30.24000
        KInertiaTensor(5)=50.2600
        KCOMOffset=(X=0.000000,Z=0.000000)
        KLinearDamping=0.00000
        KAngularDamping=10.00000
        KStartEnabled=True
        bHighDetailOnly=False
        bClientOnly=False
        bKDoubleTickRate=True
        KFriction=1.600000
        Name="KParams0"
    End Object
    KParams=KarmaParamsRBFull'USARBot.P2DX.KParams0'
  //--
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 19.1.2007 19:39:14.000 - Creation time: Mo 16.4.2007 11:20:52.000 - Created with UnCodeX