Summer 19 code
Dependencies: wheelchaircontrol
Revision 18:94ae9ca5a709, committed 2019-07-02
- Comitter:
- t1jain
- Date:
- Tue Jul 02 17:49:41 2019 +0000
- Parent:
- 17:770a161346ed
- Commit message:
- Cloned as Version 1.0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
wheelchaircontrol.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 770a161346ed -r 94ae9ca5a709 main.cpp --- a/main.cpp Tue Jul 02 16:41:38 2019 +0000 +++ b/main.cpp Tue Jul 02 17:49:41 2019 +0000 @@ -4,19 +4,18 @@ DigitalIn pt3(D10, PullUp); // Pull up resistors to read analog signals into digital signals DigitalIn pt4(D9, PullUp); -/*added*/ -//DigitalIn e_button(D4); // Emergency button will start at HIGH +DigitalIn e_button(D6, PullDown); // Change to PullUp if testing without Emergency Button Connected QEI wheelS (D7, D8, NC, 1200); // Initializes Left encoder DigitalIn pt1(D7, PullUp); // Pull up resistors to read analog signals into digital signals DigitalIn pt2(D8, PullUp); int max_velocity; -//Timer testAccT; AnalogIn x(A0); // Initializes analog axis for the joystick AnalogIn y(A1); + //Watchdog limit should be 0.1; Set to 1 for Testing Only double watchdogLimit = 1; // Set timeout limit for watchdog timer in seconds int buttonCheck = 0; @@ -24,8 +23,10 @@ DigitalOut up(D12); // Turn up speed mode for joystick DigitalOut down(D13); // Turn down speed mode for joystick -DigitalOut on(D14); // Turn Wheelchair On -DigitalOut off(D15); // Turn Wheelchair Off + +PwmOut on(PE_6); // Turn Wheelchair On +PwmOut off(PE_5); // Turn Wheelchair Off + bool manual = false; // Turns chair joystic to automatic and viceverza Serial pc(USBTX, USBRX, 57600); // Serial Monitor @@ -53,6 +54,7 @@ Thread compass; // Thread for compass Thread velocity; // Thread for velosity Thread ToFSafe; // Thread for safety stuff +Thread emergencyButton; // Thread to check button state and reset device int main(void) @@ -61,18 +63,21 @@ nh.advertise(chatter); nh.advertise(chatter2); nh.subscribe(sub);*/ - //testAccT.start(); 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::ToFSafe_thread); // Sets up sampling frequency of the velosity_thread - //queue.call_every(200, rosCom_thread); // Sets up sampling frequency of the velosity_thread + //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 velocity thread + queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::ToFSafe_thread); // Sets up sampling frequency of the ToF safety thread + //queue.call_every(200, rosCom_thread); // Sets up sampling frequency of the ROS com thread + queue.call_every(SAMPLEFREQ, &smart, &Wheelchair::emergencyButton_thread); // Sets up sampling frequency of the emergency button 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 - 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 + //compass.start(callback(&queue, &EventQueue::dispatch_forever)); // Starts running the compass thread + velocity.start(callback(&queue, &EventQueue::dispatch_forever)); // Starts running the velocity thread + ToFSafe.start(callback(&queue, &EventQueue::dispatch_forever)); // Starts running the ROS com thread + //ros_com.start(callback(&queue, &EventQueue::dispatch_forever)); // Starts running the ROS com thread + emergencyButton.start(callback(&queue, &EventQueue::dispatch_forever)); // Starts running the emergency button thread + pc.printf("After starting\r\n"); //added
diff -r 770a161346ed -r 94ae9ca5a709 wheelchaircontrol.lib --- a/wheelchaircontrol.lib Tue Jul 02 16:41:38 2019 +0000 +++ b/wheelchaircontrol.lib Tue Jul 02 17:49:41 2019 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/t1jain/code/wheelchaircontrol/#f3585571f11e +https://os.mbed.com/users/t1jain/code/wheelchaircontrol/#b89967adc86c