ROS 2 Commands#
This page describes the executables, the launch files and the scripts of the ROS 2 workspace in Vehicle/ROS/. ROS 2 Workspace explains the packages. Commands gives the conventions of the synopsis.
Environment and Build#
conda env create -f Vehicle/ROS/Env/environment.yml # one time: the environment ros2 (RoboStack ROS 2 Humble)
source Vehicle/ROS/Env/setup_env.sh # each shell
cd Vehicle/ROS && colcon build
Vehicle/ROS/Env/setup_env.sh activates the conda environment ros2, applies the DDS fence (Vehicle/ROS/Env/dds_safety.sh), sets the colcon defaults and sources Vehicle/ROS/install/setup.bash when the workspace is built.
The DDS fence sets these variables. Do not change them.
| Variable | Value |
|---|---|
ROS_LOCALHOST_ONLY |
1 |
ROS_DOMAIN_ID |
77, or the value of ACRES_ROS_DOMAIN |
RMW_IMPLEMENTATION |
rmw_cyclonedds_cpp |
CYCLONEDDS_URI |
Vehicle/ROS/Env/cyclonedds_localhost.xml: the loopback interface only, no multicast |
Vehicle/ROS/Env/check_dds_isolation.sh [SECONDS] proves the fence: a talker talks to a local listener, and each UDP datagram goes to 127.0.0.1. It prints PASS or FAIL.
sim_bridge#
The ROS 2 side of a running simulator in one process (package acres_sim). It connects to the vehicle bridge, the sensor stream and the simulator control channel (Sockets of a Session).
ros2 run acres_sim sim_bridge --ros-args -p vehicle:=polaris -p sensor_port:=5601 -p rl_port:=5556
ros2 launch acres_sim sim_bridge.launch.py [ARGUMENT:=VALUE]...
| Argument | Default | Meaning |
|---|---|---|
vehicle |
polaris |
polaris or maxxum. |
sensor_port |
5601 | The port of -SensorStream=. |
rl_port |
5556 | The port of -RlPort=. 0: none. |
control_port |
5600 | The port of -SimControl=. 0: no simulator control services. |
can_udp_port |
0 | The port of -RlCanUdp=: the J1939 bus on can/rx and can/tx. 0: none. |
agents |
'' |
'': one vehicle from these arguments. auto: each agent of the game. |
namespace, frame_prefix |
'' |
The namespace and the TF frame prefix of this vehicle, for example polaris2/. |
publish_clock |
true |
Publishes /clock. Only one bridge must publish it. |
ncom, rtk, sigma_h_m |
true, fixed, -1 |
The Polaris: publishes /oxts/ncom from the INS of the game, the RTK state (fixed, float or none) and the horizontal sigma (-1: that of the game INS). |
camera_xyz, camera_rpy |
2.411 0.554 1.910, -0.03648 0.29322 -0.03491 |
The camera mount from base_footprint. |
rviz, rviz_config |
false |
Starts RViz. |
stats_file |
'' |
Writes the transport statistics at the exit. |
Example: the game in lockstep, then the bridge for all agents.
Packaged/Linux/Acres.sh -VehicleDemo -Vehicle=polaris -SimControl=5600 -Lockstep -SensorStream=5601 -RlPort=5556 &
ros2 launch acres_sim sim_bridge.launch.py agents:=auto rviz:=true
core_sim#
ACRES Core behind the local sockets of the game (package acres_core_sim). Thus sim_bridge operates with ACRES Core and no game.
core_sim [--root DIR] [--content DIR] [--agents polaris[,NAME...]] [--sensor-ports 5601[,...]] [--rl-ports 5556[,...]]
[--control-port 5600] [--lockstep] [--rate X] [--spawn SPAWN] [--polaris-set KEY=VALUE;...]
[--no-lidar] [--lidar-threads N] [--no-noise] [--episode-log PATH] [--max-frame-steps N]
ros2 launch acres_core_sim core_sim.launch.py [ARGUMENT:=VALUE]...
| Launch Argument | Default | Meaning |
|---|---|---|
lockstep |
false |
Starts held. Step with /step_simulation. |
rate |
1.0 |
The free-run rate: 1 is real time, 10 is ten times, 0 is no limit. |
spawn |
'' |
place:ID, utm:E:N:HEADING or enu:X:Y:YAW for each agent, with commas. Empty: the ICSC garage. |
polaris_set |
'' |
Polaris overrides key=value;key=value. |
agents |
polaris |
The agent names, with commas. |
sensor_port, rl_port, control_port |
5601, 5556, 5600 | The ports. |
lidar, lidar_threads, noise |
true, 4, true |
The Helios ray-cast LiDAR, its worker threads, and the INS and LiDAR noise. |
episode_log |
'' |
Records the episode log from the start. |
rviz, stats_file |
false, '' |
RViz, and the transport statistics of the bridge. |
vehicle_node#
The vehicle program of ACRES on the topics of the Polaris (package acres_vehicle). It runs one control step of the run-time library each 0.1 s.
ros2 launch acres_vehicle vehicle.launch.py [mission:=home] [drive:=false] [pose_source:=oxts] [datum:=nad83_2011]
[limits:=first_test] [speed_cap_mps:=0.0] [stop_on:=] [tables:=] [out:=] [bag:=] [root:=] [threads:=1]
SHADOW is the default: the node has no publisher on a command topic. drive:=true is the one arming argument. The node then sends SteeringCmd and UlcCmd when the driver enabled the drive-by-wire. The node never enables the drive-by-wire. The safety driver enables it.
| Argument | Default | Meaning |
|---|---|---|
mission |
home |
The mission, for example F56, F53,F12, home or goto:F53. |
drive |
false |
The arming argument. |
pose_source |
oxts |
The source of the pose: oxts (the NCOM packets), odom or auto. |
datum |
nad83_2011 |
The datum of the pose. |
limits |
first_test |
first_test, reverse_test, kturn_test or simulator. The first three read Config/first_test.json, Config/reverse_test.json or Config/kturn_test.json. reverse_test and kturn_test need gear:=node. |
speed_cap_mps, lateral_accel_cap_mps2, area_radius_m, max_run_s |
0.0 | Caps of the run. 0: the value of the limits file. |
stop_on |
'' |
Conditions that stop the run. |
tables |
'' |
The cost tables (dry.npz). |
out |
'' |
The folder of the records. |
bag |
'' |
Reads a recording in the recorded order, with no subscription. SHADOW only. |
root, threads |
'', 1 |
The repository and the threads of the library. |
gear |
driver |
node: the node shifts the gear by wire. |
real_scan |
config |
config, level_rings or height_band: the scan of the obstacle rule. |
ulc_limit_accel, ulc_limit_decel |
0 | The rate limits of the ULC speed command, m/s². 0: the drive-by-wire default. The Polaris field days use 0.8 and 2.0. |
scan_hold, scan_hold_max_age_s |
0, 0.3 | The last usable sweep replaces a sweep that is not usable for its content, for at most scan_hold sweeps in a row. |
pose_hold_s |
0 | A pose whose only fault is its age (at most 1 s) is dead-reckoned to the step. 0: off. |
hold_decel_mps2 |
0.8 | During a hold, the ULC speed command falls at this rate from the measured speed. |
start_max_speed_mps |
0 | DRIVE: no command until the vehicle is slower than this. 0: off. |
skills, first_skill, first_skill_args |
false, '' |
The node is the skill server, and the skill that it asks for at its start. |
on_cancel, client_timeout_s |
hold, 1.0 |
What a cancelled goal or a lost client gives, and the heartbeat timeout. |
stall_s, off_path_m |
-1, 3 | The limits of the findings stall and off_path. |
propose_wall_s, exit_at_end |
0.02, true |
The wall time of a proposal check, and the stop at the end of the run. |
sim_drive.launch.py#
Starts core_sim, sim_bridge, the stand-in of the safety driver (lab_stubs) and vehicle_node in a closed loop with ACRES Core in real time.
ros2 launch acres_vehicle sim_drive.launch.py tables:=DIR/dry.npz [mission:=F56] [drive:=false] [driver:=true]
[speed_cap_mps:=4.0] [spawn:=] [real_scan:=config] [skills:=false] [gear:=driver] [limits:=simulator] [map:=]
| Argument | Default | Meaning |
|---|---|---|
driver |
true |
Starts lab_stubs: it enables the drive-by-wire and puts the gear lever in L (in P when drive is false). |
skills |
false |
Makes the vehicle node the skill server (the action /acres/skill). mission is then not read. |
first_skill, first_skill_args |
'' |
A skill to start. |
gear |
driver |
node: the vehicle node shifts the gear by wire. |
limits |
simulator |
The limits of the vehicle node. reverse_test needs gear:=node. |
map |
'' |
A map variant. The cost tables must be those of that map. |
lidar_threads, noise, sensor_port, rl_port, control_port |
2, true, 5601, 5556, 5600 |
The settings of core_sim. |
Warning
Do not start sim_drive.launch.py on the vehicle computer.
Other Launch Files#
| Command | Function |
|---|---|
ros2 launch acres_description description.launch.py [use_sim_time:=false] [visual:=true] [frame_prefix:=] [camera_xyz:=...] [camera_rpy:=...] |
robot_state_publisher with the Polaris description. |
ros2 launch acres_description bag_replay.launch.py bag:=DIR [rate:=1.0] [loop:=false] [rviz:=true] [delay:=4.0] |
Plays a Polaris bag into RViz on simulation time. |
ros2 launch acres_description fake_polaris.launch.py [rviz:=true] |
The description, a synthetic LiDAR and RViz, for RViz tests. |
ros2 launch acres_sim lab_follower.launch.py route_file:=PATH [OPTIONS] |
The route follower of the Purdue lab drives the simulated Polaris, with stubs for its other inputs. |
Scripts#
skill_client.py#
A client of the skill server of the vehicle node. It sends one skill, prints each event and prints the result.
python Vehicle/ROS/acres_vehicle/scripts/skill_client.py SKILL [KEY=VALUE...] [--args JSON] [--timeout X]
[--cancel-after X] [--quiet] [--observation]
SKILLgoto,scout,return_home,wait,stoporcontinue.KEY=VALUE- The arguments, for example
field=F56. --args JSON- The arguments as one JSON object.
--timeout X- The wait for the result, s. Default: 900.
--cancel-after X- Cancels the goal after this time, s.
--quiet,--observation- Prints no events. Prints the observation of the result.
Other Scripts#
| Command | Function |
|---|---|
python Vehicle/ROS/acres_vehicle/scripts/gear_test.py --out DIR [--no-prompt] |
The gear test for a person: does the gear command of the drive-by-wire work on this vehicle? |
python Vehicle/ROS/acres_vehicle/scripts/shadow_compare.py NODE PYTHON [--out PATH] |
Compares the records of the node with the records of an offline run of the same recording. |
Vehicle/ROS/acres_vehicle/scripts/node_reference.sh --build DIR --bag DIR --out DIR [OPTIONS] |
Makes the references of the node on one recorded drive. |
ros2 run acres_sim dbw_demo_driver |
A demonstration driver on the drive-by-wire topics. |
ros2 run acres_sim lab_stubs |
The stand-in of the safety driver and of the other lab inputs. |
ros2 run acres_core_sim core_bench |
A speed test of core_sim. |
python Vehicle/ROS/acres_sim/test/fake_game.py [--vehicle NAME] [--sensor-port N] [--rl-port N] [--control-port N] [--realtime] |
A stand-in of the game, for tests of the bridge without Unreal. |
python Vehicle/ROS/Tools/bag_summary.py [BAG...] [--graph] --out PATH [--label TEXT] |
The ROS interface of bags (types, QoS, counts, rates, frames) as JSON. |
python Vehicle/ROS/Tools/check_topic_parity.py --sim PATH... --vehicle PATH... [--json PATH] |
Compares the summaries of the simulator bridge and of the Polaris topic by topic. |
python Vehicle/ROS/Tools/check_msg_defs.py BAG... --msgs DIR... [--limit N] [--quiet] |
Checks that recorded messages match a set of message definitions byte for byte. |
python Vehicle/ROS/Tools/export_polaris_meshes.py |
Exports the Polaris model as RViz meshes and a URDF macro. |