scenario_simulator_v2 C++ API
|
#include <gtest/gtest.h>
#include <geometry/quaternion/euler_to_quaternion.hpp>
#include <geometry/spline/catmull_rom_spline.hpp>
#include <scenario_simulator_exception/exception.hpp>
#include "../expect_eq_macros.hpp"
#include "../test_utils.hpp"
Functions | |
math::geometry::CatmullRomSpline | makeLine () |
Helper function generating line: p(0,0)-> p(1,3) -> p(2,6) More... | |
math::geometry::CatmullRomSpline | makeSlopedLine () |
Helper function generating sloped line: p(0,0,0)-> p(1,3,1) -> p(2,6,2) More... | |
math::geometry::CatmullRomSpline | makeCurve () |
Helper function generating curve: p(0,0)-> p(1,1)-> p(2,0) More... | |
math::geometry::CatmullRomSpline | makeCurve2 () |
Helper function generating curve: p(0,0)-> p(1,1)-> p(0,2) More... | |
void | addOffset (geometry_msgs::msg::Point &point, const double offset, const double theta) |
TEST (CatmullRomSpline, getCollisionPointIn2D_2ControlPoints) | |
Testing the CatmullRomSpline::getCollisionPointIn2D function works valid. In this test case, number of the control points of the catmull-rom spline (variable name spline ) is 2, so the shape of the value spline is line segment. More... | |
TEST (CatmullRomSpline, getCollisionPointIn2D_1ControlPoint) | |
Testing the CatmullRomSpline::getCollisionPointIn2D function works valid In this test case, number of the control points of the catmull-rom spline (variable name spline ) is 1, so the shape of the value spline is single point. More... | |
TEST (CatmullRomSpline, GetCollisionPointIn2D) | |
TEST (CatmullRomSpline, getCollisionPointIn2D) | |
TEST (CatmullRomSpline, getCollisionPointIn2DNoCollision) | |
TEST (CatmullRomSpline, getCollisionPointIn2DPolygon) | |
TEST (CatmullRomSpline, getCollisionPointIn2DEmpty) | |
TEST (CatmullRomSpline, getMaximum2DCurvatureLine) | |
TEST (CatmullRomSpline, getMaximum2DCurvatureCurve) | |
TEST (CatmullRomSpline, getPolygon) | |
TEST (CatmullRomSpline, getPolygonEdge) | |
TEST (CatmullRomSpline, initializationLine) | |
TEST (CatmullRomSpline, initializationCurve) | |
TEST (CatmullRomSpline, getLengthLine) | |
TEST (CatmullRomSpline, getLengthCurve) | |
TEST (CatmullRomSpline, getPointLine) | |
TEST (CatmullRomSpline, getPointCurve) | |
TEST (CatmullRomSpline, getTangentVectorLine) | |
TEST (CatmullRomSpline, getTangentVectorCurve) | |
TEST (CatmullRomSpline, getNormalVectorLine) | |
TEST (CatmullRomSpline, getNormalVectorCurve) | |
TEST (CatmullRomSpline, getPoseLine) | |
TEST (CatmullRomSpline, getPoseLineWithPitch) | |
TEST (CatmullRomSpline, getPoseCurve) | |
TEST (CatmullRomSpline, getPoseCurveWithPitch) | |
TEST (CatmullRomSpline, getSValue1) | |
TEST (CatmullRomSpline, getSValue2) | |
TEST (CatmullRomSpline, getSValueEdge) | |
TEST (CatmullRomSpline, getSquaredDistanceIn2D) | |
TEST (CatmullRomSpline, getSquaredDistanceIn2DSamePoint) | |
TEST (CatmullRomSpline, getSquaredDistanceVector) | |
TEST (CatmullRomSpline, getSquaredDistanceVectorSamePoint) | |
TEST (CatmullRomSpline, getTrajectoryLine) | |
TEST (CatmullRomSpline, getTrajectoryCurve) | |
TEST (CatmullRomSpline, getTrajectoryEmpty) | |
TEST (CatmullRomSpline, initializationNotEnoughControlPoints) | |
int | main (int argc, char **argv) |
Variables | |
constexpr double | EPS = 1e-6 |
void addOffset | ( | geometry_msgs::msg::Point & | point, |
const double | offset, | ||
const double | theta | ||
) |
Add an offset to the given point in a specified direction.
point | The point to which the offset will be added. |
offset | The value of the offset. |
theta | The angle in radians representing the direction. |
int main | ( | int | argc, |
char ** | argv | ||
) |
math::geometry::CatmullRomSpline makeCurve | ( | ) |
Helper function generating curve: p(0,0)-> p(1,1)-> p(2,0)
math::geometry::CatmullRomSpline makeCurve2 | ( | ) |
Helper function generating curve: p(0,0)-> p(1,1)-> p(0,2)
math::geometry::CatmullRomSpline makeLine | ( | ) |
Helper function generating line: p(0,0)-> p(1,3) -> p(2,6)
math::geometry::CatmullRomSpline makeSlopedLine | ( | ) |
Helper function generating sloped line: p(0,0,0)-> p(1,3,1) -> p(2,6,2)
TEST | ( | CatmullRomSpline | , |
GetCollisionPointIn2D | |||
) |
TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2D | |||
) |
TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2D_1ControlPoint | |||
) |
Testing the CatmullRomSpline::getCollisionPointIn2D
function works valid In this test case, number of the control points of the catmull-rom spline (variable name spline
) is 1, so the shape of the value spline
is single point.
spline
has control point with point (x,y,z) = (0,1,0) in the cartesian coordinate system. So, spline
is same as point (x,y,z) = (0,1,0).CatmullRomSpline::getCollisionPointIn2D
function can find the collision point with spline
and a line segment with start point (x,y,z) = (0,1,0) and end point (x,y,z) = (0,-1,0). collision_s
variable in the test case is the denormalized s value in frenet coordinate along the spline
curve. The collision point is in (x,y,z) = (0,0,0) in the cartesian coordinate system and the point is in s=0.0
, So the return value of the CatmullRomSpline::getCollisionPointIn2D
function (variable name collision_s
) should be std::optional<double>(0.0)CatmullRomSpline::getCollisionPointIn2D
function can find that the spline
and a line segment with start point (x,y,z) = (1,1,0) and end point (x,y,z) = (1,-1,0) does not collide. If CatmullRomSpline::getCollisionPointIn2D
function works expected, it returns std::nullopt;TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2D_2ControlPoints | |||
) |
Testing the CatmullRomSpline::getCollisionPointIn2D
function works valid. In this test case, number of the control points of the catmull-rom spline (variable name spline
) is 2, so the shape of the value spline
is line segment.
spline
has control points p0 and p1. Control point p0 is point (x,y,z) = (0,0,0) and control point p1 is point (x,y,z) = (1,0,0) in the cartesian coordinate system.CatmullRomSpline::getCollisionPointIn2D
function can find the collision point with spline
and a line segment with start point (x,y,z) = (0,1,0) and end point (x,y,z) = (0,-1,0). collision_s
variable in the test case is the denormalized s value in frenet coordinate along the spline
curve. The collision point is in (x,y,z) = (0,0,0) in the cartesian coordinate system and the point is in s=0.0
, So the return value of the CatmullRomSpline::getCollisionPointIn2D
function (variable name collision_s
) should be std::optional<double>(0.0)CatmullRomSpline::getCollisionPointIn2D
function can find the collision point with spline
and a line segment with start point (x,y,z) = (1,1,0) and end point (x,y,z) = (-1,-1,0). collision_s
variable in the test case is the denormalized s value in frenet coordinate along the spline
curve. The collision point is in (x,y,z) = (0,0,0) in the cartesian coordinate system and the point is in s=0.0
, So the return value of the CatmullRomSpline::getCollisionPointIn2D
function (variable name collision_s
) should be std::optional<double>(0.0)CatmullRomSpline::getCollisionPointIn2D
function can find the collision point with spline
and a line segment with start point (x,y,z) = (1,1,0) and end point (x,y,z) = (0,-1,0). collision_s
variable in the test case is the denormalized s value in frenet coordinate along the spline
curve. The collision point is in (x,y,z) = (0,0.5,0) in the cartesian coordinate system and the point is in s=0.5
, So the return value of the CatmullRomSpline::getCollisionPointIn2D
function (variable name collision_s
) should be std::optional<double>(0.5)CatmullRomSpline::getCollisionPointIn2D
function can find that the spline
and a line segment with start point (x,y,z) = (0,1,0) and end point (x,y,z) = (0,0.2,0) does not collide. If CatmullRomSpline::getCollisionPointIn2D
function works expected, it returns std::nullopt;TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2DEmpty | |||
) |
TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2DNoCollision | |||
) |
TEST | ( | CatmullRomSpline | , |
getCollisionPointIn2DPolygon | |||
) |
TEST | ( | CatmullRomSpline | , |
getLengthCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getLengthLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getMaximum2DCurvatureCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getMaximum2DCurvatureLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getNormalVectorCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getNormalVectorLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getPointCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getPointLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getPolygon | |||
) |
TEST | ( | CatmullRomSpline | , |
getPolygonEdge | |||
) |
TEST | ( | CatmullRomSpline | , |
getPoseCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getPoseCurveWithPitch | |||
) |
TEST | ( | CatmullRomSpline | , |
getPoseLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getPoseLineWithPitch | |||
) |
TEST | ( | CatmullRomSpline | , |
getSquaredDistanceIn2D | |||
) |
TEST | ( | CatmullRomSpline | , |
getSquaredDistanceIn2DSamePoint | |||
) |
TEST | ( | CatmullRomSpline | , |
getSquaredDistanceVector | |||
) |
TEST | ( | CatmullRomSpline | , |
getSquaredDistanceVectorSamePoint | |||
) |
TEST | ( | CatmullRomSpline | , |
getSValue1 | |||
) |
TEST | ( | CatmullRomSpline | , |
getSValue2 | |||
) |
TEST | ( | CatmullRomSpline | , |
getSValueEdge | |||
) |
TEST | ( | CatmullRomSpline | , |
getTangentVectorCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getTangentVectorLine | |||
) |
TEST | ( | CatmullRomSpline | , |
getTrajectoryCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
getTrajectoryEmpty | |||
) |
TEST | ( | CatmullRomSpline | , |
getTrajectoryLine | |||
) |
TEST | ( | CatmullRomSpline | , |
initializationCurve | |||
) |
TEST | ( | CatmullRomSpline | , |
initializationLine | |||
) |
TEST | ( | CatmullRomSpline | , |
initializationNotEnoughControlPoints | |||
) |
|
constexpr |