Exemple #1
0
    static void ForwardCommand(Float32 distance)
    {
        // Ignore the distance because Sparki never moves more than 1 square.

        Debug.Log($"Moving Sparki forward {distance} cm.");
        sparki.needToMove = true;
    }
Exemple #2
0
    void Update()
    {
        ros.Render();
        Float32 msg = new Float32(100);

        // Debug.Log(Publisher.GetMessageTopic());
        ros.Publish(Publisher.GetMessageTopic(), msg);
    }
Exemple #3
0
        internal static Cpu.Status NEGF(Script vm)
        {
            var   srx = new SRX(vm, is_jump: false);
            float f0  = Float32.FromInt(vm.cpu.registers[srx.dst]);

            vm.cpu.registers[srx.dst] = Float32.ToInt(-f0);
            return(Cpu.Status.OK);
        }
Exemple #4
0
        internal static Cpu.Status CVTFW(Script vm)
        {
            var   srx   = new SRX(vm, is_jump: false);
            float value = Float32.FromInt(vm.cpu.registers[srx.dst]);

            // Floor float value to convert to int
            vm.cpu.registers[srx.dst] = (int)value;
            return(Cpu.Status.OK);
        }
Exemple #5
0
        internal static Cpu.Status SUBF(Script vm)
        {
            var   lrx = new LRX(vm);
            float f0  = Float32.FromInt(vm.cpu.registers[lrx.dst]);
            float f1  = Float32.FromInt(vm.cpu.registers[lrx.src]);

            vm.cpu.registers[lrx.dst] = Float32.ToInt(f0 - f1);
            return(Cpu.Status.OK);
        }
Exemple #6
0
        internal static Cpu.Status CGEF(Script vm)
        {
            var   lrx = new LRX(vm);
            float f0  = Float32.FromInt(vm.cpu.registers[lrx.dst]);
            float f1  = Float32.FromInt(vm.cpu.registers[lrx.src]);

            vm.cpu.registers[Registers.EAX] = f0 >= f1 ? 1 : 0;
            return(Cpu.Status.OK);
        }
Exemple #7
0
        internal static Cpu.Status CVTWF(Script vm)
        {
            var srx = new SRX(vm, is_jump: false);
            // Convert word to floating point
            float value = (float)vm.cpu.registers[srx.dst];

            // Store floating point representation in int value
            vm.cpu.registers[srx.dst] = Float32.ToInt(value);
            return(Cpu.Status.OK);
        }
Exemple #8
0
 public bool EqualsType(MySubType other)
 {
     return(Bool == other.Bool &&
            Int32 == other.Int32 &&
            UInt32 == other.UInt32 &&
            Int64 == other.Int64 &&
            UInt64 == other.UInt64 &&
            Float32.Equals(other.Float32) &&
            Float64.Equals(other.Float64) &&
            Enum == other.Enum &&
            string.Equals(Str, other.Str));
 }
Exemple #9
0
 protected bool EqualsType(MyType other)
 {
     return(Bool == other.Bool &&
            Int32 == other.Int32 &&
            UInt32 == other.UInt32 &&
            Int64 == other.Int64 &&
            UInt64 == other.UInt64 &&
            Float32.Equals(other.Float32) &&
            Float64.Equals(other.Float64) &&
            string.Equals(Str, other.Str) &&
            Enum == other.Enum &&
            Equals(Struct, other.Struct));
 }
Exemple #10
0
 static void TurnCommand(Float32 angle)
 {
     Debug.Log($"Turning Sparki {angle} degrees.");
     sparki.needToTurn = (int)angle.data;
 }
Exemple #11
0
 public Value(float v, Script vm = null)
 {
     value   = Float32.ToInt(v);
     is_void = false;
     parent  = vm;
 }
Exemple #12
0
        private void _parse()
        {
            _datatype = ((DataType)m_io.ReadU1());
            switch (Datatype)
            {
            case DataType.Integer:
            {
                _dataValue = new Integer(m_io, this, m_root);
                break;
            }

            case DataType.Unsigned:
            {
                _dataValue = new Unsigned(m_io, this, m_root);
                break;
            }

            case DataType.Long:
            {
                _dataValue = new Long(m_io, this, m_root);
                break;
            }

            case DataType.Boolean:
            {
                _dataValue = new Boolean(m_io, this, m_root);
                break;
            }

            case DataType.Structure:
            {
                _dataValue = new Structure(m_io, this, m_root);
                break;
            }

            case DataType.Array:
            {
                _dataValue = new Array(m_io, this, m_root);
                break;
            }

            case DataType.Float64:
            {
                _dataValue = new Float64(m_io, this, m_root);
                break;
            }

            case DataType.DoNotCare:
            {
                _dataValue = new DoNotCare(m_io, this, m_root);
                break;
            }

            case DataType.LongUnsigned:
            {
                _dataValue = new LongUnsigned(m_io, this, m_root);
                break;
            }

            case DataType.Time:
            {
                _dataValue = new Time(m_io, this, m_root);
                break;
            }

            case DataType.OctetString:
            {
                _dataValue = new OctetString(m_io, this, m_root);
                break;
            }

            case DataType.NullData:
            {
                _dataValue = new NullData(m_io, this, m_root);
                break;
            }

            case DataType.CompactArray:
            {
                _dataValue = new CompactArray(m_io, this, m_root);
                break;
            }

            case DataType.DateTime:
            {
                _dataValue = new DateTime(m_io, this, m_root);
                break;
            }

            case DataType.DoubleLongUnsigned:
            {
                _dataValue = new DoubleLongUnsigned(m_io, this, m_root);
                break;
            }

            case DataType.Float32:
            {
                _dataValue = new Float32(m_io, this, m_root);
                break;
            }

            case DataType.Long64Unsigned:
            {
                _dataValue = new Long64Unsigned(m_io, this, m_root);
                break;
            }

            case DataType.DoubleLong:
            {
                _dataValue = new DoubleLong(m_io, this, m_root);
                break;
            }

            case DataType.Long64:
            {
                _dataValue = new Long64(m_io, this, m_root);
                break;
            }

            case DataType.Date:
            {
                _dataValue = new Date(m_io, this, m_root);
                break;
            }

            case DataType.Enum:
            {
                _dataValue = new Enum(m_io, this, m_root);
                break;
            }

            case DataType.Bcd:
            {
                _dataValue = new Bcd(m_io, this, m_root);
                break;
            }

            case DataType.VisibleString:
            {
                _dataValue = new VisibleString(m_io, this, m_root);
                break;
            }

            case DataType.BitString:
            {
                _dataValue = new BitString(m_io, this, m_root);
                break;
            }
            }
        }
Exemple #13
0
 void OnWinchMsg(Float32 winchMsg)
 {
     this.winchValue = winchMsg.data;
 }
Exemple #14
0
 void OnHeadingMsg(Float32 headingMsg)
 {
     this.targetHeading = headingMsg.data;
 }