[TeamTalk 61]: [598] usarsim/USARBot: Import usarsim usarbot
tk@edam.speech.cs.cmu.edu
tk at edam.speech.cs.cmu.edu
Thu May 10 11:23:26 EDT 2007
An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070510/d1c708a8/attachment-0001.html
-------------- next part --------------
Added: usarsim/USARBot/Classes/AIBOCamera.uc
===================================================================
--- usarsim/USARBot/Classes/AIBOCamera.uc (rev 0)
+++ usarsim/USARBot/Classes/AIBOCamera.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,13 @@
+/* AIBO Camera
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class AIBOCamera extends RobotCamera config (USARBot);
+
+var config int CameraXres, CameraYres;
+
+defaultproperties
+{
+ CameraXres=208
+ CameraYres=160
+ CameraDefFov=0.9948377 // 57 deg
+}
Added: usarsim/USARBot/Classes/ATRVJr.uc
===================================================================
--- usarsim/USARBot/Classes/ATRVJr.uc (rev 0)
+++ usarsim/USARBot/Classes/ATRVJr.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,72 @@
+class ATRVJr extends SkidSteeredRobot config(USARBot);
+
+defaultproperties
+{
+ //---Wheel information. Since the ATRVJr has four wheels, we have four of these definitions
+ // The next four definitions will create a 4-wheel skid steer ATRVJr 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);
+
+ // Number=2 indicates that this wheel is the third JointPart defined in USARBot.ini (ORDER MATTERS!)
+ // Power=Left_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(2)=(Number=2,PowerType=Right_Powered);
+
+ // Number=3 indicates that this wheel is the fourth 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(3)=(Number=3,PowerType=Left_Powered);
+ //---
+
+ //--Other Robot's Properties
+ bDebug=false
+ StaticMesh=StaticMesh'USARSim_Vehicles_Meshes.ATRVJr.ATRVJrBody'
+ DrawScale=4.762
+ DrawScale3D=(X=1.0,Y=1.0,Z=1.0)
+
+ ChassisMass=1.000000
+
+ // Configuration Parameters. Note: these variables need to be correspond to your robot's model.
+ WheelRadius=0.1922 // Wheel Radius, in unreal units. Note: Value is in meters
+ Dimensions=(X=0.7744,Y=0.6318,Z=0.5754) // X=Length=0.7744m, Y=Width=0.6318m, Z=Height=0.5754m
+ maxSpinSpeed=5.2 // Maximum wheel's spin speed is 1/0.1922 = 5.2 rad/sec
+
+ TireRollFriction=15.000000
+ TireLateralFriction=15.0
+ TireRollSlip=0.0600
+ TireLateralSlip=0.0600000
+ TireMinSlip=0.005000
+ TireSlipRate=0.00500000
+ TireSoftness=0.000020
+ TireAdhesion=0.000000
+ TireRestitution=0.000000
+
+ Begin Object Class=KarmaParamsRBFull Name=KParams0
+ KActorGravScale=2.58
+ bKNonSphericalInertia=True
+ KInertiaTensor(0)=0.061
+ KInertiaTensor(3)=0.078
+ KInertiaTensor(5)=0.083
+ KCOMOffset=(X=0.0,Y=0.0,Z=0.0)
+ KLinearDamping=0.0
+ KAngularDamping=0.0
+ KMaxAngularSpeed=100
+ KMaxSpeed=25000
+ KStartEnabled=True
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKDoubleTickRate=True
+ KFriction=0.9
+ Name="KParams0"
+ End Object
+ KParams=KarmaParamsRBFull'USARBot.ATRVJr.KParams0'
+ //--
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/AccelerationSensor.uc
===================================================================
--- usarsim/USARBot/Classes/AccelerationSensor.uc (rev 0)
+++ usarsim/USARBot/Classes/AccelerationSensor.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,35 @@
+/* Simplistic Acceleration Sensor for AIBO robots
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class AccelerationSensor extends Sensor config (USARBot);
+
+var vector lastVelocity;
+var float lastTime;
+
+function String GetData()
+{
+ local string outstring;
+ local vector vel;
+ local float time;
+ local vector accel;
+
+ vel = platform.Velocity;
+ time = Level.TimeSeconds;
+
+ accel = (vel - lastVelocity) / (time - lastTime);
+ accel = accel << platform.Rotation;
+
+ lastVelocity = vel;
+ lastTime = time;
+ if(converter != none)
+ accel = converter.VelocityVectorFromUU(accel);
+
+ outstring="{Name "$ItemName$"} {Acceleration "$accel.X$","$accel.Y$","$accel.Z$"}";
+
+ return outstring;
+}
+
+defaultproperties
+{
+ ItemType="Accel"
+}
Added: usarsim/USARBot/Classes/AckermanSteeredRobot.uc
===================================================================
--- usarsim/USARBot/Classes/AckermanSteeredRobot.uc (rev 0)
+++ usarsim/USARBot/Classes/AckermanSteeredRobot.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,227 @@
+class AckermanSteeredRobot extends GroundVehicle config(USARBot);
+
+// Structure to hold both the wheel index and the wheel's maximum steer angle
+struct SteerData
+{
+ var int WheelNumber;
+ var float maxSteer;
+};
+
+// Programming variables
+var float FrontSteerSpeed, RearSteerSpeed, FrontSteerTorque, RearSteerTorque;
+var float cachedVelocity, cachedFrontSteering, cachedRearSteering;
+var bool gotRobotInfo;
+var array<int> PoweredWheels;
+var array<SteerData> FrontSteerWheels, RearSteerWheels;
+
+function ProcessCarInput()
+{
+ local float InputVelocity,InputFrontSteering,InputRearSteering;
+ local bool isCommandNormalized, noNeedToUpdateSpeed, noNeedToUpdateFrontSteer, noNeedToUpdateRearSteer;
+ local int i;
+
+ // Variable Initialization
+ noNeedToUpdateSpeed = true;
+ noNeedToUpdateFrontSteer = true;
+ noNeedToUpdateRearSteer = true;
+
+ Super.ProcessCarInput();
+
+ // This section gets/sets various information about the robot (Note: this code only runs once)
+ if(!gotRobotInfo)
+ {
+ // Get information about the robot's wheels
+ for(i=0; i<Wheels.length; i++)
+ {
+ if(Wheels[i].PowerType == Left_Powered || Wheels[i].PowerType == Right_Powered) // Get all the powered wheels into a dynamic array
+ {
+ PoweredWheels.Insert(PoweredWheels.length, 1); // Make space in the dynamic array to add a powered wheel
+ PoweredWheels[PoweredWheels.length-1] = Wheels[i].Number; // Store the index number of the part in the dynamic array
+ }
+
+ if(Wheels[i].SteerType == Front_Steered) // Get all the front steered wheels into a dynamic array
+ {
+ FrontSteerWheels.Insert(FrontSteerWheels.length, 1); // Make space in the dynamic array to add a front-steered wheel
+ FrontSteerWheels[FrontSteerWheels.length-1].WheelNumber = Wheels[i].Number; // Store the index number of the part in the dynamic array
+ FrontSteerWheels[FrontSteerWheels.length-1].maxSteer = Wheels[i].MaxSteerAngle; // Store the maximum steering angle in the dynamic array
+
+ JointParts[Wheels[i].Number].bSteeringLocked = false; //Make sure the wheel is not locked (so that it can be steered)
+ }
+ else if(Wheels[i].SteerType == Rear_Steered) // Get all the rear steered wheels into a dynamic array
+ {
+ RearSteerWheels.Insert(RearSteerWheels.length, 1); // Make space in the dynamic array to add a rear-steered wheel
+ RearSteerWheels[RearSteerWheels.length-1].WheelNumber = Wheels[i].Number; // Store the index number of the part in the dynamic array
+ RearSteerWheels[RearSteerWheels.length-1].maxSteer = Wheels[i].MaxSteerAngle; // Store the maximum steering angle in the dynamic array
+
+ JointParts[Wheels[i].Number].bSteeringLocked = false; //Make sure the wheel is not locked (so that it can be steered)
+ }
+ else
+ {
+ JointParts[Wheels[i].Number].bSteeringLocked = true; //Make sure the wheel is locked (so that it cannot be steered)
+ }
+ }
+
+ // Initialize the controller's properties
+ USARRemoteBot(Controller).Normalized = false;
+ USARRemoteBot(Controller).Speed = 0.0;
+ USARRemoteBot(Controller).FrontSteer = 0.0;
+ USARRemoteBot(Controller).RearSteer = 0.0;
+
+ gotRobotInfo=true;
+
+ // Section used for debugging purposes to see if the correct joints have been saved in the dynamic arrays
+ if(bDebug)
+ {
+ for(i=0; i<PoweredWheels.Length; i++) Log("Powered Wheel #" $ i+1 $ ": " $ PoweredWheels[i]);
+
+ for(i=0; i<FrontSteerWheels.Length; i++) Log("Front Steered Wheel #" $ i+1 $ ": " $ FrontSteerWheels[i].WheelNumber);
+
+ for(i=0; i<RearSteerWheels.Length; i++) Log("Rear Steered Wheel #" $ i+1 $ ": " $ RearSteerWheels[i].WheelNumber);
+ }
+ }
+
+ // Here, we deal with the robot's movement
+ if (USARRemoteBot(Controller).bNewThrottle)
+ {
+ isCommandNormalized = USARRemoteBot(Controller).Normalized; // Get the Normalized value from the controller
+ InputVelocity = USARRemoteBot(Controller).Speed; // Get the wheel's spin speed value from the controller
+ InputFrontSteering = USARRemoteBot(Controller).FrontSteer; // Get the front steer value from the controller
+ InputRearSteering = USARRemoteBot(Controller).RearSteer; // Get the rear steer value from the controller
+
+ // If a normalized drive command was received (e.g. the speed value is between -100 and 100)
+ if (isCommandNormalized)
+ {
+ if(InputVelocity < -100) InputVelocity = Converter.SpinSpeedToUU(-maxSpinSpeed); // If the controller's value is less than -100, we use the negative of the robot's maximum spin speed
+ else if(InputVelocity > 100) InputVelocity = Converter.SpinSpeedToUU(maxSpinSpeed); // If the controller's value is more than 100, we use the robot's maximum spin speed
+ else InputVelocity = (InputVelocity/100) * Converter.SpinSpeedToUU(maxSpinSpeed); // If the controller's value is between -100 and 100, we use a percentage of the maximum spin speed
+ }
+ // If a non-normalized drive command was received (e.g. the speed is an absolute values, in radians per second)
+ else
+ {
+ if(InputVelocity < -maxSpinSpeed) InputVelocity = Converter.SpinSpeedToUU(-maxSpinSpeed); // If the controller's value is less than -(maxSpinSpeed), we use the negative of the robot's maximum spin speed
+ else if(InputVelocity > maxSpinSpeed) InputVelocity = Converter.SpinSpeedToUU(maxSpinSpeed); // If the controller's value is more than maxSpinSpeed, we use the robot's maximum spin speed
+ else InputVelocity = Converter.SpinSpeedToUU(InputVelocity); // Otherwise, we use the controller's value
+ }
+
+ // Here, we physically spin the appropriate wheels
+ if((PoweredWheels.length!=0) && (cachedVelocity != InputVelocity))
+ {
+ // Spin the appropriate wheels
+ for(i=0; i<PoweredWheels.length; i++)
+ {
+ setSpinSpeed(PoweredWheels[i], InputVelocity);
+ }
+
+ bNewCommand = true;
+ }
+
+ // Here, we turn the appropiate front-steered wheels, taking into account whether or not the drive command issued is normalized
+ if((FrontSteerWheels.length!=0) && (cachedFrontSteering != InputFrontSteering))
+ {
+ for(i=0; i<FrontSteerWheels.length; i++)
+ {
+ // If a normalized drive command was received (e.g. the front-steer value is between -100 and 100)
+ if (isCommandNormalized)
+ {
+ if(InputFrontSteering < -100) setAngle(FrontSteerWheels[i].WheelNumber,Converter.AngleToUU(-FrontSteerWheels[i].maxSteer));
+ else if(InputFrontSteering > 100) setAngle(FrontSteerWheels[i].WheelNumber,Converter.AngleToUU(FrontSteerWheels[i].maxSteer));
+ else setAngle(FrontSteerWheels[i].WheelNumber,((InputFrontSteering/100) * Converter.AngleToUU(FrontSteerWheels[i].maxSteer)));
+ }
+ // If a non-normalized drive command was received (e.g. the front-steer is an absolute values, in radians)
+ else
+ {
+ if(InputFrontSteering < -FrontSteerWheels[i].maxSteer) setAngle(FrontSteerWheels[i].WheelNumber,Converter.AngleToUU(-FrontSteerWheels[i].maxSteer));
+ else if(InputFrontSteering > FrontSteerWheels[i].maxSteer) setAngle(FrontSteerWheels[i].WheelNumber,Converter.AngleToUU(FrontSteerWheels[i].maxSteer));
+ else setAngle(FrontSteerWheels[i].WheelNumber,Converter.AngleToUU(InputFrontSteering));
+ }
+ }
+
+ bNewCommand = true;
+ }
+
+ // Here, we turn the appropiate rear-steered wheels, taking into account whether or not the drive command issued is normalized
+ if((RearSteerWheels.length!=0) && (cachedRearSteering!=InputRearSteering))
+ {
+ for(i=0; i<RearSteerWheels.length; i++)
+ {
+ // If a normalized drive command was received (e.g. the rear-steer value is between -100 and 100)
+ if (isCommandNormalized)
+ {
+ if(InputRearSteering < -100) setAngle(RearSteerWheels[i].WheelNumber,Converter.AngleToUU(-RearSteerWheels[i].maxSteer));
+ else if(InputRearSteering > 100) setAngle(RearSteerWheels[i].WheelNumber,Converter.AngleToUU(RearSteerWheels[i].maxSteer));
+ else setAngle(RearSteerWheels[i].WheelNumber,(InputRearSteering/100) * Converter.AngleToUU(RearSteerWheels[i].maxSteer));
+ }
+ // If a non-normalized drive command was received (e.g. the rear-steer is an absolute values, in radians)
+ else
+ {
+ if(InputRearSteering < -RearSteerWheels[i].maxSteer) setAngle(RearSteerWheels[i].WheelNumber,Converter.AngleToUU(-RearSteerWheels[i].maxSteer));
+ else if(InputRearSteering > RearSteerWheels[i].maxSteer) setAngle(RearSteerWheels[i].WheelNumber,Converter.AngleToUU(RearSteerWheels[i].maxSteer));
+ else setAngle(RearSteerWheels[i].WheelNumber,Converter.AngleToUU(InputRearSteering));
+ }
+ }
+
+ bNewCommand = true;
+ }
+
+ for(i=1; i<PoweredWheels.length; i++) noNeedToUpdateSpeed = noNeedToUpdateSpeed && (JointsControl[PoweredWheels[0]].value == JointsControl[PoweredWheels[i]].value);
+
+ for(i=1; i<FrontSteerWheels.length; i++) noNeedToUpdateFrontSteer = noNeedToUpdateFrontSteer && (JointsControl[FrontSteerWheels[0].WheelNumber].steer == JointsControl[FrontSteerWheels[i].WheelNumber].steer);
+
+ for(i=1; i<RearSteerWheels.length; i++) noNeedToUpdateRearSteer = noNeedToUpdateRearSteer && (JointsControl[RearSteerWheels[0].WheelNumber].steer == JointsControl[FrontSteerWheels[i].WheelNumber].steer);
+
+
+ if((PoweredWheels.length!=0) && noNeedToUpdateSpeed) cachedVelocity=JointsControl[PoweredWheels[0]].value;
+ else cachedVelocity=1000000; // a big value to force updating
+
+ if((FrontSteerWheels.length!=0) && noNeedToUpdateFrontSteer) cachedFrontSteering=JointsControl[FrontSteerWheels[0].WheelNumber].steer;
+ else cachedFrontSteering=1000000; // a big value to force updating
+
+ if((RearSteerWheels.length!=0) && noNeedToUpdateRearSteer) cachedRearSteering=JointsControl[RearSteerWheels[0].WheelNumber].steer;
+ else cachedRearSteering=1000000; // a big value to force updating
+
+ }
+}
+
+/*
+ Code which might be used to regulate the speed and torque of the steering
+*/
+/*
+simulated function Tick(float Delta)
+{
+ local KCarWheelJoint Joint;
+ local int i;
+
+ Super.Tick(Delta);
+
+ // Here, we set the steering speed and steering torque of the front wheels
+ for(i=0; i<FrontSteerWheels.Length; i++)
+ {
+ Joint=KCarWheelJoint(Joints[FrontSteerWheels[i].WheelNumber]);
+ Joint.KMaxSteerSpeed = FrontSteerSpeed;
+ Joint.KMaxSteerTorque = FrontSteerTorque;
+ Joint.KUpdateConstraintParams();
+ }
+
+ // Here, we set the steering speed and steering torque of the rear wheels
+ for(i=0; i<RearSteerWheels.Length; i++)
+ {
+ Joint=KCarWheelJoint(Joints[FrontSteerWheels[i].WheelNumber]);
+ Joint.KMaxSteerSpeed = RearSteerSpeed;
+ Joint.KMaxSteerTorque = RearSteerTorque;
+ Joint.KUpdateConstraintParams();
+ }
+}*/
+
+
+//*********************************************************************************************************************
+// DEFAULT PROPERTIES
+// DO NOT change these properties since they are used to initialize programming variables
+//*********************************************************************************************************************
+defaultproperties
+{
+ gotRobotInfo = false
+ FrontSteerSpeed = SteerSpeed
+ RearSteerSpeed = SteerSpeed
+ FrontSteerTorque = SteerTorque
+ RearSteerTorque = SteerTorque
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/Action_SetAnim.uc
===================================================================
--- usarsim/USARBot/Classes/Action_SetAnim.uc (rev 0)
+++ usarsim/USARBot/Classes/Action_SetAnim.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,34 @@
+/* PLEASE NOTE: This action will only work for Pawns extended from the VictimPawn class !! */
+
+class ACTION_SetAnim extends ScriptedAction;
+
+var(Action) name BaseAnim;
+
+function bool InitActionFor(ScriptedController C)
+{
+ // play appropriate animation
+ PawnPlayBaseAnim(C);
+ return false;
+}
+
+function bool PawnPlayBaseAnim(ScriptedController C)
+{
+ if ( BaseAnim == '' )
+ return false;
+
+ C.bControlAnimations = true;
+ VictimPawn(C.Pawn).SetAnimAction(BaseAnim);
+ return true;
+}
+
+function string GetActionString()
+{
+ return ActionString at BaseAnim;
+}
+
+defaultproperties
+{
+ ActionString="set animation"
+ bValidForTrigger=False
+}
+
Property changes on: usarsim/USARBot/Classes/Action_SetAnim.uc
___________________________________________________________________
Name: svn:executable
+
Added: usarsim/USARBot/Classes/AerialVehicle.uc
===================================================================
--- usarsim/USARBot/Classes/AerialVehicle.uc (rev 0)
+++ usarsim/USARBot/Classes/AerialVehicle.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,76 @@
+/*
+NOTE: The messages still need to be developed!
+*/
+
+class AerialVehicle extends KRobot config(USARBot);
+
+var float maxAltitudeVelocity, maxLinearVelocity, maxLateralVelocity, maxRotationalVelocity;
+
+function ProcessCarInput()
+{
+ Super.ProcessCarInput();
+
+ // Return robot GEO information
+ if(USARRemoteBot(Controller).GeoType == "Robot")
+ USARRemoteBot(Controller).myConnection.SendLine(getRobotGeo());
+
+ // Return robot CONF Information
+ if(USARRemoteBot(Controller).ConfType == "Robot")
+ USARRemoteBot(Controller).myConnection.SendLine(getRobotConf());
+}
+
+function timer()
+{
+ local string outstring;
+ local float time;
+
+ Super.timer();
+
+ time = Level.TimeSeconds;
+
+ outstring = "STA {Type AerialVehicle} {Time "$time$"}"$
+ " {LightToggle "$bHeadlightOn$"}"$
+ " {LightIntensity "$HeadlightItensity$"}"$
+ " {Battery "$(batteryLife-myLife)$"}"$
+ " {View "$ViewNum$"}";
+
+ USARRemoteBot(Controller).myConnection.SendLine(outstring);
+}
+
+function string getRobotGeo()
+{
+ local string tmpStr;
+
+ // This is all the information that we need to send out
+ local string geoType;
+ local string geoName;
+ local string geoDimensions;
+ local string geoCOG;
+
+ geoType = "AerialVehicle";
+ Divide(string(self.class), ".", tmpStr, geoName);
+ geoDimensions = converter.FloatString(Dimensions.X) $ "," $ converter.FloatString(Dimensions.Y) $ "," $ converter.FloatString(Dimensions.Z);
+ geoCOG = converter.Str_LengthFromUU(KarmaParamsRBFull(KParams).KCOMOffset.X * 50) $ "," $ converter.Str_LengthFromUU(KarmaParamsRBFull(KParams).KCOMOffset.Y * 50) $ "," $ converter.Str_LengthFromUU(KarmaParamsRBFull(KParams).KCOMOffset.Z * 50);
+
+ return "GEO {Type " $ geoType $ "} {Name " $ geoName $ "} {Dimensions " $ geoDimensions $ "} {COG " $ geoCOG $ "}";
+}
+
+function string getRobotConf()
+{
+ local string tmpStr;
+
+ // This is all the information that we need to send out
+ local string confType;
+ local string confName;
+ local string confSteeringType;
+ local string confMass;
+
+ confType = "AerialVehicle";
+ Divide(string(self.class), ".", tmpStr, confName);
+
+ if(ClassIsChildOf(self.Class,class'RotaryWingRobot')) confSteeringType = "RotaryWing";
+
+ confMass = converter.FloatString(Weight);
+
+ return "CONF {Type " $ confType $ "} {Name " $ confName $ "} {SteeringType " $ confSteeringType $ "} {Mass " $ confMass $ "}";
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/AirRobot.uc
===================================================================
--- usarsim/USARBot/Classes/AirRobot.uc (rev 0)
+++ usarsim/USARBot/Classes/AirRobot.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,41 @@
+class AirRobot extends RotaryWingRobot config(USARBot);
+
+//*********************************************************************************************************************
+// DEFAULT PROPERTIES
+//*********************************************************************************************************************
+defaultproperties
+{
+ StaticMesh=StaticMesh'USARSim_Vehicles_Meshes.AirRobot.AirRobotBody'
+ DrawScale=1
+
+ // Maximum velocities for the AirRobot
+ maxAltitudeVelocity = 5; // Maximum Up/Down (altitude) velocity, in meters/sec
+ maxLinearVelocity = 5; // Maximum Front/Back (tilt) velocity, in meters/sec
+ maxLateralVelocity = 5; // Maximum Left/Right (roll) velocity, in meters/sec
+ maxRotationalVelocity = 1.5708; // Maximum Rotational (yaw) velocity, in rads/sec
+
+ // Dimensions
+ Dimensions=(X=0.99968,Y=0.99934,Z=0.19382) // X=Length=0.99968m, Y=Width=0.99934m, Z=Height=0.19382m.
+
+ Begin Object Class=KarmaParamsRBFull Name=KParams0
+ KActorGravScale=2.58
+ KMaxAngularSpeed = 100
+ KMaxSpeed = 25000
+ KLinearDamping = 1
+ KAngularDamping = 20
+ KCOMOffset=(X=0.0108,Y=0.0102,Z=0.5)
+ KInertiaTensor(0)=0.0864 // ((0.99968/2)^2+(0.19382/2)^2)/3 = 0.0864. See Dimensions...
+ KInertiaTensor(3)=0.0864 // ((0.99934/2)^2+(0.19382/2)^2)/3 = 0.0864. See Dimensions...
+ KInertiaTensor(5)=0.1665 // ((0.99968/2)^2+(0.99934/2)^2)/3 = 0.1665. See Dimensions...
+ KStartEnabled=True
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKDoubleTickRate=True
+ bKStayUpright=False
+ bDestroyOnWorldPenetrate=True
+ bDoSafetime=True
+ KFriction=0.5
+ KImpactThreshold=700.000000
+ End Object
+ KParams=KarmaParamsRBFull'USARBot.AirRobot.KParams0'
+}
Added: usarsim/USARBot/Classes/AmbientSource.uc
===================================================================
--- usarsim/USARBot/Classes/AmbientSource.uc (rev 0)
+++ usarsim/USARBot/Classes/AmbientSource.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,85 @@
+// ============================================
+// The base class for all the ambient classes
+// ============================================
+class AmbientSource extends Actor
+ abstract placeable;
+
+// the name of the source, e.g. source1, source2 ...
+var() string SourceName;
+// the type of the source, e.g. gas
+var() string SourceType;
+
+// the converter class used by the game
+var() string ConverterClass;
+var USARConverter converter;
+
+// 1) create the converter and use it to convert the parameters
+// 2) register the source, so we can quickly and easily find the the sources
+// 3) disable the Bump and Touch event since ambient source are untouchable.
+event PreBeginPlay()
+{
+ local class<USARConverter> cClass;
+
+ cClass = class<USARConverter>(DynamicLoadObject(ConverterClass, class'Class'));
+ converter = new cClass;
+ ConvertParam(converter);
+
+ Register();
+
+ Disable('Bump');
+ Disable('Touch');
+}
+
+// Register to the game
+function Register()
+{
+ local USARDeathMatch UsarGame;
+ local int Index;
+
+ UsarGame = USARDeathMatch(Level.Game);
+ Index = UsarGame.Sources.length;
+ UsarGame.Sources.Insert(Index, 1);
+ UsarGame.Sources[Index] = self;
+}
+
+// Unregister from the game
+function Unregister()
+{
+ local USARDeathMatch UsarGame;
+ local int i;
+
+ UsarGame = USARDeathMatch(Level.Game);
+ for (i = 0; i < UsarGame.Sources.length; i++) {
+ if (UsarGame.Sources[i] == self) {
+ UsarGame.Sources.Remove(i, 1);
+ break;
+ }
+ }
+}
+
+function ConvertParam(USARConverter converter)
+{
+}
+
+function bool isType(String type)
+{
+ return (Caps(SourceType)==Caps(type));
+}
+
+function bool isName(String name)
+{
+ return (Caps(SourceName)==Caps(name));
+}
+
+event Destroyed()
+{
+ Unregister();
+}
+
+defaultproperties
+{
+ RemoteRole=ROLE_None
+ bHidden=True
+ ConverterClass="USARBot.USARConverter"
+ Texture=Texture'Engine.S_LookTarget'
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/BallHSensor.uc
===================================================================
--- usarsim/USARBot/Classes/BallHSensor.uc (rev 0)
+++ usarsim/USARBot/Classes/BallHSensor.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,259 @@
+/* Ball Helper Sensor for AIBO robots
+ * It locates the ball in 3D, calculates its 2D position on the screen
+ * and its radius in pixels, reports distance of the ball center from
+ * the camera and if it's visible or not. It also calculates ball occlusions
+ * by sampling ball outline and checking the visibility of each sample.
+ * This test is called "corona test" and reports to the controller a
+ * number that codes in each bit the corresponding sample visibility.
+ * The corona is always aligned with the Y axis of the screen and it
+ * adapts to perspective distortions of the ball.
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class BallHSensor extends Sensor config(USARBot);
+
+const RAD2DEG = 57.2957795;
+
+//Cameras in USARSim hove no resolution information
+//so I'm hardwiring here AIBO cam resolution. This
+//should be changed in the future.
+var config int CameraXres;
+var config int CameraYres;
+var config float BallRadiusUU;
+var config byte BallSamples;
+var array<vector> CoronaSamples;
+var config float LODhalf, LODcenter;
+var int uuLODhalf, uuLODcenter;
+var Soccerball KBall;
+
+function PostNetBeginPlay()
+{
+ local float CoronaStep;
+ local float CoronaTime;
+ local int i;
+
+ Super.PostNetBeginPlay();
+
+ //Take a reference to the ball
+ if(Role == ROLE_Authority)
+ foreach AllActors(class'SoccerBall',KBall) break;
+
+ if(KBall != none)
+ {
+ if((BallSamples % 2) != 0)
+ BallSamples++;
+ CoronaSamples.Insert(0,BallSamples);
+ CoronaStep = 2*PI / BallSamples;
+
+ //Counter-Clockwise circle from noon + CoronaStep
+ //This allows to get a clockwise (from noon) corona coding
+ for(i=0; i < BallSamples; i++)
+ {
+ CoronaTime = PI/2 + CoronaStep * (i+1);
+ CoronaSamples[i].Y = BallRadiusUU * Cos(CoronaTime);
+ CoronaSamples[i].Z = BallRadiusUU * Sin(CoronaTime);
+ }
+ }
+}
+
+function ConvertParam(USARConverter converter)
+{
+ if (converter!=NONE)
+ {
+ uuLODhalf = converter.LengthToUU(LODhalf);
+ uuLODcenter = converter.LengthToUU(LODcenter);
+ }
+ else
+ {
+ uuLODhalf = LODhalf;
+ uuLODcenter = LODcenter;
+ }
+}
+
+function String GetData()
+{
+ local string outstring, visStr;
+ //BallCamDir is the vector pointing from the camera to the ball
+ //BallCamPos is the ball position in camera coordinates
+ local vector BallPos, CamLoc, BallCamDir, BallCamPos;
+ local rotator CamRot;
+ local float ballDist;
+ local int x2d,y2d,r; //2D X and Y positions, r = ball radius in pixel
+ local int x2dMod, y2dMod; //x2d and y2d ABS values
+ local int halfResX, halfResY;
+ local byte outerZone; // bits string used to compute ball zone
+ local float K, K1, cornerRadius;
+ local bool visible; //TRUE if the ball is visible
+ local int i;
+ //Occlusione testing variables
+ local Actor HitObj;
+ local vector HitLoc, HitNorm;
+ local int HiddenCount, CoronaCode, DoubleCode;
+ local vector CoronaSample, CoronaCamDir;
+
+ if(KBall != none)
+ {
+ BallPos = KBall.Location;
+ CamLoc = Location; //This sensor should be attached at the same camera position
+ CamRot = Rotation; //This sensor should be attached at the same camera position
+ BallCamDir = BallPos - CamLoc;
+
+ //We're going into camera coordinates (inverse transform)
+ BallCamPos = BallCamDir << CamRot;
+
+ //if < 0 than the ball is behind the AIBO and is not visible
+ if(BallCamPos.X > 0)
+ {
+ ballDist = VSize(BallCamPos);
+
+ halfResX = CameraXres/2;
+ halfResY = CameraYres/2;
+
+ //Computes perspective transformation constant
+ K = float(halfResX)/(Tan(KRobot(Platform).CameraZoom[0]/(2*RAD2DEG)));
+ K1= K / BallCamPos.X;
+ //Make perspective transformation
+ x2dMod = int(K1 * BallCamPos.Y);
+ y2dMod = int(K1 * BallCamPos.Z);
+
+ //(0,0) is up left
+ x2d =halfResX + x2dMod;
+ y2d =halfResY - y2dMod;
+
+ //find ball radius in pixels
+ r = int(K1 * BallRadiusUU);
+
+ //Take 2D position ABS value
+ if(x2dMod < 0)
+ x2dMod = -x2dMod;
+ if(y2dMod < 0 )
+ y2dMod = -y2dMod;
+
+ //Determine ball zone with a bit mapping
+ if(x2dMod > halfResX)
+ outerZone = 1;
+ if(y2dMod > halfResY)
+ outerZone = outerZone | 2;
+
+ //Check visibility
+ switch(outerZone)
+ {
+ case 0: //center visible
+ visible = true;
+ break;
+ case 1: //center Right
+ if(x2dMod < (halfResX + r))
+ visible = true;
+ break;
+ case 2: //center Down
+ if(y2dMod < (halfResY + r))
+ visible = true;
+ break;
+ case 3: //center at Corner
+ cornerRadius = Square(x2dMod - halfResX) + Square(y2dMod - halfResY);
+ if(cornerRadius < r*r)
+ visible = true;
+ }
+ }
+
+ //Now we do occlusion test
+ if(visible)
+ {
+ //Manages LODcenter (ball very far)
+ if(ballDist > uuLODcenter)
+ {
+ //*5 in start vector is used to avoid self-collision with AIBO head
+ BallCamDir = Normal(BallCamDir);
+ HitObj = Trace(HitLoc, HitNorm, BallPos, CamLoc + BallCamDir*5,true);
+ if(HitObj.IsA('SoccerBall'))
+ CoronaCode = 2**BallSamples -1;
+ else
+ visible = false;
+ }
+ //Manages LODhalf or ball near
+ else
+ {
+ //*5 in start vector is used to avoid self-collision with AIBO head
+ //BallCamDir = Normal(BallCamDir);
+ for(i=0; i < BallSamples; i++)
+ {
+ //Assumes the sample is visible
+ CoronaCode = CoronaCode << 1;
+ CoronaCode = CoronaCode | 1;
+
+ //Align the corona to Y axis of the screen.
+ //That means that we build the corona around the ball
+ //in local camera coordinates. Then we transform these
+ //coordinates in world reference (see later).
+ //Local transform:
+ CoronaSample = CoronaSamples[i] >> rotator(BallCamPos);
+ CoronaSample += BallCamPos;
+
+ //Check sample visibility (I'm recycling x2dMod and y2dMod vars)
+ x2dMod = int(K * CoronaSample.Y / CoronaSample.X);
+ y2dMod = int(K * CoronaSample.Z / CoronaSample.X);
+ if((x2dMod < -halfResX || x2dMod > halfResX) || (y2dMod < -halfResY || y2dMod > halfResY))
+ {
+ HiddenCount++;
+ CoronaCode = CoronaCode ^ 1; //XOR
+ }
+ else //If sample is visible check collisions
+ {
+ //Corona transformed in World reference
+ CoronaSample = CoronaSample >> CamRot;
+ CoronaSample += CamLoc;
+
+ //Avoids collisions with ground (Trace() ray hits the ground)
+ //TODO: This control assumes that the ball is always at Z >= 0
+ // A more general solutions should be implemented.
+ if(CoronaSample.Z < 0)
+ CoronaSample.Z = -CoronaSample.Z;
+
+ //Make collision test for current sample
+ CoronaCamDir = Normal(CoronaSample - CamLoc);
+ HitObj = Trace(HitLoc, HitNorm, CoronaSample, CamLoc + CoronaCamDir*5,true);
+ if(HitObj != none)
+ if(!HitObj.IsA('SoccerBall'))
+ {
+ CoronaCode = CoronaCode ^ 1; //XOR
+ HiddenCount++;
+ }
+ }
+
+ //Manages LODhalf
+ if(ballDist > uuLODhalf)
+ {
+ i++;
+ DoubleCode = CoronaCode & 1;
+ if(DoubleCode == 0)
+ HiddenCount++;
+ CoronaCode = CoronaCode << 1;
+ CoronaCode = CoronaCode | DoubleCode;
+ }
+ }
+
+ if(HiddenCount == BallSamples)
+ visible = false;
+ }
+ }// end of occlusione test
+
+ //OK, at last we're ready to build output string
+ if(visible)
+ visStr="}{Visible true}{Pos2D "$x2d$","$y2d$"}{Radius "$r$"}{Dist "$converter.Str_LengthFromUU(ballDist)$"}{Corona "$CoronaCode$"}";
+ else
+ visStr="}{Visible false}{Pos2D 0,0}{Radius 0}{Dist 0}{Corona 0}";
+
+ outstring="{Name "$ItemName$"}"$"{Pos3D "$converter.Str_LengthVectorFromUU(BallPos)$visStr;
+ }
+ return outstring;
+}
+
+defaultproperties
+{
+ ItemType="Helper"
+ CameraXres=208 //pixel
+ CameraYres=160 //pixel
+ BallRadiusUU=10 //unreal units
+ BallSamples=12 //Corona samples for occlusion test (must be an even number)
+ LODhalf=0.8 //meter, distance at which halve corona samples
+ LODcenter=2 //meter, distance at which consider only ball center
+}
Added: usarsim/USARBot/Classes/CO2Sensor.uc
===================================================================
--- usarsim/USARBot/Classes/CO2Sensor.uc (rev 0)
+++ usarsim/USARBot/Classes/CO2Sensor.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,18 @@
+// ===============================================================
+// USARBot.CO2Sensor
+//
+// The Carbon Dioxide detector
+// ref: http://www.citytech.com/PDF-Datasheets/ircelco2.pdf
+// ===============================================================
+
+class CO2Sensor extends GasSensor config(USARBot);
+
+defaultproperties
+{
+ GasType="CO2"
+ ItemType="CO2Sensor"
+ ValidRange=(Min=0,Max=2) // Detecting range 0~2%
+ Noise=0.0005 // 0.05%
+ Resoluation=0.0001 // 0.01%
+ OutputCurve=(Points=((InVal=0.0,OutVal=0.0),(InVal=100,OutVal=100)))
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/COSensor.uc
===================================================================
--- usarsim/USARBot/Classes/COSensor.uc (rev 0)
+++ usarsim/USARBot/Classes/COSensor.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,18 @@
+// ===============================================================
+// USARBot.COSensor
+//
+// The Carbon Monoxide detector
+// ref: http://www.citytech.com/PDF-Datasheets/cap07.pdf
+// ===============================================================
+
+class COSensor extends GasSensor config(USARBot);
+
+defaultproperties
+{
+ GasType="CO"
+ ItemType="COSensor"
+ ValidRange=(Min=0,Max=0.0004) // Detecting range 0~400ppm
+ Noise=0.002 // 2%
+ Resoluation=0.000004 // 4 ppm
+ OutputCurve=(Points=((InVal=0.0,OutVal=0.04),(InVal=100,OutVal=100)))
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/ComStation.uc
===================================================================
--- usarsim/USARBot/Classes/ComStation.uc (rev 0)
+++ usarsim/USARBot/Classes/ComStation.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,50 @@
+class ComStation extends KRobot config(USARBot);
+
+// Programming Variable
+var bool init;
+
+function ProcessCarInput()
+{
+ // Here, we get the radar to continously spin
+ if(!init)
+ {
+ USARRemoteBot(Controller).JName[USARRemoteBot(Controller).JointControlIdx] = "Radar";
+ USARRemoteBot(Controller).JOrder[USARRemoteBot(Controller).JointControlIdx] = 1;
+ USARRemoteBot(Controller).JValue[USARRemoteBot(Controller).JointControlIdx] = converter.SpinSpeedToUU(3);
+ USARRemoteBot(Controller).JointControlIdx++;
+ init=true;
+ }
+
+ Super.ProcessCarInput();
+}
+
+//*********************************************************************************************************************
+// DEFAULT PROPERTIES
+//*********************************************************************************************************************
+defaultproperties
+{
+ StaticMesh=StaticMesh'USARSim_Objects_Meshes.ComStation.ComBuilding'
+ DrawScale=1
+ init=false
+
+ Begin Object Class=KarmaParamsRBFull Name=KParams0
+ KActorGravScale=2.58
+ bKNonSphericalInertia=True
+ KInertiaTensor(0)=5
+ KInertiaTensor(3)=5
+ KInertiaTensor(5)=5
+ KCOMOffset=(X=0.0,Y=0.0,Z=0.0)
+ KLinearDamping=0
+ KAngularDamping=10000
+ KMaxAngularSpeed=0
+ KMaxSpeed=25000
+ KStartEnabled=True
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKDoubleTickRate=True
+ KFriction=0.9
+ bKStayUpright=True
+ Name="KParams0"
+ End Object
+ KParams=KarmaParamsRBFull'USARBot.ComStation.KParams0'
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/ControlSurface.uc
===================================================================
--- usarsim/USARBot/Classes/ControlSurface.uc (rev 0)
+++ usarsim/USARBot/Classes/ControlSurface.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,21 @@
+class ControlSurface extends USARTire;
+
+var float maxAngle;
+var float Area;
+
+defaultproperties
+{
+ Begin Object Class=KarmaParamsRBFull Name=KParams0
+ KMass=0.00
+ KActorGravScale=0.00
+ KInertiaTensor(0)=1.800000
+ KInertiaTensor(3)=1.800000
+ KInertiaTensor(5)=1.800000
+ KLinearDamping=0.000000
+ KAngularDamping=0.000000
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKDoubleTickRate=True
+ End Object
+ KParams=KarmaParamsRBFull'USARBot.ControlSurface.KParams0'
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/Cooper.uc
===================================================================
--- usarsim/USARBot/Classes/Cooper.uc (rev 0)
+++ usarsim/USARBot/Classes/Cooper.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,83 @@
+class Cooper extends AckermanSteeredRobot config(USARBot);
+
+//*********************************************************************************************************************
+// DEFAULT PROPERTIES
+//*********************************************************************************************************************
+defaultproperties
+{
+ //---Wheel information. Since the Cooper has four wheels, we have four of these definitions
+ // The next four definitions will create a front-wheel-drive Cooper where the two front wheels can be steered with a maximum of 35 degrees
+
+ // Number=0 indicates that this wheel is the first JointPart defined in USARBot.ini (ORDER MATTERS!)
+ // Power=Left_Powered tells USARSim to spin this wheel (for ackerman-steered vehicles, there is no difference between Left_Powered and Right_Powered)
+ // SteerType=Front_Steered tells USARSim to steer this wheel with the "FrontSteer" variable from the DRIVE command
+ // MaxSteerAngle=0.610865 makes this wheel have a maximum turn angle between -35 degrees and +35 degrees (0.61086 radian = 35 degrees)
+ Wheels(0)=(Number=0,PowerType=Left_Powered,SteerType=Front_Steered,MaxSteerAngle=0.610865);
+
+ // 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 (for ackerman-steered vehicles, there is no difference between Left_Powered and Right_Powered)
+ // SteerType=Front_Steered tells USARSim to steer this wheel with the "FrontSteer" variable from the DRIVE command
+ // MaxSteerAngle=0.610865 makes this wheel have a maximum turn angle between -35 degrees to +35 degrees (0.61086 radian = 35 degrees)
+ Wheels(1)=(Number=1,PowerType=Left_Powered,SteerType=Front_Steered,MaxSteerAngle=0.610865);
+
+ // Number=2 indicates that this wheel is the third JointPart defined in USARBot.ini (ORDER MATTERS!)
+ // Power=Not_Powered tells USARSim to NOT power this wheel: the wheel spins freely, without being driven by a motor
+ // Note that since the variables SteerType and MaxSteerAngle are not defined, this wheel is not steered (steering is locked)
+ Wheels(2)=(Number=2,PowerType=Not_Powered);
+
+ // Number=3 indicates that this wheel is the fourth JointPart defined in USARBot.ini (ORDER MATTERS!)
+ // Power=Not_Powered tells USARSim to NOT power this wheel: the wheel spins freely, without being driven by a motor
+ // Note that since the variables SteerType and MaxSteerAngle are not defined, this wheel is not steered (steering is locked)
+ Wheels(3)=(Number=3,PowerType=Not_Powered);
+ //---
+
+ //--Other Robot's Properties
+ StaticMesh=StaticMesh'USARSim_Vehicles_Meshes.Cooper.CooperBody'
+ DrawScale=1.00
+
+ // Configuration Parameters. Note: these variables need to be correspond to your robot's model.
+ //WheelRadius=0.3727 // Wheel Radius, in unreal units. Note: Value is in meters
+ //Dimensions=(X=3.686,Y=1.799,Z=2.059) // X=Length=3.686m, Y=Width=1.799m, Z=Height=2.059m
+ maxSpinSpeed=100 // Maximum wheel's spin speed is 100 rad/sec = 134.172 kph = 83.37 mph
+
+ bDebug=false
+ DrawScale3D=(X=1.0,Y=1.0,Z=1.0)
+ ChassisMass=1
+
+ MaxTorque=60.0
+ MotorTorque=20.0
+ MotorSpeed=0.1745 // rad per second
+
+ // Properties related to the steering of the hummer
+ SteerPropGap=1000.000000
+ SteerTorque=1000.000000
+ SteerSpeed=15000.000000
+
+ TireRollFriction=15.000000
+ TireLateralFriction=15.000000
+ TireRollSlip=0.0600
+ TireLateralSlip=0.0600000
+ TireMinSlip=0.001000
+ TireSlipRate=0.00100000
+ TireSoftness=0.000020
+ TireAdhesion=0.000000
+ TireRestitution=0.000000
+
+ Begin Object Class=KarmaParamsRBFull Name=KParams0
+ KInertiaTensor(0)=0.10000
+ KInertiaTensor(3)=0.20000
+ KInertiaTensor(5)=0.4000
+ KCOMOffset=(X=0,Y=0,Z=-0.5)
+ KLinearDamping=0.500000
+ KAngularDamping=100.00000
+ KStartEnabled=True
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKDoubleTickRate=True
+ KFriction=1.600000
+ Name="KParams0"
+ KMaxSpeed=10000
+ End Object
+ KParams=KarmaParamsRBFull'USARBot.Cooper.KParams0'
+ //---
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/ERS.uc
===================================================================
--- usarsim/USARBot/Classes/ERS.uc (rev 0)
+++ usarsim/USARBot/Classes/ERS.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,96 @@
+/* AIBO robot
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class ERS extends LeggedRobot config(USARBot);
+
+var int loAngleLimit[15];
+var int hiAngleLimit[15];
+
+function ProcessCarInput()
+{
+ local int nJoints;
+
+ Super.ProcessCarInput();
+
+ //Limit joints order 0 angles
+ for(nJoints=0; nJoints < JointsControl.length; nJoints++)
+ if((JointsControl[nJoints].state == 1) && (JointsControl[nJoints].order == 0))
+ {
+ if(JointsControl[nJoints].value < loAngleLimit[nJoints])
+ {
+ JointsControl[nJoints].value = loAngleLimit[nJoints];
+ continue;
+ }
+ if(JointsControl[nJoints].value > hiAngleLimit[nJoints])
+ JointsControl[nJoints].value = hiAngleLimit[nJoints];
+ }
+}
+
+defaultproperties
+{
+ DrawScale=1
+ bDebug=false
+ MaxNetUpdateInterval=0.5
+
+ //Low Joint Angle Limits
+ loAngleLimit(0)=-21845
+ loAngleLimit(1)=-2730
+ loAngleLimit(2)=-5461
+ loAngleLimit(3)=-24576
+ loAngleLimit(4)=-2730
+ loAngleLimit(5)=-5461
+ loAngleLimit(6)=-21845
+ loAngleLimit(7)=-2730
+ loAngleLimit(8)=-5461
+ loAngleLimit(9)=-24576
+ loAngleLimit(10)=-2730
+ loAngleLimit(11)=-5461
+ loAngleLimit(12)=-14563
+ loAngleLimit(13)=-16930
+ loAngleLimit(14)=-3640
+ //High Joint Angle Limits
+ hiAngleLimit(0)=24576
+ hiAngleLimit(1)=16930
+ hiAngleLimit(2)=23119
+ hiAngleLimit(3)=21845
+ hiAngleLimit(4)=16930
+ hiAngleLimit(5)=23119
+ hiAngleLimit(6)=24576
+ hiAngleLimit(7)=16930
+ hiAngleLimit(8)=23119
+ hiAngleLimit(9)=21845
+ hiAngleLimit(10)=16930
+ hiAngleLimit(11)=23119
+ hiAngleLimit(12)=546
+ hiAngleLimit(13)=16930
+ hiAngleLimit(14)=9102
+
+ StaticMesh=StaticMesh'USARSim_LeggedRobots_Meshes.ERS7.ERS7Body'
+
+ //Parameters of chassis. (KMass is defined in USAR.INI)
+ Begin Object Class=KarmaParams Name=KParams0
+ KStartEnabled=True
+ bKDoubleTickRate=True
+ bHighDetailOnly=False
+ bClientOnly=False
+ bKNonSphericalInertia=true
+ KActorGravScale=2.58
+//Uncomment and define these when using RBfull karma params
+// KInertiaTensor(0)=0.4
+// KInertiaTensor(1)=0
+// KInertiaTensor(2)=0
+// KInertiaTensor(3)=0.4
+// KInertiaTensor(4)=0
+// KInertiaTensor(5)=0.4
+// KCOMOffset=(X=0.0,Y=0.0,Z=0.0)
+ KMaxAngularSpeed=100
+ KMaxSpeed=25000
+ KLinearDamping=0.0
+ KAngularDamping=0.0
+ KFriction=0.8
+ KRestitution=0.0
+ Name="KParams0"
+ End Object
+ KParams=KarmaParams'KParams0'
+
+}
Added: usarsim/USARBot/Classes/ERSirEdge.uc
===================================================================
--- usarsim/USARBot/Classes/ERSirEdge.uc (rev 0)
+++ usarsim/USARBot/Classes/ERSirEdge.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,26 @@
+/* Far IR Sensor for AIBO robots
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+
+class ERSirEdge extends IR2Sensor config (USARBot);
+
+function String GetData()
+{
+ local float range;
+ local string outstring;
+
+ range = GetRange() + 0.0179; //Distance Compensation
+ curRot=Rotation;
+ outstring="{Name "$ItemName$" Range "$converter.FloatString(range)$"}";
+ return outstring;
+}
+
+defaultproperties
+{
+ HiddenSensor=true
+ MaxRange=1.5 //1.5m
+ MinRange=0
+ OutputCurve=(Points=((InVal=0,OutVal=0.0021),(InVal=0.0021,OutVal=0.0021),(InVal=1.5,OutVal=1.5)))
+ OutputNoise=(Points=((InVal=0,OutVal=0),(InVal=1.5,OutVal=0.1)))
+}
+
Added: usarsim/USARBot/Classes/ERSirFar.uc
===================================================================
--- usarsim/USARBot/Classes/ERSirFar.uc (rev 0)
+++ usarsim/USARBot/Classes/ERSirFar.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,14 @@
+/* Far IR Sensor for AIBO robots
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class ERSirFar extends IR2Sensor config (USARBot);
+
+defaultproperties
+{
+ HiddenSensor=true
+ MaxRange=1.5 //1.5m
+ MinRange=0
+ OutputCurve=(Points=((InVal=0,OutVal=0.2),(InVal=0.2,OutVal=0.2),(InVal=1.5,OutVal=1.5)))
+ OutputNoise=(Points=((InVal=0,OutVal=0),(InVal=0.2,OutVal=0),(InVal=0.85,OutVal=0.1),(InVal=1.5,OutVal=0)))
+}
+
Added: usarsim/USARBot/Classes/ERSirNear.uc
===================================================================
--- usarsim/USARBot/Classes/ERSirNear.uc (rev 0)
+++ usarsim/USARBot/Classes/ERSirNear.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,13 @@
+/* Near IR Sensor for AIBO robots
+ * by Marco Zaratti - marco.zaratti at gmail.com
+*/
+class ERSirNear extends IR2Sensor config (USARBot);
+
+defaultproperties
+{
+ HiddenSensor=true
+ MaxRange=0.5 //0.5m
+ MinRange=0
+ OutputCurve=(Points=((InVal=0,OutVal=0.05),(InVal=0.05,OutVal=0.05),(InVal=0.5,OutVal=0.5)))
+ OutputNoise=(Points=((InVal=0,OutVal=0),(InVal=0.05,OutVal=0),(InVal=0.276,OutVal=0.1),(InVal=0.5,OutVal=0)))
+}
Added: usarsim/USARBot/Classes/ERSpaw.uc
===================================================================
--- usarsim/USARBot/Classes/ERSpaw.uc (rev 0)
+++ usarsim/USARBot/Classes/ERSpaw.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////
+// Simple Touch sensor for AIBO paws based on RangeSensor
+// Mapping:
+// Contact = true if (0 < range <= MaxRange)
+// Contact = false if (range > MaxRange)
+//
+// by Marco Zaratti - marco.zaratti at gmail.com
+///////////////////////////////////////////////////////////////////////////
+
+class ERSpaw extends RangeSensor config (USARBot);
+
+function ConvertParam(USARConverter converter)
+{
+ if (converter!=NONE) {
+ uuMaxRange = converter.LengthToUU(MaxRange);
+ uuMinRange = converter.LengthToUU(MinRange);
+ }
+ else {
+ uuMaxRange = MaxRange;
+ uuMinRange = MinRange;
+ }
+}
+
+function float GetRange()
+{
+ local vector HitLocation,HitNormal;
+ local float range;
+
+ if (Trace(HitLocation, HitNormal, Location + uuMaxRange*vector(curRot), Location, true)==NONE)
+ return 0;
+ else
+ {
+ range = VSize(HitLocation-Location);
+ if (converter!=None)
+ range=converter.LengthFromUU(range);
+ }
+
+ if (range <= MaxRange)
+ return 1;
+
+ return 0;
+}
+
+function String GetData()
+{
+ local string outstring;
+ curRot=Rotation;
+ if(GetRange() > 0)
+ outstring="{Name "$ItemName$" Touch true}";
+ else
+ outstring="{Name "$ItemName$" Touch false}";
+ return outstring;
+}
+
+defaultproperties
+{
+ bUseGroup=True
+ ItemType="Touch"
+ MaxRange=0.0248 //2.48cm
+ MinRange=0
+}
Added: usarsim/USARBot/Classes/Effecter.uc
===================================================================
--- usarsim/USARBot/Classes/Effecter.uc (rev 0)
+++ usarsim/USARBot/Classes/Effecter.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,43 @@
+class Effecter extends Item abstract;
+
+function String GetConfHead()
+{
+ local string outstring;
+
+ outstring="CONF {Type "$ItemType$"}";
+
+ return outstring;
+}
+
+function String GetConfData()
+{
+ return "{Name "$ItemName$"}";
+}
+
+function string GetGeoHead()
+{
+ local string outstring;
+
+ outstring="GEO {Type "$ItemType$"}";
+
+ return outstring;
+}
+
+function string GetGeoData()
+{
+ local string outstring;
+
+ if (converter==None)
+ outstring="{Name "$ItemName$" Location "$(Location-Base.Location)$" Orientation "$(Rotation-Base.Rotation)$" Mount "$ItemMount$"}";
+ else
+ outstring="{Name "$ItemName$" Location "$(converter.Str_LengthVectorFromUU(Location-Base.Location))
+ $" Orientation "$(converter.Str_RotatorFromUU(Rotation-Base.Rotation))
+ $" Mount "$ItemMount$"}";
+ return outstring;
+}
+
+defaultproperties
+{
+ ItemType="Effecter"
+ bHidden=true
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/EncoderSensor.uc
===================================================================
--- usarsim/USARBot/Classes/EncoderSensor.uc (rev 0)
+++ usarsim/USARBot/Classes/EncoderSensor.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,173 @@
+class EncoderSensor extends sensor config (USARBot);
+
+/**
+ This class simulates the encoder sensor.
+
+ The added config params are:
+ Resolution: The resoulution of the encoder defined in UU.
+
+ The returned value is:
+ Tick: The data range is (-65535/uuResolution)~(65535/uuResolution).
+ Positive value means clockwise direction. It's the controller's
+ resposible to count how many circles the part has rotated.
+*/
+
+var USARRemoteBot rBot;
+
+var config float Resolution;
+
+var int uuResolution;
+var string tickData;
+var int myTick;
+var vector axis1,axis2;
+var int lastAng, curAng;
+var int lastBaseAng, curBaseAng;
+var float totalAng, myAng, baseAng;
+var Actor parBase;
+
+function Init(String SName, Actor parent, vector position, rotator direction, KVehicle platform, name mount)
+{
+ Super.Init(SName, parent, position, direction, platform, mount);
+
+ axis1 = vector(direction); // the turning axis
+ axis2 = vector(direction+rot(16384,0,0));
+
+ if (parent.Owner!=None)
+ parBase = parent.Owner;
+ else if (parent.Base!=None)
+ parBase = parent.Base;
+ else
+ parBase = None;
+}
+
+function ConvertParam(USARConverter converter)
+{
+ if (converter!=None)
+ uuResolution = converter.AngleToUU(Resolution);
+ else
+ uuResolution = Resolution;
+}
+
+function int getTick()
+{
+ local vector newAxis1,newAxis2,lastAxis;
+ local Quat relQ, curQ;
+ local float difAng,difCos,difSign;
+
+ // my angle
+ curQ = base.KGetRBQuaternion();
+ newAxis1 = QuatRotateVector(curQ,axis1);
+ newAxis2 = QuatRotateVector(curQ,axis2);
+
+ relQ = QuatFindBetween(newAxis1,axis1);
+ lastAxis = QuatRotateVector(relQ,newAxis2);
+
+ difCos = lastAxis Dot axis2;
+ difCos = int((difCos*10000+5))/10000.0;
+ if (difCos>1.0) difCos = 1.0;
+ if (difCos<-1.0) difCos = -1.0;
+
+ difSign = (lastAxis Cross axis2) Dot axis1;
+ if (difSign<0) difSign=-1.0;
+ else difSign=1.0;
+
+ curAng = difSign * ACos(difCos)*32768/PI;
+ difAng = curAng - lastAng;
+ lastAng = curAng;
+ if (difAng>=32768)
+ difAng = difAng - 65535;
+ else if (difAng<-32768)
+ difAng = difAng + 65535;
+
+ myAng += difAng;
+
+ // base's angle
+ if (parBase!=None) {
+ curQ = parBase.KGetRBQuaternion();
+ newAxis1 = QuatRotateVector(curQ,axis1);
+ newAxis2 = QuatRotateVector(curQ,axis2);
+
+ relQ = QuatFindBetween(newAxis1,axis1);
+ lastAxis = QuatRotateVector(relQ,newAxis2);
+
+ difCos = lastAxis Dot axis2;
+ difCos = int((difCos*10000+5))/10000.0;
+ if (difCos>1.0) difCos = 1.0;
+ if (difCos<-1.0) difCos = -1.0;
+
+ difSign = (lastAxis Cross axis2) Dot axis1;
+ if (difSign<0) difSign=-1.0;
+ else difSign=1.0;
+
+ curBaseAng = difSign * ACos(difCos)*32768/PI;
+ difAng = curBaseAng - lastBaseAng;
+ lastBaseAng = curBaseAng;
+ if (difAng>=32768)
+ difAng = difAng - 65535;
+ else if (difAng<-32768)
+ difAng = difAng + 65535;
+
+ baseAng += difAng;
+}
+
+ totalAng = normalAngle(myAng - baseAng);
+ if (totalAng!=(myAng - baseAng)) {
+ myAng = normalAngle(myAng);
+ baseAng = normalAngle(baseAng);
+ }
+
+ //log(ItemName@"dif:"$myAng at baseAng@totalAng at base.Rotation@base.Owner.Rotation);
+
+ totalAng += RandRange(-Noise, Noise)*totalAng;
+ myTick = int(normalAngle(totalAng)/uuResolution);
+ return myTick;
+}
+
+function float normalAngle(float ang) {
+ if (ang>65536) ang-=65536;
+ if (ang<-65536) ang+=65536;
+ return ang;
+}
+
+function string Set(String opcode, String args)
+{
+ if(Caps(opcode)=="RESET") {
+ myAng = 0;
+ baseAng = 0;
+ totalAng = 0;
+ myTick = 0;
+ return "OK";
+ }
+ return "Failed";
+ }
+
+function String GetData()
+{
+ local string outstring;
+
+ outstring = "{Name "$ItemName$" Tick "$getTick()$"}";
+
+ return outstring;
+}
+
+function String GetConfData()
+{
+ local string outstring;
+ outstring = Super.GetConfData();
+ outstring = outstring@"{Resolution "$converter.FloatString(Resolution)$"}";
+ return outstring;
+}
+
+defaultproperties
+{
+//Scaled with 4.762 at Mon Sep 25 14:21:52 EDT 2006
+ bUseGroup=True
+ ItemType="Encoder"
+ HiddenSensor=false
+ Resolution=0.01745 // in rad. It equals 1 deg
+ DrawScale=0.0047620004
+ DrawScale3D=(X=0.001)
+ StaticMesh=StaticMesh'USARSim_VehicleParts_Meshes.Sensors.Sensor'
+ Noise=0.001
+ Mass=0.001
+}
Added: usarsim/USARBot/Classes/ExpPath.uc
===================================================================
--- usarsim/USARBot/Classes/ExpPath.uc (rev 0)
+++ usarsim/USARBot/Classes/ExpPath.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,60 @@
+class ExpPath extends Object config(ExpPath);
+
+var config array<int> path;
+var int next;
+var int offX;
+var int offY;
+var float scaleX;
+var float scaleY;
+
+function int getValue(int i) {
+ if (i>path.length) i=i%path.length;
+ return path[i];
+}
+
+function int nextValue() {
+ next+=1;
+ if (next>=path.length) next=0;
+ return path[next];
+}
+
+function setOffset(int x0, int y0) {
+ offX=x0;
+ offY=y0;
+}
+
+function setScale(int w, int h) {
+ local int i,mx,my;
+ for (i=0;i<path.length;i+=2) {
+ if (mx<abs(path[i]-path[0])) mx=abs(path[i]-path[0]);
+ if (my<abs(path[i+1]-path[1])) my=abs(path[i+1]-path[1]);
+ }
+ if (mx>0) scaleX=w/((mx+offX-path[0])*2.0);
+ if (my>0) scaleY=h/((mx+offX-path[1])*2.0);
+}
+
+function nextPoint(out int X, out int Y) {
+ X=(nextValue()-path[0])*scaleX+offX;
+ Y=(nextValue()-path[1])*scaleY+offY;
+}
+
+function dump() {
+ local int i;
+ log("<<<dump");
+ log("offX="$offX@"offY="$offY);
+ log("scaleX="$scaleX@"scaleY="$scaleY);
+ for (i=0;i<path.length;i+=2) log("("$path[i]@path[i+1]$")");
+ log("dump>>>");
+}
+
+defaultproperties {
+ next=-1
+ offX=0
+ offY=0
+ scaleX=1.0
+ scaleY=1.0
+ path(0)=0
+ path(1)=10
+ path(2)=0
+ path(3)=20
+}
\ No newline at end of file
Added: usarsim/USARBot/Classes/FPSLog.uc
===================================================================
--- usarsim/USARBot/Classes/FPSLog.uc (rev 0)
+++ usarsim/USARBot/Classes/FPSLog.uc 2007-05-10 15:23:25 UTC (rev 598)
@@ -0,0 +1,224 @@
+///////////////////////////////////////////////////////////
+// FPSLog UnrealScript Class created by
+// by Marco Zaratti - marco.zaratti at gmail.com
+//
+//--Abstract-----------------------------------------------
+// This class is an Actor placeable in a map that logs
+// frame rate in "FPSStats.txt" in /UserLog dir.
+// It is useful to trace performance graphs. "FPSStats.txt"
+// may be imported in Excel (for instance) where a graph
+// can be created in just few mouse clicks.
+//---------------------------------------------------------
+//
+//--How To Use---------------------------------------------
+// Just place the Actor FPSLog in your map.
+// FPSStats.txt is written when UT Client is closed and its
+// output looks like (for each sample):
+//
+// time, FPS, delta (=1/FPS), counter
+//
+// time: is the total time passed
+// FPS: is the frame rate
+// delta: is the the last frame computation time (=1/FPS)
+// counter: is e generic counter increased and decreased by
+// triggering or untriggering FPSLog
+//
+// counter may be used to count the number of robots in the map
+// or for any other purpose. To count the number of robots you
@@ Diff output truncated at 60000 characters. @@
More information about the TeamTalk-developers
mailing list