Quadrotor environment reference

class QuadrotorEnv
QuadrotorEnv()

Constructs a QuadrotorEnv from the configuration file “/flightlib/configs/quadrotor_env.yaml”.

Return type:

QuadrotorEnv

QuadrotorEnv(const std::string &cfg_path)

Constructs a QuadrotorEnv from the given configuration file.

Parameters:

cfg_path (std::string) – configuration file path

Return type:

QuadrotorEnv

~QuadrotorEnv()

Deconstructs this QuadrotorEnv.

Return type:

None

reset(Ref<Vector<>> obs, const bool random)

Reset the quadrotor state and get observations.

//full states of the quadrotor
obs = [position, orientation, linear velocity, angular velocity]
Parameters:
  • obs (Ref<Vector<>>) – Observations

  • random (const bool) – randomly reset the quadrotor state

Return type:

bool

getObs(Ref<Vector<>> obs)

Get observations.

//full states of the quadrotor
obs = [position, orientation, linear velocity, angular velocity]
Parameters:

obs (Ref<Vector<>>) – Observations

Return type:

bool

step(const Ref<Vector<>> act, Ref<Vector<>> obs)

Simulate one step with the given thrusts.

Get observations and the total reward of this step.

// thrusts of each propeller
act = [f1, f2, f3, f4]
//full states of the quadrotor
obs = [position, orientation, linear velocity, angular velocity]
Parameters:
  • act (const Ref<Vector<>>) – thrusts of each propeller

  • obs (Ref<Vector<>>) – Observations

Return type:

Total reward (Scalar)

isTerminalState(Scalar &reward)

Check if terminal state is reached.

Parameters:

reward (Scalar) – Reward of state

Return type:

bool

loadParam(const YAML::Node &cfg)

Load the QuadrotorEnv parameters.

Parameters:

cfg (const YAML::Node) – configuration YAML

Return type:

bool

getAct(Ref<Vector<>> act)

Get thrusts for commands.

// thrusts of each propeller
act = [f1, f2, f3, f4]
Parameters:

act (const Ref<Vector<>>) – thrusts of each propeller

Return type:

bool

getAct(Command *const cmd)

Get the next command for the quadrotor.

Parameters:

cmd (Command) – Quadrotor command

Return type:

bool

addObjectsToUnity(std::shared_ptr<UnityBridge> bridge)

Add the quadrotor to Flightmare.

Parameters:

bridge (std::shared_ptr<UnityBridge>) – Unity bridge

Return type:

None