LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
light::slew Class Reference

Slew-rate limiter that ramps speed up linearly over a configurable distance. More...

#include <slew.hpp>

Classes

struct  Constants
 Slew configuration constants. More...
 

Public Member Functions

 slew ()
 Default constructor.
 
 slew (double distance, int minimum_speed)
 Sets constants for slew.
 
void constants_set (double distance, int minimum_speed)
 Sets constants for slew.
 
Constants constants_get ()
 
void initialize (bool enabled, double maximum_speed, double target, double current)
 Initializes slew for the motion.
 
double iterate (double current)
 Iterates slew and ramps up speed the farther along the motion the robot gets.
 
bool enabled ()
 Returns true if slew is enabled, and false if it isn't.
 
double output ()
 Returns the last output of iterate.
 
void speed_max_set (double speed)
 Sets the max speed the slew can be.
 
double speed_max_get ()
 Returns the max speed the slew can be.
 

Public Attributes

Constants constants
 Active slew constants (read/write).
 

Detailed Description

Slew-rate limiter that ramps speed up linearly over a configurable distance.

Initialize at the start of a motion via initialize(), then call iterate() each cycle with the current sensor position. The output ramps from min_speed to maximum_speed as the robot travels distance_to_travel.

Definition at line 29 of file slew.hpp.

Constructor & Destructor Documentation

◆ slew() [1/2]

light::slew::slew ( )

Default constructor.

Constants must be set via constants_set() before use.

◆ slew() [2/2]

light::slew::slew ( double  distance,
int  minimum_speed 
)

Sets constants for slew.

Slew ramps up the speed of the robot until the set distance is traveled.

Parameters
distancethe distance the robot travels before reaching max speed
minimum_speedthe starting speed for the movement

Member Function Documentation

◆ constants_get()

Constants light::slew::constants_get ( )
Returns
The current slew Constants.

◆ constants_set()

void light::slew::constants_set ( double  distance,
int  minimum_speed 
)

Sets constants for slew.

Slew ramps up the speed of the robot until the set distance is traveled.

Parameters
distancethe distance the robot travels before reaching max speed
minimum_speedthe starting speed for the movement

◆ enabled()

bool light::slew::enabled ( )

Returns true if slew is enabled, and false if it isn't.

◆ initialize()

void light::slew::initialize ( bool  enabled,
double  maximum_speed,
double  target,
double  current 
)

Initializes slew for the motion.

Parameters
enabledtrue enables slew, false disables slew
maximum_speedthe target speed the robot will ramp up too
targetthe target position for the motion
currentthe position at the start of the motion

◆ iterate()

double light::slew::iterate ( double  current)

Iterates slew and ramps up speed the farther along the motion the robot gets.

Parameters
currentcurrent sensor value

◆ output()

double light::slew::output ( )

Returns the last output of iterate.

◆ speed_max_get()

double light::slew::speed_max_get ( )

Returns the max speed the slew can be.

◆ speed_max_set()

void light::slew::speed_max_set ( double  speed)

Sets the max speed the slew can be.

Parameters
speedmaximum speed

Member Data Documentation

◆ constants

Constants light::slew::constants

Active slew constants (read/write).

Definition at line 41 of file slew.hpp.


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