Skip to content

ROS 2 Services and Actions#

The simulator control client of sim_bridge gives the services and the action of this page. It connects to the simulator control channel of the game or of core_sim (control_port, default 5600). With control_port:=0, the bridge has no simulator control.

Source: Vehicle/ROS/acres_sim/src/sim_control.cpp. The bridge translates each request into an operation of the Simulator Control Channel.

simulation_interfaces Services#

These services use the types of the ROS 2 package simulation_interfaces. They are at the root namespace.

Service Function
/get_simulator_features The features that the simulator supports.
/get_simulation_state, /set_simulation_state The state: stopped, playing, paused or quitting.
/step_simulation Advances the simulation by physics steps. The simulation must be paused.
/reset_simulation Resets the world.
/get_entities, /get_entity_state, /set_entity_state The agents and the spawned entities, and their poses.
/spawn_entity, /delete_entity, /get_spawnables Spawns and deletes entities.
/get_named_poses The named places of the map.

The action /simulate_steps (simulation_interfaces/SimulateSteps) advances steps with feedback.

ACRES Services#

These services use the types of the package acres_interfaces (Messages).

Service Type Function
/acres/set_conditions SetConditions Sets the weather, the clock, the soil water or a field restore. Each part applies only when its set_* flag is true. The new conditions go to /sim/conditions.
/acres/set_vehicle_shift SetVehicleShift Replaces the hardware shift of a vehicle (a VehicleShift). An all-zero shift restores the vehicle.
/acres/record Record Starts or stops the episode log.
/acres/farm_state FarmState The farm for task scores: the crop damage, the field work and the soil water of each field (FieldState).
/acres/field_query FieldQuery The ground truth at one point, in the frame world or utm.

The Skill Action#

With skills:=true, the vehicle node is the skill server. The action is /acres/skill (acres_interfaces/Skill). The goal has the fields skill (goto, scout, return_home, wait, stop or continue) and args_json. A client sends std_msgs/Empty to /acres/skill/heartbeat at 2 Hz or more.

Vehicle/ROS/acres_vehicle/scripts/skill_client.py is a client (ROS 2 Commands). Config/schemas/skills.json gives the skills, the arguments and the result codes.

The vehicle node also has the service ~/stop (std_srvs/Trigger).

Examples#

Step a session in lockstep by 12 physics steps (0.1 s):

ros2 service call /step_simulation simulation_interfaces/srv/StepSimulation "{steps: 12}"

Start the episode log:

ros2 service call /acres/record acres_interfaces/srv/Record "{action: 1, path: /tmp/run.mcap}"