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.
Fork of linearMirrorMotion1017 by
Revision 14:314b86828ed2, committed 2013-04-05
- Comitter:
- hiromasaoku
- Date:
- Fri Apr 05 08:21:46 2013 +0000
- Parent:
- 13:26263959903b
- Child:
- 15:1d931a305464
- Commit message:
- better (but i understand it should be reverse the procedure of rotation and shearing ...
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 05 07:13:33 2013 +0000
+++ b/main.cpp Fri Apr 05 08:21:46 2013 +0000
@@ -19,7 +19,7 @@
float sint=0, cost=1;
float vx = 0, vy=0;
-float theta=0, dt_betWords=50000, st=400;
+float theta=0, dt_betWords=50000, st=1800;
unsigned int dt=500, ticktime=600;
bool newPositionReady=false;
@@ -33,9 +33,9 @@
int laserSwitch; // laser {1: on 0:off} until next step
};
-point2dl shearing(point2dl dataBefore, float radious, float angularSpeed){
+point2dl shearing(point2dl dataBefore, float velocity){
point2dl dataAfter;
- dataAfter.x = dataBefore.x - radious*angularSpeed*timer_v.read_us()/st/1000; //st is a parameter for ajustment
+ dataAfter.x = dataBefore.x + velocity*timer_v.read_us()/st/1000; //st is a parameter for ajustment
dataAfter.y = dataBefore.y;
dataAfter.laserSwitch = dataBefore.laserSwitch;
@@ -79,7 +79,7 @@
void computeSpeed() {
// We know exactly how much time passed since we last computed the speed, this is PERIODIC_COMPUTE in microseconds
- angularSpeed = ( 1000000.0 * (float)(angle-oldAngle) / (float)(PERIODIC_COMPUTE) + angularSpeed)/2; // in rad/sec
+ angularSpeed = 1000000.0 * (float)(angle-oldAngle) / (float)(PERIODIC_COMPUTE); // in rad/sec
oldAngle=angle;
}
@@ -154,8 +154,10 @@
if (pc.readable()>0) processSerial();
- point2dl sheared = shearing(libletter[inputletters[i]-'a'].letpoints[j] , radious , angularSpeed );
- point2dl rotated = rotation(sheared, angle );
+ point2dl sheared = shearing(libletter[inputletters[i]-'a'].letpoints[j] , radious*angularSpeed );
+ point2dl rotated = rotation(sheared, angle);
+ X = CENTER_AD_MIRROR_X + radious * cost;
+ Y = CENTER_AD_MIRROR_Y + radious * sint;
IO.writeOutXY(X + rotated.x,Y + rotated.y );
/*
