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 Motor_Feedforward
Diff: main.cpp
- Revision:
- 3:f0d054d896f9
- Parent:
- 2:36a254d3dbf3
- Child:
- 4:0ce97b9fde37
diff -r 36a254d3dbf3 -r f0d054d896f9 main.cpp --- a/main.cpp Thu Aug 08 17:03:30 2019 +0000 +++ b/main.cpp Thu Aug 08 17:39:17 2019 +0000 @@ -26,8 +26,9 @@ { /* Your control loop goes here. */ /* Update torques, position/velocity setpoints, etc */ - motors[0].control.v_des = 5.0f*sin(.01f*loop_counter); + motors[0].control.p_des = 10.0f*sin(.01f*loop_counter); motors[0].control.kd = .5f; + motors[0].control.kp = 1.0f; /* */ for(int i = 0; i<N_MOTORS; i++) @@ -37,7 +38,7 @@ } - printf("%f\n\r", motors[0].state.velocity); // This will print to the computer. Usefull for debugging + printf("%f\n\r", motors[0].state.position); // This will print to the computer. Usefull for debugging loop_counter++; // Increment loop counter } @@ -53,8 +54,8 @@ init_motors(ids); // Initialize the list of motors enable_motor(&motors[0], &can); // Enable first motor - wait(1); // Wait 1 second - disable_motor(&motors[0], &can); // Disable first motor + //wait(1); // Wait 1 second + //disable_motor(&motors[0], &can); // Disable first motor loop.attach(&control, DT); // Start running the contorl interrupt at 1/DT Hz