esp::nav::GreedyGeodesicFollowerImpl class

Generates actions to take to reach a goal.

Choose actions by running local planning over a set of motion primitives. The primitives are all sequences of action in the form [left]*n + [forward] or [right]*n + [forward] for 0 <= n < turning 180 degrees

Primitives are selected by choosing the one that best maximizes a reward function that selects the primitive that most quickly makes progress towards the goal while preferring shorter primtives and avoid obstacles.

Once a primitive is selected, the first action in that primitives is selected as the next action to take and this process is repeated

Public types

enum class CODES: int { ERROR = -2, STOP = -1, FORWARD = 0, LEFT = 1, RIGHT = 2 }
Ouputs from the greedy follower.
using MoveFn = std::function<bool(scene::SceneNode*)>
Helper typedef for function pointer to a function that manipulates a scene node.

Constructors, destructors, conversion operators

GreedyGeodesicFollowerImpl(PathFinder::ptr& pathfinder, MoveFn& moveForward, MoveFn& turnLeft, MoveFn& turnRight, double goalDist, double forwardAmount, double turnAmount, bool fixThrashing = true, int thrashingThreshold = 16)
Constructor.

Public functions

auto nextActionAlong(const Magnum::Quaternion& currentRot, const Magnum::Vector3& currentPos, const Magnum::Vector3& end) -> CODES
Calculates the next action to follow the path.
auto findPath(const Magnum::Quaternion& startRot, const Magnum::Vector3& startPos, const Magnum::Vector3& end) -> std::vector<CODES>
Finds the full path from the current agent state to the end location.
auto nextActionAlong(const core::RigidState& start, const Magnum::Vector3& end) -> CODES
auto findPath(const core::RigidState& start, const Magnum::Vector3& end) -> std::vector<CODES>
void reset()
Reset the planner.

Enum documentation

enum class esp::nav::GreedyGeodesicFollowerImpl::CODES: int

Ouputs from the greedy follower.

Used to specify which action to take next or that an error occured

Typedef documentation

typedef std::function<bool(scene::SceneNode*)> esp::nav::GreedyGeodesicFollowerImpl::MoveFn

Helper typedef for function pointer to a function that manipulates a scene node.

These functions are used to get access to the python functions which implement the control functions

Function documentation

esp::nav::GreedyGeodesicFollowerImpl::GreedyGeodesicFollowerImpl(PathFinder::ptr& pathfinder, MoveFn& moveForward, MoveFn& turnLeft, MoveFn& turnRight, double goalDist, double forwardAmount, double turnAmount, bool fixThrashing = true, int thrashingThreshold = 16)

Constructor.

Parameters
pathfinder in Instance of the pathfinder used for calculating the geodesic shortest path
moveForward in Function that implements "move_forward" on a SceneNode
turnLeft in Function that implements "turn_left" on a SceneNode
turnRight in Function that implements "turn_right" on a SceneNode
goalDist in How close the agent needs to get to the goal before calling stop
forwardAmount in The amount "move_forward" moves the agent
turnAmount in The amount "turn_left"/"turn_right" turns the agent in radians
fixThrashing in Whether or not to fix thrashing
thrashingThreshold in The length of left, right, left, right actions needed to be considered thrashing

CODES esp::nav::GreedyGeodesicFollowerImpl::nextActionAlong(const Magnum::Quaternion& currentRot, const Magnum::Vector3& currentPos, const Magnum::Vector3& end)

Calculates the next action to follow the path.

Parameters
currentRot in The current rotation
currentPos in The current position
end in The end location of the path

std::vector<CODES> esp::nav::GreedyGeodesicFollowerImpl::findPath(const Magnum::Quaternion& startRot, const Magnum::Vector3& startPos, const Magnum::Vector3& end)

Finds the full path from the current agent state to the end location.

Parameters
startRot in The starting rotation
startPos in The starting position
end in The end location of the path

void esp::nav::GreedyGeodesicFollowerImpl::reset()

Reset the planner.

Should be called whenever a different goal is choosen or start state differs by more than action from the last start state