Class apf_manager
Defined in File apf_manager.hpp
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(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.
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.
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)
-
void forces_reset(void)
Reset the sum of forces acting on the entity.
-
inline bool is_enabled(void) const
Calculate the nav::path_following_force for this timestep.
- Parameters:
state – The current path state.
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.
Calculate the nav::phototaxis_force for this timestep.
- Parameters:
readings – The current light sensor readings.
-
rmath::vector2d polar(const rmath::vector2d ¢er)
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.
-
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
-
~apf_manager(void)