Class apf_manager

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public rer::client< apf_manager >

Class Documentation

class apf_manager : public rer::client<apf_manager>

Class encapsulating steering of entities through 2D space via summing selectable forces that act on the entity each timestep (artificial potential fields). To use this class, entities must conform to the boid interface.

Public Functions

apf_manager(boid &entity, const config::apf_manager_config *config)
~apf_manager(void)
void accum(const rmath::vector2d &force)

Add a calculated force to the running total of the forces acting on the agent since the last reset. Does not apply the force(s) to the agent.

rmath::vector2d alignment(const std::vector<rmath::vector2d> others)

Calculate the flocking::alignment_force for this timestep.

Parameters:

others – The VELOCITIES of other agents to which the current agent should try to align its heading to the centroid of.

rmath::vector2d anti_phototaxis(const nav::phototaxis_force::camera_sensor_readings &readings, const rutils::color &color)

Calculate the negative of the nav::phototaxis_force for this timestep.

Parameters:
  • readings – The current camera sensor readings.

  • color – The color of the light source to taxis towards. If any of the camera sensor readings are not this color, they are ignored in the force calculation.

rmath::vector2d anti_phototaxis(const nav::phototaxis_force::light_sensor_readings &readings)

Calculate the negative of the nav::phototaxis_force for this timestep.

Parameters:

readings – The current light sensor readings.

rmath::vector2d avoidance(const rmath::vector2d &closest_obstacle)

Calculate the nav::avoidance_force for this timestep.

If no threatening obstacle exists, this force is 0.

Parameters:

closest_obstacle – Where is the closest obstacle, relative to robot’s current position AND heading.

rmath::vector2d constant_speed(const std::vector<rmath::vector2d> others)

Calculate the flocking::constant_speed_force for this timestep.

Parameters:

others – The VELOCITIES of other agents to which the current agent should try to align its heading to the centroid of.

inline void disable(void)
inline void enable(void)
inline const boid &entity(void) const
void forces_reset(void)

Reset the sum of forces acting on the entity.

inline bool is_enabled(void) const
rmath::vector2d path_following(cnav::trajectory *path)

Calculate the nav::path_following_force for this timestep.

Parameters:

state – The current path state.

rmath::vector2d phototaxis(const nav::phototaxis_force::camera_sensor_readings &readings, const rutils::color &color)

Calculate the nav::phototaxis_force for this timestep.

Parameters:
  • readings – The current camera sensor readings.

  • color – The color of the light source to taxis towards. If any of the camera sensor readings are not this color, they are ignored in the force calculation.

rmath::vector2d phototaxis(const nav::phototaxis_force::light_sensor_readings &readings)

Calculate the nav::phototaxis_force for this timestep.

Parameters:

readings – The current light sensor readings.

rmath::vector2d polar(const rmath::vector2d &center)

Calculate the nav::polar_force for this timestep.

rmath::vector2d seek_to(const rmath::vector2d &target)

Calculate the nav::arrival_force for this timestep.

Parameters:

target – The target to seek to.

inline class tracker *tracker(void)
inline const class tracker *tracker(void) const
void tracking_reset(void)

Reset the force/path tracking.

inline void value(const rmath::vector2d &val)
inline const rmath::vector2d &value(void) const

Return the current net APF force as a velocity vector.

rmath::vector2d wander(rmath::rng *rng)

Calculate the nav::wander_force for this timestep.

bool within_slowing_radius(void) const