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:
- 9:91ce72a587ad
- Parent:
- 8:fb082466cfec
diff -r fb082466cfec -r 91ce72a587ad OmniMove.cpp
--- a/OmniMove.cpp Fri Apr 23 09:01:44 2021 +0000
+++ b/OmniMove.cpp Fri Aug 27 06:33:57 2021 +0000
@@ -29,10 +29,10 @@
x = limit(-1,1,x);
y = limit(-1,1,y);
this->Vroll = limit(-1,1,Vroll);
- r = limit(0,1,hypotf(x,y));
- theta = conv_deg(atan2(y,x));
- Vx = r * cos( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
- Vy = r * sin( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
+ this->r = limit(0,1,hypotf(x,y));
+ this->theta = conv_deg(atan2(y,x));
+ this->Vx = r * cos( conv_rad( this->theta ) ) * ( 1 - fabs(this->Vroll) );
+ this->Vy = r * sin( conv_rad( this->theta ) ) * ( 1 - fabs(this->Vroll) );
}
void OmniMove::input_cartesian(float x,float y,float Vroll,float MachineAng){
@@ -46,15 +46,15 @@
}
float OmniMove::output_(int n){
- if( nWheel < 8 ){
- return (float)(Vx*Vx_wheel[n] + Vy*Vy_wheel[n] + Vroll);
+ if( this->nWheel < 8 ){
+ return (float)(this->Vx*this->Vx_wheel[n] + this->Vy*this->Vy_wheel[n] + this->Vroll);
}else{
return 0;
}
}
void OmniMove::output(float *V){
- for(i = 0;i < nWheel;i++){
+ for(i = 0;i < this->nWheel;i++){
V[i] = (float)(Vx*Vx_wheel[i] + Vy*Vy_wheel[i] + Vroll);
}
}