Last active
August 29, 2015 14:23
-
-
Save Lichor8/e03b96f78852f924c50b to your computer and use it in GitHub Desktop.
movement.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=================================== | |
// include guard (safety measure) | |
#ifndef MOVEMENT_H // if not defined | |
#define MOVEMENT_H // define | |
//=================================== | |
// forward declared dependencies | |
class Strategy; | |
class Detection; | |
//=================================== | |
// included dependencies | |
#include <iostream> | |
#include <emc/io.h> // embedded motion control package | |
#include <emc/rate.h> | |
#include <ctime> | |
#include <string> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <cmath> // math operation such as sqrt(),cos() | |
#include <math.h> // more math | |
#include "eigen3/Eigen/Dense" | |
#include "picomath.h" | |
//=================================== | |
// the actual class | |
class Movement { | |
private: | |
int status; //status that is returned to main: | |
// 0 = on its way | |
// 1 = arrived at location | |
// 2 = can't reach location due to obstacle in the way | |
int move; // for 180 degree turn | |
int command; | |
int type; // interger for type of movement | |
float vmax; // maximum xy velocity [m/s]; | |
float vmag; // current velocity magnitude in x [m/s] | |
Point current_velocity; // current robot velocity (x,y,theta) [m/s] | |
Point A; | |
Point A_temp; | |
Point B; | |
Point velocity_p2p; | |
Point velocity_colavoid; | |
Point velocity_homing; | |
Point velocity_oneeighty; | |
Point turn; | |
// nlc | |
// velp | |
float dr; | |
float dtheta; // Difference between current orientation of the robot and aim_angle [rad]. | |
// and the difference between the current orientation of the robot and the final | |
// orientation [rad]. | |
float dtheta2; | |
float dr_arrived; // distance to B at which the robot marks: location arrived [m]. | |
float kw; // convergence rate in the rotation of the used non-linear controller [N/rad]; | |
// potf | |
// computational entities | |
// velocity profile | |
void velp(Point Ap, Point Bp); | |
// non-linear controller | |
void nlc(); | |
// potential field | |
void potf(emc::IO &io, emc::LaserData scan); | |
// homing | |
void homing(emc::IO &io, emc::LaserData scan); | |
// oneeighty | |
void oneeighty(emc::IO &io, emc::LaserData scan); | |
public: | |
// coordinators/composers | |
// runs, depending on movement type, the selected computational entities for that type of movement | |
void movement(emc::IO &io, emc::LaserData scan, Detection &det, Strategy &strat); | |
// monitors | |
int monitor(); | |
// int getStatus(); | |
// configurators | |
void setMaxvelocity(float maxvelocity); | |
// class entities | |
// constructors | |
Movement(); | |
// setters | |
// getters | |
Point getVelocity(); | |
}; | |
#endif // CONVERT_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment