PX4 Firmware
PX4 Autopilot Software http://px4.io
StraightLine Class Reference

#include <StraightLine.hpp>

Collaboration diagram for StraightLine:

Public Member Functions

 StraightLine (const matrix::Vector3f &pos)
 
 ~StraightLine ()=default
 
void setLineFromTo (const matrix::Vector3f &start, const matrix::Vector3f &end)
 
void setSpeed (const float &speed)
 
void generateSetpoints (matrix::Vector3f &position_setpoint, matrix::Vector3f &velocity_setpoint)
 Generate setpoints on a straight line according to parameters. More...
 
bool isEndReached ()
 Check if the end was reached. More...
 

Private Attributes

const matrix::Vector3f_position
 vehicle position (dependency injection) More...
 
matrix::Vector3f _start
 Start point of the straight line. More...
 
matrix::Vector3f _end
 End point of the straight line. More...
 
float _speed = 1.f
 desired speed between accelerating and decelerating More...
 
bool end_reached = true
 Flag to lock further movement when end is reached. More...
 

Detailed Description

Definition at line 46 of file StraightLine.hpp.

Constructor & Destructor Documentation

◆ StraightLine()

StraightLine::StraightLine ( const matrix::Vector3f pos)
inline

Definition at line 49 of file StraightLine.hpp.

References setLineFromTo(), start(), and ~StraightLine().

Here is the call graph for this function:

◆ ~StraightLine()

StraightLine::~StraightLine ( )
default

Referenced by StraightLine().

Here is the caller graph for this function:

Member Function Documentation

◆ generateSetpoints()

void StraightLine::generateSetpoints ( matrix::Vector3f position_setpoint,
matrix::Vector3f velocity_setpoint 
)

Generate setpoints on a straight line according to parameters.

Parameters
position_setpointreference to the 3D vector with the position setpoint to update
velocity_setpointreference to the 3D vector with the velocity setpoint to update

Definition at line 44 of file StraightLine.cpp.

References f(), math::min(), matrix::Vector< Type, M >::norm(), matrix::Matrix< Type, M, N >::setNaN(), matrix::Vector< Type, M >::unit_or_zero(), and velocity.

Referenced by FlightTaskOrbit::generate_circle_approach_setpoints(), and setSpeed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEndReached()

bool StraightLine::isEndReached ( )
inline

Check if the end was reached.

Returns
false when on the way from start to end, true when end was reached

Definition at line 69 of file StraightLine.hpp.

References end_reached.

Referenced by FlightTaskOrbit::generate_circle_approach_setpoints().

Here is the caller graph for this function:

◆ setLineFromTo()

void StraightLine::setLineFromTo ( const matrix::Vector3f start,
const matrix::Vector3f end 
)

Definition at line 83 of file StraightLine.cpp.

References matrix::Vector< Type, M >::norm_squared(), and start().

Referenced by FlightTaskOrbit::generate_circle_approach_setpoints(), and StraightLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSpeed()

void StraightLine::setSpeed ( const float &  speed)
inline

Definition at line 54 of file StraightLine.hpp.

References _speed, and generateSetpoints().

Referenced by FlightTaskOrbit::generate_circle_approach_setpoints().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _end

matrix::Vector3f StraightLine::_end
private

End point of the straight line.

Definition at line 75 of file StraightLine.hpp.

◆ _position

const matrix::Vector3f& StraightLine::_position
private

vehicle position (dependency injection)

Definition at line 72 of file StraightLine.hpp.

◆ _speed

float StraightLine::_speed = 1.f
private

desired speed between accelerating and decelerating

Definition at line 76 of file StraightLine.hpp.

Referenced by setSpeed().

◆ _start

matrix::Vector3f StraightLine::_start
private

Start point of the straight line.

Definition at line 74 of file StraightLine.hpp.

◆ end_reached

bool StraightLine::end_reached = true
private

Flag to lock further movement when end is reached.

Definition at line 78 of file StraightLine.hpp.

Referenced by isEndReached().


The documentation for this class was generated from the following files: