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

USARBot.IRCamera


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
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
class IRCamera extends IRSensor config (USARBot);

var config int Fov;
var config int HorResolution;
var config int VerResolution;
var config int RowsAtTime;

var int uuFov, uuHorResolution, uuVerResolution;

var string rangeData[240];  //max width = 240
var USARRemoteBot rBot;

var int rowCount;   //counter used to send each time a different row
var bool bScan;

simulated function PostNetBeginPlay()
{
    local int i;
    Super.PostNetBeginPlay();
    rowCount=0;
    for (i=0; i<240; i++)
        rangeData[i]="";
    if (VerResolution>240)
        VerResolution = 240;
}


function ConvertParam(USARConverter converter)
{
    if (converter!=None) {
        uuFov = converter.AngleToUU(Fov);
        uuHorResolution = converter.AngleToUU(HorResolution);
        uuVerResolution = converter.AngleToUU(VerResolution);
    } else {
        uuFov = Fov;
        uuHorResolution = HorResolution;
        uuVerResolution = VerResolution;
    }
}

function string Set(String opcode, String args)
{
    if(Caps(opcode)=="SCAN") {
        bScan = true;
        return "OK";
    }
    return "Failed";
}

function String GetData()
{
    local string outstring;
    local int i, j;
    local int range;

    if (!bScan) return "";
    
    outstring = "{Name "$ItemName$"} {Time "$Level.TimeSeconds$"} ";

    curRot = base.Rotation + myDirection;
    for (i=0; i<RowsAtTime; i++) { //we want to send X rows atime (and have bandwith)

        rangeData[rowCount]="";
        curRot.Pitch = Rotation.Pitch + (uuFov/2 - rowCount*uuFov/uuVerResolution);

        for (j=-uuFov/2; j<uuFov/2; j+= uuFov/uuHorResolution)
        {
            curRot.Yaw = Rotation.Yaw + j;
            range = GetRange() ;        //We get it as int to save space
            if (rangeData[rowCount] == "")
                rangeData[rowCount] = converter.FloatString(range);
            else
                rangeData[rowCount] = rangeData[rowCount]$","$converter.FloatString(range);
        }
        outstring = outstring$"{Row "$rowCount$" Range "$rangeData[rowCount]$"} ";
        rowCount++;

        if (rowCount >= uuFov/uuVerResolution) {
            rowCount = 0;
            if (rBot == None)
                rBot = USARRemoteBot(Platform.Controller);
            rBot.IRCameraScan = false; //reset command
        }
    }
    bScan = false;
    return outstring;
}    

function String GetConfData()
{
    local string outstring;
    outstring = Super.GetConfData();
    outstring = outstring@"{Fov "$converter.FloatString(Fov)$"}";
    outstring = outstring@"{HorResolution "$converter.FloatString(HorResolution)$"} {VerResolution "$converter.FloatString(VerResolution)$"}";
    return outstring;
}

defaultproperties
{
    HiddenSensor=true
    DrawScale=1.0
    StaticMesh=StaticMesh'USARSim_VehicleParts_Meshes.Sensors.LMS200'
    bHardAttach=true
    ItemType="IRCamera"
    MaxRange=4.0
    MinRange=0.04
    Fov=0.6981 // 40 deg
    HorResolution=0.01534 // 160 uu
    VerResolution=0.01150 // 120 uu
    OutputCurve=(Points=((InVal=0,OutVal=0),(InVal=4.0,OutVal=4.0)))
    RowsAtTime=5
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 12.1.2007 20:48:04.000 - Creation time: Mo 16.4.2007 11:20:48.859 - Created with UnCodeX