Social margin#

#include "navground/core/social_margin.h"
class SocialMargin#

This class defines a modulated social margin that may be added to the safety margin around Neighbor for behaviors that uses the GeometricState. The social margin is assigned to the neighbor’s Neighbor::id and it is modulated by the neighbor current distance.

Public Functions

inline explicit SocialMargin(ng_float_t value = 0)#

Constructs a new instance.

Parameters:

value[in] The default value of social margins

inline std::shared_ptr<Modulation> get_modulation() const#

Gets the modulation.

Returns:

The modulation.

inline void set_modulation(const std::shared_ptr<Modulation> &value)#

Sets the modulation.

Parameters:

value[in] The desired modulation

inline ng_float_t get() const#

Get the value, ignoring type and distance.

Returns:

The social margin

inline void set(ng_float_t value)#

Set the default value, ignoring type.

Parameters:

value[in] The desired social margin

inline ng_float_t get(unsigned type)#

Get the value for a specific type, ignoring distance.

Parameters:

type[in] The neighbor type

Returns:

The social margin

inline void set(unsigned type, ng_float_t value)#

Set the value for the specified type.

Parameters:
  • type[in] The neighbor type

  • value[in] The desired social margin

inline ng_float_t get(unsigned type, ng_float_t distance)#

Get the value for a specific type and distance.

Parameters:
  • type[in] The neighbor type

  • distance[in] The neighbor distance

Returns:

The modulated social margin

inline ng_float_t get_value(unsigned type)#

Gets the stored [non-modulated] value for the specific type.

Parameters:

type[in] The neighbor type

Returns:

The stored social margin

inline ng_float_t get_default_value() const#

Gets the default value.

Returns:

The default social margin.

inline const std::map<unsigned, ng_float_t> &get_values() const#

Gets the stored [non-modulated] values for the specific types.

Returns:

A map of type -> social margin.

inline ng_float_t get_max_value() const#

Gets the maximal possible value across all types.

Returns:

The maximal value.

class ConstantModulation : public navground::core::SocialMargin::Modulation#

A modulation that leaves the margin unchanged.

class LinearModulation : public navground::core::SocialMargin::Modulation#

A modulation that linearly interpolate between 0 and the input margin, returning the input margin above upper_distance

Public Functions

inline explicit LinearModulation(ng_float_t upper_distance)#

Constructs a new instance.

Parameters:

upper_distance[in] The upper distance

class LogisticModulation : public navground::core::SocialMargin::Modulation#

A logistic modulation.

class Modulation#

Abstract modulation: maps a pair (margin, distance) to a margin.

Subclassed by navground::core::SocialMargin::ConstantModulation, navground::core::SocialMargin::LinearModulation, navground::core::SocialMargin::LogisticModulation, navground::core::SocialMargin::QuadraticModulation, navground::core::SocialMargin::ZeroModulation

class QuadraticModulation : public navground::core::SocialMargin::Modulation#

A modulation that quadratically interpolates between 0 and the input margin, returning the input margin above upper_distance. The slope is 0 at distance 0.

class ZeroModulation : public navground::core::SocialMargin::Modulation#

A modulation that always return 0.