Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
galaxis Namespace Reference

Namespaces

 autopilot
 
 camera
 
 control
 
 controllerSettings
 
 Errors
 
 lina
 
 map
 
 math
 
 motorSettings
 
 ros
 
 serviceStates
 
 servoSettings
 
 utils
 

Classes

struct  line_markings_reference_t
 
class  PolySpline
 
class  ROSHeartbeat
 

Typedefs

typedef std::vector< float > polynom
 
typedef std::tuple< float, float > interval
 

Functions

std::ostream & operator<< (std::ostream &strm, polynom const &poly)
 
std::ostream & operator<< (std::ostream &strm, interval const &interval)
 
float calculate_error_between_polyspline_point (shared_ptr< PolySpline > p_polySpline, Eigen::Vector2f &p_point)
 
float calculate_error_between_polyspline_point_square (shared_ptr< PolySpline > p_polySpline, Eigen::Vector2f const &p_point)
 
float calculate_error_between_polyspline_poseseries (shared_ptr< PolySpline > p_polySplineSPtr, shared_ptr< galaxis::control::CarPoseSeries > p_poseSeriesSPtr, shared_ptr< line_markings_reference_t > p_lineMarkings, float cross_angle_weight, float cross_line_weight)
 
float calculate_error_between_polyspline_point_square (shared_ptr< PolySpline > p_polySpline, Eigen::Vector2f &p_point)
 
float calculate_error_between_polyspline_point (PolySpline p_polySpline, Eigen::Vector2f &p_point)
 

Typedef Documentation

◆ interval

typedef std::tuple<float, float> galaxis::interval

Definition at line 21 of file poly.hpp.

◆ polynom

typedef std::vector<float> galaxis::polynom

Definition at line 20 of file poly.hpp.

Function Documentation

◆ calculate_error_between_polyspline_point() [1/2]

float galaxis::calculate_error_between_polyspline_point ( PolySpline  p_polySpline,
Eigen::Vector2f &  p_point 
)

Definition at line 126 of file poly.cpp.

126  {
127  // TODO: maxbe calc correct distance between polynom and
128  // log_warning("poly.hpp: galaxis::utils::calculate_error_between_polyspline_point - correct distance implementation missing");
129 
130  float splinevalue = p_polySpline.evaluate(static_cast<float>(p_point[0]));
131  float error = p_point[1] - splinevalue;
132 
133  return error;
134  }

References galaxis::PolySpline::evaluate().

Here is the call graph for this function:

◆ calculate_error_between_polyspline_point() [2/2]

float galaxis::calculate_error_between_polyspline_point ( shared_ptr< PolySpline >  p_polySpline,
Eigen::Vector2f &  p_point 
)

Referenced by calculate_error_between_polyspline_poseseries().

Here is the caller graph for this function:

◆ calculate_error_between_polyspline_point_square() [1/2]

float galaxis::calculate_error_between_polyspline_point_square ( shared_ptr< PolySpline >  p_polySpline,
Eigen::Vector2f &  p_point 
)

Definition at line 116 of file poly.cpp.

116  {
117  // TODO: maxbe calc correct distance between polynom and
118  // log_warning("poly.hpp: galaxis::utils::calculate_error_between_polyspline_point - correct distance implementation missing");
119 
120  float splinevalue = p_polySpline->evaluate(static_cast<float>(p_point[0]));
121  float error = p_point[1] - splinevalue;
122 
123  return error * error;
124  }

◆ calculate_error_between_polyspline_point_square() [2/2]

float galaxis::calculate_error_between_polyspline_point_square ( shared_ptr< PolySpline >  p_polySpline,
Eigen::Vector2f const &  p_point 
)

Referenced by calculate_error_between_polyspline_poseseries().

Here is the caller graph for this function:

◆ calculate_error_between_polyspline_poseseries()

float galaxis::calculate_error_between_polyspline_poseseries ( shared_ptr< PolySpline >  p_polySplineSPtr,
shared_ptr< galaxis::control::CarPoseSeries >  p_poseSeriesSPtr,
shared_ptr< line_markings_reference_t >  p_lineMarkings,
float  cross_angle_weight,
float  cross_line_weight 
)

Definition at line 136 of file poly.cpp.

138  {
139  float error = 0;
140  // Compute regular error function based on y difference between polynom and series
141  for(shared_ptr<CarPose> pose: *p_poseSeriesSPtr) {
142  error += calculate_error_between_polyspline_point_square(p_polySplineSPtr, pose->position);
143  }
144 
145 
146  // // Compute Angle at each planning point between polynom and series
147  // for(shared_ptr<CarPose> pose: *p_poseSeriesSPtr) {
148 
149  // // We dont use the spline part of polyspline
150  // float poly_gradient = calculate_gradient(p_polySplineSPtr->m_polynomVec.at(0), pose->position[0]);
151 
152  // // Convert gradient to orientation
153  // float poly_orientation = std::tanh(poly_gradient);
154  // float angle_error = poly_orientation - pose->orientation;
155 
156  // error += cross_angle_weight * (angle_error * angle_error);
157  // }
158 
159  if(p_lineMarkings != nullptr){
160  for(shared_ptr<CarPose> pose: *p_poseSeriesSPtr) {
161  //TODO: Check that the pose is in the well defined interval for the line polynoms (tend to be bad outside of the interval)
162  if(p_lineMarkings->isRightEnabled) {
163  float r_error = calculate_error_between_polyspline_point(p_lineMarkings->right, pose->position);
164 
165  if(r_error > 0){
166  error += (r_error * r_error) * cross_line_weight;
167  }
168  }
169 
170  if(p_lineMarkings->isLeftEnabled) {
171  float l_error = calculate_error_between_polyspline_point(p_lineMarkings->left, pose->position);
172 
173  if(l_error < 0){
174  error += (l_error * l_error) * cross_line_weight;
175  }
176  }
177  }
178  }
179 
180  return error;
181  }

References calculate_error_between_polyspline_point(), and calculate_error_between_polyspline_point_square().

Referenced by galaxis::control::TwoAndAHalfCarrots::calculate_best_yaw_rate().

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

◆ operator<<() [1/2]

std::ostream & galaxis::operator<< ( std::ostream &  strm,
interval const &  interval 
)

Definition at line 28 of file poly.cpp.

28  {
29  return strm << "[" << std::get<0>(interval) << ", " << std::get<1>(interval) << "]";
30 }

◆ operator<<() [2/2]

std::ostream & galaxis::operator<< ( std::ostream &  strm,
polynom const &  poly 
)

Definition at line 11 of file poly.cpp.

11  {
12  std::string str = "";
13 
14  if(poly.size() >= 1) {
15  str = std::to_string(poly[0]);
16  str += "x^0";
17  }
18  for(unsigned int i = 1; i < poly.size(); ++i) {
19  str += " + ";
20  str += std::to_string(poly[i]);
21  str += "x^";
22  str += std::to_string(i);
23  }
24 
25  return strm << str;
26 }
galaxis::interval
std::tuple< float, float > interval
Definition: poly.hpp:21
galaxis::calculate_error_between_polyspline_point_square
float calculate_error_between_polyspline_point_square(shared_ptr< PolySpline > p_polySpline, Eigen::Vector2f &p_point)
Definition: poly.cpp:116
galaxis::calculate_error_between_polyspline_point
float calculate_error_between_polyspline_point(PolySpline p_polySpline, Eigen::Vector2f &p_point)
Definition: poly.cpp:126