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:
- 8:fb082466cfec
- Parent:
- 7:9b9d488ebcfd
- Child:
- 9:91ce72a587ad
--- a/OmniMove.cpp Mon Apr 12 10:38:12 2021 +0000
+++ b/OmniMove.cpp Fri Apr 23 09:01:44 2021 +0000
@@ -13,36 +13,36 @@
void OmniMove::input_polar(float r,float theta,float Vroll){
r = limit(0,1,r);
- Vroll = limit(-1,1,Vroll);
- Vx = r * cos( conv_rad( theta ) ) * ( 1 - fabs(Vroll) );
- Vy = r * sin( conv_rad( theta ) ) * ( 1 - fabs(Vroll) );
+ this->Vroll = limit(-1,1,Vroll);
+ Vx = r * cos( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
+ Vy = r * sin( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
}
void OmniMove::input_polar(float r,float theta,float Vroll,float MachineAng){
r = limit(0,1,r);
- Vroll = limit(-1,1,Vroll);
- Vx = r * cos( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(Vroll) );
- Vy = r * sin( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(Vroll) );
+ this->Vroll = limit(-1,1,Vroll);
+ Vx = r * cos( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(this->Vroll) );
+ Vy = r * sin( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(this->Vroll) );
}
void OmniMove::input_cartesian(float x,float y,float Vroll){
x = limit(-1,1,x);
y = limit(-1,1,y);
- Vroll = limit(-1,1,Vroll);
+ 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(Vroll) );
- Vy = r * sin( conv_rad( theta ) ) * ( 1 - fabs(Vroll) );
+ Vx = r * cos( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
+ Vy = r * sin( conv_rad( theta ) ) * ( 1 - fabs(this->Vroll) );
}
void OmniMove::input_cartesian(float x,float y,float Vroll,float MachineAng){
x = limit(-1,1,x);
y = limit(-1,1,y);
- Vroll = limit(-1,1,Vroll);
+ 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 - MachineAng ) ) * ( 1 - fabs(Vroll) );
- Vy = r * sin( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(Vroll) );
+ Vx = r * cos( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(this->Vroll) );
+ Vy = r * sin( conv_rad( theta - MachineAng ) ) * ( 1 - fabs(this->Vroll) );
}
float OmniMove::output_(int n){