36 #ifndef __MISCELLANEOUS_H_
37 #define __MISCELLANEOUS_H_
49 #include <Eigen/Dense>
55 #define PFLN {printf("Passing through File [%s] @ Line [%d].\n", __FILE__, __LINE__);}
64 template <
typename Type>
67 int integer=(int)original;
68 Type sub1=(1.0/precision)*(original-(Type)integer);
69 return (Type)integer+precision*((Type)round(sub1));
78 template <
typename Type>
81 #if ROS_VERSION_MINIMUM(1, 8, 0) //At least FUERTE , V. Santos, 27-Mai-2013
82 return (deg * (Type)M_PI / (Type)180.0);
84 return (deg * (Type)arma::datum::pi / (Type)180.0);
94 template <
typename Type>
97 #if ROS_VERSION_MINIMUM(1, 8, 0) //At least FUERTE , V. Santos, 27-Mai-2013
98 return (rad * (Type)180.0 / (Type)M_PI);
100 return (rad * (Type)180.0 / (Type)arma::datum::pi);
124 double pc_mean(
double *v,
int len);
131 Eigen::Matrix3d
rotx(
double angle_in_degrees);
138 Eigen::Matrix3d
roty(
double angle_in_degrees);
145 Eigen::Matrix3d
rotz(
double angle_in_degrees);
159 for(uint i = 0; i < vect.size(); i++)
162 return sum / vect.size();
172 template <
typename Type>
175 if(value >= lower_bound && value < upper_bound)
179 else if(value > lower_bound && value <= upper_bound)
297 void textcolor(
int attr,
int fg,
int bg);
void HighLightText(void)
Make somesort of highlight text.
int GetNbrFromKeyboard(void)
Gets a number from keyboard input.
void print_greeting(shared_vars_t *RobotVars)
Prints to stdout the program greeting.
double get_sign(double x)
Function to determine sign of a given number.
void textcolor(int attr, int fg, int bg)
FUNCTIONS CREATED BY VITOR SANTOS(vitor@ua.pt) | ALL CREDITS GO TO HIM... :-)
types.h file for this module. Contains types and structures used by the application.
bool IsWithinRange(Type value, Type lower_bound, Type upper_bound)
Template function to determine if a given value is within a give range.
Type RadToDeg(Type rad)
Templated radian to degree conversion function.
Type RetrievePrecisionFromDouble(Type original, Type precision)
Retrieve a value cropped with the required precision.
Eigen::Matrix3d rotx(double angle_in_degrees)
Function to calculate rotation matrix over the X axis.
Eigen::Matrix3d roty(double angle_in_degrees)
Function to calculate rotation matrix over the Y axis.
Shared struture that holds robot/device information.
Eigen::Matrix3d rotz(double angle_in_degrees)
Function to calculate rotation matrix over the Z axis.
double GetDblFromKeyboard(void)
Gets a double number from keyboard input.
void PrintRedLine(void)
Printf of an horizontal separator red line.
void print_help(void)
Prints to stdout the program help tips.
void ScreenClear(void)
Sends equivalent shell command "clean" to stdout.
double pc_mean(double *v, int len)
Function to calculate mean value of an array [Taken from http://rosettacode.org/].
void ResetTextColors(void)
Reset color text.
int isNumeric(const char *s)
Function to check if string is numeric.
char GetStrFromKeyboard(void)
Gets a character from keyboard input.
void CalculateAverageCartesianSpeed(double diffX, double diffY, double diffZ, long double time_interval, double *return_vector)
Function acumulate position differences and calculate average speed.
Type DegToRad(Type deg)
Templated degree to radian conversion function.