added code to ToF and inserted the e_button
Dependencies: Version1-4
Dependents: Version1-4 Version1-3
Diff: main.cpp
- Revision:
- 14:67133c127740
- Parent:
- 13:7fe71170d157
- Child:
- 17:770a161346ed
--- a/main.cpp Mon Jul 01 16:36:54 2019 +0000 +++ b/main.cpp Mon Jul 01 21:39:44 2019 +0000 @@ -17,7 +17,7 @@ AnalogIn x(A0); //Initializes analog axis for the joystick AnalogIn y(A1); -double watchdogLimit = 0.1; // Set timeout limit for watchdog timer in seconds +double watchdogLimit = 1; //Should be 0.1 // Set timeout limit for watchdog timer in seconds int buttonCheck = 0; int iteration = 1; @@ -51,7 +51,7 @@ Wheelchair smart(xDir,yDir, &pc, &t, &wheel, &wheelS, ToFT); //Initialize wheelchair object Thread compass; //Thread for compass Thread velocity; //Thread for velosity -Thread assistSafe; //thread for safety stuff +Thread ToFSafe; //thread for safety stuff int main(void) @@ -64,12 +64,12 @@ pc.printf("before starting\r\n"); //queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::compass_thread); //Sets up sampling frequency of the compass_thread queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::velocity_thread); //Sets up sampling frequency of the velosity_thread - queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::assistSafe_thread); //Sets up sampling frequency of the velosity_thread + queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::ToFSafe_thread); //Sets up sampling frequency of the velosity_thread //queue.call_every(200, rosCom_thread); //Sets up sampling frequency of the velosity_thread t.reset(); //compass.start(callback(&queue, &EventQueue::dispatch_forever)); //Starts running the compass thread velocity.start(callback(&queue, &EventQueue::dispatch_forever)); //Starts running the velosity thread - assistSafe.start(callback(&queue, &EventQueue::dispatch_forever)); //Starts running the velosity thread + ToFSafe.start(callback(&queue, &EventQueue::dispatch_forever)); //Starts running the velosity thread //ros_com.start(callback(&queue, &EventQueue::dispatch_forever)); //Starts running the velosity thread pc.printf("After starting\r\n"); @@ -142,7 +142,7 @@ wait(process); t.stop(); - pc.printf("Time elapsed: %f seconds and iteration = %d\n", t.read(), iteration); + //pc.printf("Time elapsed: %f seconds and iteration = %d\n", t.read(), iteration); dog.Service(); // Service the Watchdog so it does not cause a system reset - "Kicking"/"Feeding" the dog }