示例#1
0
 public static string getMessageTextFromState(DroneState state)
 {
     return(formatStringForMessage(
                state.getPitch(), state.getRoll(), state.getYaw(),
                state.getSpeedX(), state.getSpeedY(), state.getSpeedZ(),
                state.getLowTemperature(), state.getHighTemperature(),
                state.getFlightDistance(), state.getHeight(),
                state.getBatteryPercentage(), state.getBarometerMeasurement(),
                state.getMotorTime(), state.getAccelerationX(),
                state.getAccelerationY(), state.getAccelerationZ()
                ));
 }
示例#2
0
//		public Status(int pitch, int roll, int yaw, int speedX, int speedY, int speedZ,
//			int lowTemperature, int highTemperature, int flightDistance, int height,
//			int batteryPercentage, double barometerMeasurement, int motorTime,
//			double accelerationX, double accelerationY, double accelerationZ)
        public Status(DroneState state) : base(getMessageTextFromState(state))
        {
            pitch                = state.getPitch();
            roll                 = state.getRoll();
            yaw                  = state.getYaw();
            speedX               = state.getSpeedX();
            speedY               = state.getSpeedY();
            speedZ               = state.getSpeedZ();
            lowTemperature       = state.getLowTemperature();
            highTemperature      = state.getHighTemperature();
            flightDistance       = state.getFlightDistance();
            height               = state.getHeight();
            batteryPercentage    = state.getBatteryPercentage();
            barometerMeasurement = state.getBarometerMeasurement();
            motorTime            = state.getMotorTime();
            accelerationX        = state.getAccelerationX();
            accelerationY        = state.getAccelerationY();
            accelerationZ        = state.getAccelerationZ();
        }
示例#3
0
        private string getQueryResult(Type msgType)
        {
            string simResponse = Error.getKeyword();

            if (msgType == typeof(TimeQuery))
            {
                simResponse = Utils.formatDouble(state.getCurrentFlightTime());
            }
            else if (msgType == typeof(BatteryQuery))
            {
                simResponse = state.getBatteryPercentage().ToString();
            }
            else if (msgType == typeof(SpeedQuery))
            {
                simResponse = Utils.pythagorean3D(state.getSpeedX(), state.getSpeedY(), state.getSpeedZ());
            }

            return(simResponse);
        }