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: test_main.cpp
- Revision:
- 20:66513b3c09b7
- Parent:
- 16:66326e4a40b1
- Child:
- 21:2aed81380bc3
--- a/test_main.cpp Thu Nov 03 15:59:30 2016 +0000 +++ b/test_main.cpp Thu Nov 03 16:33:37 2016 +0000 @@ -279,6 +279,13 @@ } } +void getXandY(float &x, float &y) { + float lower = robotController.getLowerArmLength(); + float upper = robotController.getUpperArmLength(); + getRollerPositionForArmLengths(upper, lower, x, y); +} + + /* executes the robot command */ void processCommand(RobotCommand cmd) { if (cmd == robotCommand) return; @@ -286,6 +293,8 @@ robotCommand = cmd; switch (robotCommand) { + float x; + float y; case UP: robotController.paintUp(); break; @@ -293,10 +302,14 @@ robotController.paintDown(); break; case FORWARD: - //TODO + getXandY(x, y); + if (x < 40) + robotController.moveTo(x + 5.0f, y); break; case BACKWARD: - //TODO + getXandY(x, y); + if (x > 5) + robotController.moveTo(x - 5.0f, y); break; case NOTHING: