example does throttle
authorKevron Rees <tripzero.kev@gmail.com>
Tue, 28 Aug 2012 00:10:06 +0000 (17:10 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Tue, 28 Aug 2012 00:10:06 +0000 (17:10 -0700)
plugins/exampleplugin.cpp

index 80d90f0..a91a4bb 100644 (file)
@@ -29,6 +29,7 @@ using namespace std;
 uint16_t accelerationX = 0;
 uint16_t transmissionShiftPostion = 0;
 uint16_t steeringWheelAngle=0;
+uint16_t throttlePos = 0;
 
 static gboolean timeoutCallback(gpointer data)
 {
@@ -121,6 +122,7 @@ PropertyList ExampleSourcePlugin::supported()
        props.push_back(VehicleProperty::AccelerationX);
        props.push_back(VehicleProperty::TransmissionShiftPosition);
        props.push_back(VehicleProperty::SteeringWheelAngle);
+       props.push_back(VehicleProperty::ThrottlePosition);
        
        return props;
 }
@@ -137,6 +139,7 @@ void ExampleSourcePlugin::randomizeProperties()
        accelerationX = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
        transmissionShiftPostion = 1 + (6.00 * (rand() / (RAND_MAX + 1.0)));
        steeringWheelAngle = 1 + (359.00 * (rand() / (RAND_MAX + 1.0)));
+       throttlePos = 1 + (100.00 * (rand() / (RAND_MAX + 1.0)));
        
        DebugOut()<<"setting velocity to: "<<velocity<<endl;
        DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;
@@ -146,4 +149,5 @@ void ExampleSourcePlugin::randomizeProperties()
        routingEngine->updateProperty(VehicleProperty::AccelerationX, accelerationX);
        routingEngine->updateProperty(VehicleProperty::SteeringWheelAngle, steeringWheelAngle);
        routingEngine->updateProperty(VehicleProperty::TransmissionShiftPosition, transmissionShiftPostion);
+       routingEngine->updateProperty(VehicleProperty::ThrottlePosition, throttlePos);
 }