-
Notifications
You must be signed in to change notification settings - Fork 15
Drive By Wire
The drive-by-wire node adjusts throttle and brakes according to the velocity targets published by the waypoint follower (which is informed by the waypoint updater node). If the list of waypoints contains a series of descending velocity targets, the PID velocity controller (in the twist controller component of DBW) will attempt to match the target velocity. In the chart below, we transition from 11 mps to 0 mps through a series of decreasing velocities across a plurality of waypoints. The red line represents the target velocity, blue is actual velocity. Green is braking on a scale from 0 to 1. The x-axis is the number of frames at 50 FPS (frames per second).
An alternative "binary" approach to velocity targets sets waypoint velocities to zero. When this configuration is encountered, the PID velocity controller provides maximum braking. In the chart below, we again transition from 11 mps to 0 mps. Note the sustained maximum braking and a shorter frame count to stop.
Below, we investigate the torque and percent modes of braking in the simulator in preparation for drive-by-wire. First, let's take a look at what happens when we do not apply any braking whatsoever and let air-resistance and tire friction naturally slow the vehicle.
Above is the behavior of no braking and no throttle, coasting from 10 meters per second (36kph, 22.37mph) until stopped. This is frictional braking only. The x-axis is the number of frames at 50 FPS (frames per second).
OK, so what happens when we brake with full force in torque mode? It appears that we can stop in less than three seconds with a braking distance of 13.9 meters. This is an acceleration of -3.3333 m/s2. However, due to randomization in the simulator, the same experiment can yield a measure of 6 seconds over 26.0 meters.
For reference, above we used the TORQUE_MAX value of 3412.0 for maximum braking in the torque mode: bcmd.pedal_cmd_type = BrakeCmd.CMD_TORQUE
Next, we switch to percent braking, bcmd.pedal_cmd_type = BrakeCmd.CMD_PERCENT
, in which we brake by specifying a percentage of braking rather than using a torque value. This type of braking is supposed to have a range of 0.0 to 1.0 according to the Dataspeed specification. Is braking using the percent mode more consistent? Does it even work properly? We were not achieving a satisfactory braking effect when we cursorily attempted values of 0.8 or 0.5 in this mode.
Above, with a value of 1.0, we should see maximum braking: yet it is far from the torque reference. Maybe someone meant values 0.0 to 100.0. So let's try using a value of 100.0.
Above, with a value of 100.0, we see better stopping distance, but we're not quite there yet. What if we multiply by 10?
There it is! A percentage of 1000.0 is needed to perform maximum simulator braking in percent mode. Several experiments in the percent mode yielded variance in braking time and distance similar to the torque mode.
Density of gasoline
2.858 kg/gal = 755 kg/m³
Normal range is from 710–770 kg/m³