#include <er_force_simulator.h>
The ErForceSimulator abstracts away the physics simulation of all objects in the world, as well as the firmware simulation for the robots. This provides a simple interface to setup, run, and query the current state of the simulation.
◆ ErForceSimulator()
| ErForceSimulator |
( |
const TbotsProto::FieldType & |
field_type, |
|
|
const RobotConstants_t & |
robot_constants, |
|
|
std::unique_ptr< RealismConfigErForce > & |
realism_config, |
|
|
const bool |
ramping = false, |
|
|
double |
primitive_executor_time_step_s = DEFAULT_SIMULATOR_TICK_RATE_SECONDS_PER_TICK |
|
) |
| |
|
explicit |
Creates a new Simulator. The starting state of the simulation will have the given field, with no robots or ball.
- Parameters
-
| field_type | The field type |
| robot_constants | The robot constants |
| realism_config | realism configuration |
◆ createDefaultRealismConfig()
| std::unique_ptr< RealismConfigErForce > createDefaultRealismConfig |
( |
| ) |
|
|
static |
Creates the default realism config using erforce simulator's default config
- Returns
- a pointer to default realism config
◆ createRealisticRealismConfig()
| std::unique_ptr< RealismConfigErForce > createRealisticRealismConfig |
( |
| ) |
|
|
static |
Creates the realistic realism config
- Returns
- a pointer to realistic realism config
◆ getBlueRobotStatuses()
| std::vector< TbotsProto::RobotStatus > getBlueRobotStatuses |
( |
| ) |
const |
Gets the blue and yellow robot statuses
- Returns
- a vector of robot statuses from either blue or yellow robots
◆ getField()
Returns the field in the simulation
- Returns
- the field in the simulation
◆ getSimulatorState()
| world::SimulatorState getSimulatorState |
( |
| ) |
const |
Returns the current Simulator State
◆ getSSLWrapperPackets()
| std::vector< SSLProto::SSL_WrapperPacket > getSSLWrapperPackets |
( |
| ) |
const |
Returns the most recent SSL Wrapper Packets
- Returns
- vector of
SSLProto::SSL_WrapperPackets representing the most recent state of the simulation
◆ getTimestamp()
Returns the current time in the simulation
- Returns
- the current time in the simulation
◆ resetCurrentTime()
| void resetCurrentTime |
( |
| ) |
|
Resets the current time to 0
◆ setBallState()
| void setBallState |
( |
const BallState & |
ball_state | ) |
|
Sets the state of the ball in the simulation. No more than 1 ball may exist in the simulation at a time. If a ball does not already exist, a ball is added with the given state. If a ball already exists, it's state is set to the given state.
- Parameters
-
| ball_state | The new ball state |
◆ setWorldState()
| void setWorldState |
( |
const TbotsProto::WorldState & |
world_state | ) |
|
Set the world state from a WorldState proto in the simulation.
- Parameters
-
| world_state | The new WorldState |
◆ setYellowRobotPrimitiveSet()
| void setYellowRobotPrimitiveSet |
( |
const TbotsProto::PrimitiveSet & |
primitive_set_msg, |
|
|
std::unique_ptr< TbotsProto::World > |
world_msg |
|
) |
| |
Sets the primitive being simulated by the robot on the corresponding team in simulation
- Parameters
-
| primitive_set_msg | The set of primitives to run on the robot |
| world_msg | The world message |
◆ setYellowRobots()
Adds robots to the specified team with the given initial states.
- Precondition
- The robot IDs must not be duplicated and must not match the ID of any robot already on the specified team.
- Exceptions
-
| runtime_error | if any of the given robot ids are duplicated, or a robot already exists on the specified team with one of the new IDs |
- Parameters
-
◆ stepSimulation()
| void stepSimulation |
( |
const Duration & |
time_step | ) |
|
Advances the simulation by the given time step.
- Parameters
-
| time_step | how much to advance the simulation by |
The documentation for this class was generated from the following files: