public SimVehicleState Update(double dt, WorldService service)
        {
            UpdateVehicleState(dt);
            TahoeConstraints();
            CheckGear();

            // send out the vehicle state
            operationalStateChannel.PublishUnreliably(GetOperationalSimVehicleState(service));

            return simVehicleState;
        }
        public OperationalSimVehicleState GetOperationalSimVehicleState(WorldService service)
        {
            TransmissionGear g = TransmissionGear.Neutral;
            switch (gear)
            {
                case '1': g = TransmissionGear.First; break;
                case '2': g = TransmissionGear.Second; break;
                case '3': g = TransmissionGear.Third; break;
                case '4': g = TransmissionGear.Fourth; break;
                case 'r': g = TransmissionGear.Reverse; break;
            }

            double rps2rpm = 60.0 / (2.0 * Math.PI);
            double bleed_off_torque = TahoeParams.bleed_off_power / engine_speed;

            return new OperationalSimVehicleState(
                simVehicleState.Position, simVehicleState.Speed, simVehicleState.Heading.ArcTan, steering_wheel,
                g, engine_torque + bleed_off_torque, master_cylinder_pressure, engine_speed * rps2rpm, carMode,
                0, false,	SimulatorClient.GetCurrentTimestamp);
        }
 /// <summary>
 /// Sets the road network and mission for the car
 /// </summary>
 /// <param name="roadNetwork"></param>
 /// <param name="mission"></param>
 public override void SetRoadNetworkAndMission(ArbiterRoadNetwork roadNetwork, ArbiterMissionDescription mission)
 {
     this.roadNetwork = roadNetwork;
     this.mission = mission;
     this.roadNetwork.SetSpeedLimits(mission.SpeedLimits);
     this.world = new WorldService(this.roadNetwork);
 }