![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
with pid foward right left foward
Dependencies: wheelchaircontrolRosCom
Fork of wheelchaircontrolrealtime by
Diff: main.cpp
- Revision:
- 6:e9b1684a9c00
- Parent:
- 5:90bf5f0d86e9
- Child:
- 7:04f93e6b929f
--- a/main.cpp Mon Aug 13 21:54:37 2018 +0000 +++ b/main.cpp Wed Aug 15 17:13:55 2018 +0000 @@ -3,11 +3,11 @@ AnalogIn x(A0); AnalogIn y(A1); -DigitalOut off(D0); -DigitalOut on(D1); DigitalOut up(D2); DigitalOut down(D3); -] +DigitalOut on(D12); +DigitalOut off(D11); + bool manual = false; Serial pc(USBTX, USBRX, 57600); @@ -19,12 +19,6 @@ Wheelchair smart(xDir,yDir, &pc, &t); Thread thread; -void messageCb(const std_msgs::String& command){ - myled = 1; // turn on the led - commandRead.data = command.data; -} - -ros::Subscriber<std_msgs::String> sub("toggle_led", &messageCb); int main(void) { @@ -75,9 +69,17 @@ smart.pid_turn(angle); } - } - - else if( c == 'm' || manual) { + } else if(c == 'o') { + pc.printf("turning on\n"); + on = 1; + wait(1); + on = 0; + } else if(c == 'f') { + pc.printf("turning off\n"); + off = 1; + wait(1); + off = 0; + } else if( c == 'm' || manual) { pc.printf("turning on joystick\n"); manual = true; t.reset();