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 QEI biquadFilter
Diff: controller.h
- Revision:
- 12:8295c02d740f
- Parent:
- 7:a80cb6b06320
- Child:
- 18:1c9dc6caab9d
diff -r a80cb6b06320 -r 8295c02d740f controller.h
--- a/controller.h Wed Nov 02 16:29:13 2016 +0000
+++ b/controller.h Thu Nov 03 13:08:44 2016 +0000
@@ -1,5 +1,20 @@
#include "robot.h"
+// Maximum y value the roller can reach
+//const float maxY = h + 0.5 * d + 0.5 * reach;
+// Minimum y value the roller can reach
+//const float minY = h + 0.5 * d - 0.5 * reach;
+// Max x value for which the robot can paint a straight line
+//const float maxX =
+// Min x value for which the robot can paint a straight line
+//const float minX = L_min;
+
+const float topY = h + 0.5 * d + 0.3 * reach;
+const float topX = 35;
+
+const float bottomY = h + 0.5 * d - 0.3 * reach;
+const float bottomX = 35;
+
class RobotController {
private:
// Robot
@@ -9,17 +24,30 @@
// Ticker
Ticker ticker;
// Controllers
+ // -- Controls direct movement for the upper arm
PIDController upperArmController;
+ // -- Controls direct movement for the lower arm
PIDController lowerArmController;
+ // -- Controls the velocity at which the upper arm compensates for the dx induced by the lower arm
+ PIDController upperXController;
+ // -- Controls the velocity at which the lower arm compensates for the dx induced by the upper arm
+ PIDController lowerXController;
+
// Reference arm lengths
volatile float upperArmLengthReference;
volatile float lowerArmLengthReference;
+ // Reference coordinates for straight movement
+ volatile float referenceX;
+ volatile float referenceY;
// Control state flags
volatile bool MOVE_BY_REFERENCE;
volatile bool PAINT_MOVE_UP;
volatile bool PAINT_MOVE_DOWN;
+ // Set all flags to false
+ void clearFlags();
+
void doTick();
public:
@@ -43,7 +71,7 @@
float getUpperArmLength();
float getLowerArmLength();
- // Get the robot object
+ // Get the robot instance
Robot* getRobot();
};