Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: OmniMove.cpp
- Revision:
- 5:333ed75dd3f1
- Parent:
- 4:4d94b6148a0a
- Child:
- 6:fac3dcaebe83
--- a/OmniMove.cpp Fri Mar 26 01:55:13 2021 +0000
+++ b/OmniMove.cpp Sat Mar 27 11:14:59 2021 +0000
@@ -2,7 +2,7 @@
#include "math.h"
#include "OmniMove.h"
-void OmniMove::setup(int nWheel,float fstWheelAng){
+void OmniMove::setup(int nWheel,double fstWheelAng){
this->nWheel = limit(3,8,nWheel);
for(i = 0;i < nWheel; i++){
@@ -11,7 +11,7 @@
}
}
-void OmniMove::input_polar(float r,float theta,float Vroll,float roll_ratio){
+void OmniMove::input_polar(double r,double theta,double Vroll,double roll_ratio){
r = limit(0,1,r);
Vroll = limit(-1,1,Vroll);
roll_ratio = limit(0,1,roll_ratio);
@@ -20,7 +20,7 @@
Vroll = Vroll * roll_ratio;
}
-void OmniMove::input_polar(float r,float theta,float Vroll,float roll_ratio,float MachineAng){
+void OmniMove::input_polar(double r,double theta,double Vroll,double roll_ratio,double MachineAng){
r = limit(0,1,r);
Vroll = limit(-1,1,Vroll);
roll_ratio = limit(0,1,roll_ratio);
@@ -29,7 +29,7 @@
Vroll = Vroll * roll_ratio;
}
-void OmniMove::input_cartesian(float x,float y,float Vroll,float roll_ratio){
+void OmniMove::input_cartesian(double x,double y,double Vroll,double roll_ratio){
x = limit(-1,1,x);
y = limit(-1,1,y);
Vroll = limit(-1,1,Vroll);
@@ -41,7 +41,7 @@
Vroll = Vroll * roll_ratio;
}
-void OmniMove::input_cartesian(float x,float y,float Vroll,float roll_ratio,float MachineAng){
+void OmniMove::input_cartesian(double x,double y,double Vroll,double roll_ratio,double MachineAng){
x = limit(-1,1,x);
y = limit(-1,1,y);
Vroll = limit(-1,1,Vroll);
@@ -53,7 +53,7 @@
Vroll = Vroll * roll_ratio;
}
-float OmniMove::output_(int n){
+double OmniMove::output_(int n){
if( nWheel < 8 ){
return Vx*Vx_wheel[n] + Vy*Vy_wheel[n] + Vroll;
}else{
@@ -61,13 +61,13 @@
}
}
-void OmniMove::output(float *V){
+void OmniMove::output(double *V){
for(i = 0;i < nWheel;i++){
V[i] = Vx*Vx_wheel[i] + Vy*Vy_wheel[i] + Vroll;
}
}
-float OmniMove::limit(float min,float max,float _value){
+double OmniMove::limit(double min,double max,double _value){
if(_value > max){
return max;
}else if(_value < min){
@@ -77,10 +77,10 @@
}
}
-float OmniMove::conv_deg(float _rad){
+double OmniMove::conv_deg(double _rad){
return _rad * 180 / 3.14159265;
}
-float OmniMove::conv_rad(float _deg){
+double OmniMove::conv_rad(double _deg){
return 3.14159265 * _deg / 180;
}