a

Dependencies:   mbed mbed-rtos

Committer:
alexpirciu
Date:
Thu Mar 28 07:44:42 2019 +0000
Revision:
1:ceee5a608e7c
assa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alexpirciu 1:ceee5a608e7c 1 /**
alexpirciu 1:ceee5a608e7c 2 ******************************************************************************
alexpirciu 1:ceee5a608e7c 3 * @file BezierMotionPlanner.hpp
alexpirciu 1:ceee5a608e7c 4 * @author RBRO/PJ-IU
alexpirciu 1:ceee5a608e7c 5 * @version V1.0.0
alexpirciu 1:ceee5a608e7c 6 * @date day-month-year
alexpirciu 1:ceee5a608e7c 7 * @brief This file contains the class declaration for the Bezier Motion
alexpirciu 1:ceee5a608e7c 8 * Planner methods.
alexpirciu 1:ceee5a608e7c 9 ******************************************************************************
alexpirciu 1:ceee5a608e7c 10 */
alexpirciu 1:ceee5a608e7c 11
alexpirciu 1:ceee5a608e7c 12 /* include guard */
alexpirciu 1:ceee5a608e7c 13 #ifndef MOTIONPLANNER_HPP
alexpirciu 1:ceee5a608e7c 14 #define MOTIONPLANNER_HPP
alexpirciu 1:ceee5a608e7c 15
alexpirciu 1:ceee5a608e7c 16 #include <complex>
alexpirciu 1:ceee5a608e7c 17 #include <utility>
alexpirciu 1:ceee5a608e7c 18 #include <math.h>
alexpirciu 1:ceee5a608e7c 19 #include <BezierCurve/BezierCurve.hpp>
alexpirciu 1:ceee5a608e7c 20
alexpirciu 1:ceee5a608e7c 21 /* Module defines */
alexpirciu 1:ceee5a608e7c 22 #define WHEELBASE 0.265
alexpirciu 1:ceee5a608e7c 23
alexpirciu 1:ceee5a608e7c 24 namespace planner{
alexpirciu 1:ceee5a608e7c 25
alexpirciu 1:ceee5a608e7c 26 /** CBezierMotionPlanner class.
alexpirciu 1:ceee5a608e7c 27 * @brief This class implements the functionality of planner to keep the robot on the given Bezier curve.
alexpirciu 1:ceee5a608e7c 28 *
alexpirciu 1:ceee5a608e7c 29 */
alexpirciu 1:ceee5a608e7c 30 class CBezierMotionPlanner
alexpirciu 1:ceee5a608e7c 31 {
alexpirciu 1:ceee5a608e7c 32 public:
alexpirciu 1:ceee5a608e7c 33 /* Constructor */
alexpirciu 1:ceee5a608e7c 34 CBezierMotionPlanner();
alexpirciu 1:ceee5a608e7c 35 /* Constructor */
alexpirciu 1:ceee5a608e7c 36 CBezierMotionPlanner(bool isForward,
alexpirciu 1:ceee5a608e7c 37 std::complex<float> a,
alexpirciu 1:ceee5a608e7c 38 std::complex<float> b,
alexpirciu 1:ceee5a608e7c 39 std::complex<float> c,
alexpirciu 1:ceee5a608e7c 40 std::complex<float> d,
alexpirciu 1:ceee5a608e7c 41 float motion_duration_i,
alexpirciu 1:ceee5a608e7c 42 float timestep_i);
alexpirciu 1:ceee5a608e7c 43 /* Set parameters */
alexpirciu 1:ceee5a608e7c 44 void setMotionPlannerParameters(bool isForward,
alexpirciu 1:ceee5a608e7c 45 std::complex<float> a,
alexpirciu 1:ceee5a608e7c 46 std::complex<float> b,
alexpirciu 1:ceee5a608e7c 47 std::complex<float> c,
alexpirciu 1:ceee5a608e7c 48 std::complex<float> d,
alexpirciu 1:ceee5a608e7c 49 float motion_duration_i,
alexpirciu 1:ceee5a608e7c 50 float timestep_i);
alexpirciu 1:ceee5a608e7c 51 /* Destructor */
alexpirciu 1:ceee5a608e7c 52 virtual ~CBezierMotionPlanner();
alexpirciu 1:ceee5a608e7c 53 /* Get Bezier Curve */
alexpirciu 1:ceee5a608e7c 54 math::BezierCurve<float> getBezierCurve();
alexpirciu 1:ceee5a608e7c 55 // Velocity longitudinal and angular
alexpirciu 1:ceee5a608e7c 56 /* Get next velocity value */
alexpirciu 1:ceee5a608e7c 57 std::pair<float,float> getNextVelocity();
alexpirciu 1:ceee5a608e7c 58 // Velocity longitudinal and angular, Input value [0,1]
alexpirciu 1:ceee5a608e7c 59 /* Get velocity value */
alexpirciu 1:ceee5a608e7c 60 std::pair<float,float> getVelocity(float input_value);
alexpirciu 1:ceee5a608e7c 61 /* Next value valid */
alexpirciu 1:ceee5a608e7c 62 bool hasValidValue();
alexpirciu 1:ceee5a608e7c 63 /* Is movement forward */
alexpirciu 1:ceee5a608e7c 64 bool getForward();
alexpirciu 1:ceee5a608e7c 65
alexpirciu 1:ceee5a608e7c 66 private:
alexpirciu 1:ceee5a608e7c 67 /* forward movement indicator */
alexpirciu 1:ceee5a608e7c 68 bool isForward;
alexpirciu 1:ceee5a608e7c 69 /* Bezier Curve object */
alexpirciu 1:ceee5a608e7c 70 math::BezierCurve<float> bezierCurve;
alexpirciu 1:ceee5a608e7c 71 /* motion duration */
alexpirciu 1:ceee5a608e7c 72 float motion_duration;
alexpirciu 1:ceee5a608e7c 73 /* time step */
alexpirciu 1:ceee5a608e7c 74 float time_step;
alexpirciu 1:ceee5a608e7c 75 /* Bezier value input step */
alexpirciu 1:ceee5a608e7c 76 float bezierValueInput_step;
alexpirciu 1:ceee5a608e7c 77 /* next Bezier value */
alexpirciu 1:ceee5a608e7c 78 float next_bezierValueInput;
alexpirciu 1:ceee5a608e7c 79 /* intialization indicator */
alexpirciu 1:ceee5a608e7c 80 bool isInitialized;
alexpirciu 1:ceee5a608e7c 81 };
alexpirciu 1:ceee5a608e7c 82
alexpirciu 1:ceee5a608e7c 83 }; // namespace planner
alexpirciu 1:ceee5a608e7c 84
alexpirciu 1:ceee5a608e7c 85 #endif // CMotionPlanner_HPP
alexpirciu 1:ceee5a608e7c 86