Drake
automotive_demo.cc File Reference
#include <cmath>
#include <limits>
#include <sstream>
#include <string>
#include <gflags/gflags.h>
#include "drake/automotive/automotive_simulator.h"
#include "drake/automotive/create_trajectory_params.h"
#include "drake/automotive/gen/maliput_railcar_params.h"
#include "drake/automotive/maliput/api/lane_data.h"
#include "drake/automotive/maliput/dragway/road_geometry.h"
#include "drake/automotive/multilane_onramp_merge.h"
#include "drake/common/drake_assert.h"
#include "drake/common/text_logging_gflags.h"
#include "drake/lcm/drake_lcm.h"
Include dependency graph for automotive_demo.cc:

Namespaces

 drake
 
 drake::automotive
 

Enumerations

enum  RoadNetworkType { flat = 0, dragway = 1, onramp = 2 }
 

Functions

 DEFINE_int32 (num_simple_car, 0, "Number of SimpleCar vehicles. The cars are " "named \\ \\ \\ etc. If this option is provided, " "simple_car_names must not be provided.")
 
 DEFINE_string (simple_car_names, "", "A comma-separated list that specifies the number of SimpleCar " "models to instantiate, their names, and the names of the LCM " "channels to which they subscribe (e.g., 'Russ,Jeremy,Liang' " "would spawn 3 cars subscribed to DRIVING_COMMAND_Russ, " "DRIVING_COMMAND_Jeremy, and DRIVING_COMMAND_Liang). If this " "option is provided, num_simple_car must not be provided.")
 
 DEFINE_int32 (num_mobil_car, 0, "Number of MOBIL-controlled SimpleCar vehicles. This option is " "currently only applied when the road network is a dragway. " "MOBIL-controlled vehicles are placed behind any idm-controlled " "railcars and any fixed-speed railcars.")
 
 DEFINE_int32 (num_trajectory_car, 0, "Number of TrajectoryCar vehicles. This " "option is currently only applied when the road network is a flat " "plane or a dragway.")
 
 DEFINE_int32 (num_idm_controlled_maliput_railcar, 0, "Number of IDM-controlled " "MaliputRailcar vehicles. This option is currently only applied " "when the road network is a dragway. These cars are added after " "the trajectory cars are added but before the fixed-speed " "railcars are added. They are initialized to be behind the " "fixed-speed railcars, if any.")
 
 DEFINE_int32 (num_maliput_railcar, 0, "Number of fixed-speed MaliputRailcar " "vehicles. This option is currently only applied when the road " "network is a dragway or merge. The speed is derived based on the " "road's base speed and speed delta. The railcars are added after " "the IDM-controlled railcars are added and are positioned in " "front of the IDM-controlled railcars.")
 
 DEFINE_double (target_realtime_rate, 1.0, "Playback speed. See documentation for " "Simulator::set_target_realtime_rate() for details.")
 
 DEFINE_double (simulation_sec, std::numeric_limits< double >::infinity(), "Number of seconds to simulate.")
 
 DEFINE_int32 (num_dragway_lanes, 0, "The number of lanes on the dragway. The number of lanes is by " "default zero to disable the dragway. A dragway road network is " "only enabled when the user specifies a number of lanes greater " "than zero. Only one road network can be enabled. Thus if this " "option is enabled, no other road network can be enabled.")
 
 DEFINE_double (dragway_length, 100, "The length of the dragway.")
 
 DEFINE_double (dragway_lane_width, 3.7, "The dragway lane width.")
 
 DEFINE_double (dragway_shoulder_width, 3.0, "The dragway's shoulder width.")
 
 DEFINE_double (dragway_base_speed, 4.0, "The speed of the vehicles on the right-most lane of the " "dragway.")
 
 DEFINE_double (dragway_lane_speed_delta, 2, "The change in vehicle speed in the left-adjacent lane. For " "example, suppose the dragway has 3 lanes. Vehicles in the " "right-most lane will travel at dragway_base_speed m/s. " "Vehicles in the middle lane will travel at " "dragway_base_speed + dragway_lane_speed_delta m/s. Finally, " "vehicles in the left-most lane will travel at " "dragway_base_speed + 2 * dragway_lane_speed_delta m/s.")
 
 DEFINE_double (dragway_vehicle_spacing, 10, "The initial spacing (in meters) between consecutive vehicles " "traveling on a lane.")
 
 DEFINE_bool (with_stalled_cars, false, "Places a stalled vehicle at the end of " "each lane of a dragway. This option is only enabled when the " "road is a dragway.")
 
 DEFINE_bool (with_onramp, false, "Loads the onramp road network. Only one road network can be " "enabled. Thus, if this option is enabled, no other road network " "can be enabled.")
 
 DEFINE_int32 (onramp_num_lanes, 1, "The number of lanes on the onramp. The number of lanes is by " "default 1 (one). This option is only valid when `with_onramp` " "option is used.")
 
 DEFINE_double (onramp_lane_width, 3.7, "The onramp lane width. This option is only valid when " "`with_onramp` option is used.")
 
 DEFINE_double (onramp_shoulder_width, 3.0, "The onramp's road shoulder width. This option is only valid " "when `with_onramp` option is used.")
 
 DEFINE_double (onramp_base_speed, 25, "The speed of the vehicles " "added to the onramp, i.e. this option is only valid when " "`with_onramp` option is used.")
 
 DEFINE_bool (onramp_swap_start, false, "Whether to swap the starting " "lanes of the vehicles on the onramp scenario, i.e. this " "option is only valid when `with_onramp` option is used.")
 
int main (int argc, char *argv[])
 

Enumeration Type Documentation

◆ RoadNetworkType

enum RoadNetworkType
strong

Function Documentation

◆ DEFINE_bool() [1/3]

DEFINE_bool ( with_stalled_cars  ,
false  ,
"Places a stalled vehicle at the end of " "each lane of a dragway. This option is only enabled when the " "road is a dragway."   
)

◆ DEFINE_bool() [2/3]

DEFINE_bool ( with_onramp  ,
false  ,
"Loads the onramp road network. Only one road network can be " "enabled.  Thus,
if this option is  enabled,
no other road network " "can be enabled."   
)

◆ DEFINE_bool() [3/3]

DEFINE_bool ( onramp_swap_start  ,
false  ,
"Whether to swap the starting " "lanes of the vehicles on the onramp  scenario,
i.e. this " "option is only valid when `with_onramp` option is used."   
)

◆ DEFINE_double() [1/11]

DEFINE_double ( target_realtime_rate  ,
1.  0,
"Playback speed. See documentation for " "Simulator::set_target_realtime_rate() for details."   
)

◆ DEFINE_double() [2/11]

DEFINE_double ( simulation_sec  ,
std::numeric_limits< double ::infinity(),
"Number of seconds to simulate."   
)

◆ DEFINE_double() [3/11]

DEFINE_double ( dragway_length  ,
100  ,
"The length of the dragway."   
)

◆ DEFINE_double() [4/11]

DEFINE_double ( dragway_lane_width  ,
3.  7,
"The dragway lane width."   
)

◆ DEFINE_double() [5/11]

DEFINE_double ( dragway_shoulder_width  ,
3.  0,
"The dragway's shoulder width."   
)

◆ DEFINE_double() [6/11]

DEFINE_double ( dragway_base_speed  ,
4.  0,
"The speed of the vehicles on the right-most lane of the " "dragway."   
)

◆ DEFINE_double() [7/11]

DEFINE_double ( dragway_lane_speed_delta  ,
,
"The change in vehicle speed in the left-adjacent lane. For " "  example,
suppose the dragway has 3 lanes. Vehicles in the " "right-most lane will travel at dragway_base_speed m/s. " "Vehicles in the middle lane will travel at " "dragway_base_speed+dragway_lane_speed_delta m/s.  Finally,
" "vehicles in the left-most lane will travel at " "dragway_base_speed+2 *dragway_lane_speed_delta m/s."   
)

◆ DEFINE_double() [8/11]

DEFINE_double ( dragway_vehicle_spacing  ,
10  ,
"The initial spacing (in meters) between consecutive vehicles " "traveling on a lane."   
)

◆ DEFINE_double() [9/11]

DEFINE_double ( onramp_lane_width  ,
3.  7,
"The onramp lane width. This option is only valid when " "`with_onramp` option is used."   
)

◆ DEFINE_double() [10/11]

DEFINE_double ( onramp_shoulder_width  ,
3.  0,
"The onramp's road shoulder width. This option is only valid " "when `with_onramp` option is used."   
)

◆ DEFINE_double() [11/11]

DEFINE_double ( onramp_base_speed  ,
25  ,
"The speed of the vehicles " "added to the  onramp,
i.e. this option is only valid when " "`with_onramp` option is used."   
)

◆ DEFINE_int32() [1/7]

DEFINE_int32 ( num_simple_car  ,
,
"Number of SimpleCar vehicles. The cars are " "named \\\etc. If this option is  provided,
" "simple_car_names must not be provided."   
)

◆ DEFINE_int32() [2/7]

DEFINE_int32 ( num_mobil_car  ,
,
"Number of MOBIL-controlled SimpleCar vehicles. This option is " "currently only applied when the road network is a dragway. " "MOBIL-controlled vehicles are placed behind any idm-controlled " "railcars and any fixed-speed railcars."   
)

◆ DEFINE_int32() [3/7]

DEFINE_int32 ( num_trajectory_car  ,
,
"Number of TrajectoryCar vehicles. This " "option is currently only applied when the road network is a flat " "plane or a dragway."   
)

◆ DEFINE_int32() [4/7]

DEFINE_int32 ( num_idm_controlled_maliput_railcar  ,
,
"Number of IDM-controlled " "MaliputRailcar vehicles. This option is currently only applied " "when the road network is a dragway. These cars are added after " "the trajectory cars are added but before the fixed-speed " "railcars are added. They are initialized to be behind the " "fixed-speed  railcars,
if any."   
)

◆ DEFINE_int32() [5/7]

DEFINE_int32 ( num_maliput_railcar  ,
,
"Number of fixed-speed MaliputRailcar " "vehicles. This option is currently only applied when the road " "network is a dragway or merge. The speed is derived based on the " "road's base speed and speed delta. The railcars are added after " "the IDM-controlled railcars are added and are positioned in " "front of the IDM-controlled railcars."   
)

◆ DEFINE_int32() [6/7]

DEFINE_int32 ( num_dragway_lanes  ,
,
"The number of lanes on the dragway. The number of lanes is by " "default zero to disable the dragway. A dragway road network is " "only enabled when the user specifies a number of lanes greater " "than zero. Only one road network can be enabled. Thus if this " "option is  enabled,
no other road network can be enabled."   
)

◆ DEFINE_int32() [7/7]

DEFINE_int32 ( onramp_num_lanes  ,
,
"The number of lanes on the onramp. The number of lanes is by " "default 1 (one). This option is only valid when `with_onramp` " "option is used."   
)

◆ DEFINE_string()

DEFINE_string ( simple_car_names  ,
""  ,
"A comma-separated list that specifies the number of SimpleCar " "models to  instantiate,
their  names,
and the names of the LCM " "channels to which they subscribe(e.g., 'Russ, Jeremy, Liang' " "would spawn 3 cars subscribed to DRIVING_COMMAND_Russ, " "DRIVING_COMMAND_Jeremy, and DRIVING_COMMAND_Liang). If this " "option is  provided,
num_simple_car must not be provided."   
)

◆ main()

int main ( int  argc,
char *  argv[] 
)