Geometric#

#include "navground/core/states/geometric.h"
struct LineSegment#

A static obstacle of linear shape.

Public Functions

inline LineSegment(const Vector2 &p1, const Vector2 &p2)#

Constructs a new instance.

Parameters:
  • p1[in] The first vertex

  • p2[in] The second vertex

inline ng_float_t distance_along(const Vector2 &point, const Vector2 &direction, int orientation = 0)#

Computes the free distance along a ray before possibly colliding.

Parameters:
  • point[in] The ray origin

  • direction[in] The ray direction

  • orientation[in] The ray orientation

Returns:

The free distance along the ray before colliding with this line or -1 if no collision will happen.

Public Members

Vector2 p1#

The position of the first vertex

Vector2 p2#

The position of the second vertex

Vector2 e1#

The unit vector along the segment

Vector2 e2#

The unit vector perpendicular to the segment. Oriented to the left with respect to e1

ng_float_t length#

The segment length

struct Disc#

A circular shape. Used to represent obstacles.

Subclassed by navground::core::Neighbor

Public Functions

inline Disc(const Vector2 &position, ng_float_t radius)#

Constructs a new instance.

Parameters:
  • position – The position

  • radius – The radius

inline bool operator==(const Disc &other) const#

Equality operator.

Parameters:

other[in] The other disc

Returns:

True if positions and radii are equal

inline Disc operator+(const Vector2 &delta) const#

Addition operator.

Parameters:

delta[in] A translation vector

Returns:

A copy of the disc translated by delta

inline Disc &operator+=(const Vector2 &delta)#

Addition assignment operator.

Parameters:

delta[in] A translation vector

Returns:

The same disc translated by delta

inline Disc operator-(const Vector2 &delta) const#

Subtraction operator.

Parameters:

delta[in] A translation vector

Returns:

A copy of the disc translated by -delta

inline Disc &operator-=(const Vector2 &delta)#

Subtraction assignment operator.

Parameters:

delta[in] A translation vector

Returns:

The same disc translated by delta

inline bool operator!=(const Disc &other) const#

Inequality operator.

Parameters:

other[in] The other disc

Returns:

Negation of equality

inline ng_float_t distance(const Disc &other) const#

Returns the signed distance to another disc. Negative if the discs overlaps.

Parameters:

other[in] The other disc

Returns:

The distance between the centers minus the radii.

Public Members

Vector2 position#

The center of the disc in world frame

ng_float_t radius#

Velocity in world frame Radius

struct Neighbor : public navground::core::Disc#

A neighbor agent of circular shape.

Public Functions

inline Neighbor(const Vector2 &position, ng_float_t radius, const Vector2 velocity, unsigned id = 0)#

Constructs a new instance.

Parameters:
  • position[in] The position

  • radius[in] The radius

  • velocity[in] The velocity

  • id[in] The identifier

inline explicit Neighbor(const Disc &disc, const Vector2 velocity = Vector2::Zero(), unsigned id = 0)#

Constructs a new instance from a disc.

Parameters:
  • disc[in] The disc

  • velocity[in] The velocity

  • id[in] The id

inline Neighbor &operator=(const Disc &other)#

Assignment operator from a disc.

Parameters:

other[in] The other disc

Returns:

The result of the assignment

inline Neighbor relative_to(const Pose2 &reference)#

Returns the same neighbor in a frame relative to a pose.

Parameters:

reference[in] The reference pose

Returns:

The neighbor with transformed position and velocity

Public Members

Vector2 velocity#

The velocity

unsigned id#

An identifier for the id of agents or the individual agent. The interpretation is up to the behavior.

class GeometricState : public navground::core::EnvironmentState, public navground::core::TrackChanges#

Public Functions

inline const std::vector<Neighbor> &get_neighbors() const#

Gets the current list of neighbors. Positions are in the world fixed frame.

Returns:

The neighbors.

inline virtual void set_neighbors(const std::vector<Neighbor> &value)#

Sets the neighbors. Positions are in the world fixed frame.

Parameters:

value[in]

inline const std::vector<Disc> &get_static_obstacles() const#

Gets the current list of static obstacles. Positions are in the world fixed frame.

Returns:

The static obstacles

inline virtual void set_static_obstacles(const std::vector<Disc> &value)#

Sets the static obstacles. Positions are in the world fixed frame.

Parameters:

value[in]

inline const std::vector<LineSegment> &get_line_obstacles() const#

Gets the current list of line obstacles. Positions are in the world fixed frame.

Returns:

The line obstacles

inline virtual void set_line_obstacles(const std::vector<LineSegment> &value)#

Sets the line obstacles. Positions are in the world fixed frame.

Parameters:

value[in]