Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
utils.hpp File Reference
#include <chrono>
#include <functional>
#include <memory>
#include <string>
#include "common_lib/structures/pose.hpp"
#include "common_lib/structures/position.hpp"
#include "control/include/config/parameters.hpp"
#include "custom_interfaces/msg/path_point_array.hpp"
#include "custom_interfaces/msg/pose.hpp"
#include "utils/utils.hpp"
#include "rclcpp/rclcpp.hpp"
Include dependency graph for utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::tuple< common_lib::structures::Position, int, double > get_closest_point (const std::vector< custom_interfaces::msg::PathPoint > &pathpoint_array, const common_lib::structures::Position &position)
 Find the closest point on the path.
 
std::tuple< common_lib::structures::Position, double, bool > get_lookahead_point (const std::vector< custom_interfaces::msg::PathPoint > &pathpoint_array, int closest_point_id, double lookahead_distance, common_lib::structures::Position rear_axis_position, double last_to_first_max_dist)
 Update Lookahead point.
 
common_lib::structures::Position rear_axis_position (const common_lib::structures::Position &cg, double orientation, double dist_cg_2_rear_axis)
 Calculate rear axis coordinates.
 

Function Documentation

◆ get_closest_point()

std::tuple< common_lib::structures::Position, int, double > get_closest_point ( const std::vector< custom_interfaces::msg::PathPoint > &  pathpoint_array,
const common_lib::structures::Position position 
)

Find the closest point on the path.

Parameters
path
rear_axis_point
Returns
std::pair<Point, int> closest point and index

Definition at line 14 of file utils.cpp.

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

◆ get_lookahead_point()

std::tuple< common_lib::structures::Position, double, bool > get_lookahead_point ( const std::vector< custom_interfaces::msg::PathPoint > &  pathpoint_array,
int  closest_point_id,
double  lookahead_distance,
common_lib::structures::Position  rear_axis_position,
double  last_to_first_max_dist 
)

Update Lookahead point.

Parameters
path
Returns
std::tuple<common_lib::structures::Position, double, bool> lookahead point, velocity and error status (1 = error)

Definition at line 35 of file utils.cpp.

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

◆ rear_axis_position()

common_lib::structures::Position rear_axis_position ( const common_lib::structures::Position cg,
double  orientation,
double  dist_cg_2_rear_axis 
)

Calculate rear axis coordinates.

Parameters
cgcenter of gravity position
orientationorientation of the vehicle in radians relative to the world frame (ccw)
dist_cg_2_rear_axisdistance between the center of gravity and the rear axis
Returns
Point

Definition at line 5 of file utils.cpp.

Here is the caller graph for this function: