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.
Dependencies: mbed SpeedController Encoder CruizCore_R1370P
Diff: main.cpp
- Revision:
- 21:46b85fee5e88
- Parent:
- 20:acb13e232678
- Child:
- 22:5c78d75fb2f2
--- a/main.cpp Mon Mar 09 08:35:41 2020 +0000
+++ b/main.cpp Mon Mar 09 09:16:48 2020 +0000
@@ -117,10 +117,10 @@
}
void calOmega()
{
- omega[0]=max_*vx_/sqrt(2.0)-max_*vy_/sqrt(2.0)+theta_*k_;
- omega[1]=-max_*vx_/sqrt(2.0)-max_*vy_/sqrt(2.0)+theta_*k_;
- omega[2]=-max_*vx_/sqrt(2.0)+max_*vy_/sqrt(2.0)+theta_*k_;
- omega[3]=max_*vx_/sqrt(2.0)+max_*vy_/sqrt(2.0)+theta_*k_;
+ omega[0]=max_*vx_*cos(45+theta)-max_*vy_*cos(45-theta)+theta_*k_;
+ omega[1]=-max_*vx_*cos(45-theta)-max_*vy_*cos(45+theta)+theta_*k_;
+ omega[2]=-max_*vx_*cos(45+theta)+max_*vy_*cos(45-theta)+theta_*k_;
+ omega[3]=max_*vx_*cos(45-theta)+max_*vy_*cos(45+theta)+theta_*k_;
};
double getOmega(int i)
{
@@ -230,7 +230,7 @@
if(distance<400) {
z=0;
while(1) {
- d=aimTheta[n]-gyro.getAngle();
+ d=aimTheta[n]-theta;
if(d>-10 && d<10) {
break;
}