Advertisement
AbraaoAllysson

joystick-C++

Aug 2nd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. cleanDisplay();
  2. // qDebug() << joystick->getAxis(0)<< joystick->getAxis(1)<< joystick->getAxis(2)<< joystick->getAxis(3)<< joystick->getAxis(4)<< joystick->getAxis(5);
  3.  
  4. if(joystick->getButton(5))
  5. {
  6. publish_vel(velpub, 0.15, 0);
  7. }
  8.  
  9. if( (joystick->getAxis(5)<-1) && ( joystick->getAxis(5) != -1) )
  10. {
  11. ui->lbFront->setText("↑");
  12. publish_vel(velpub, 0.15, 0);
  13. }
  14. if( ( joystick->getAxis(5)>0 ) && ( joystick->getAxis(5) != -1) )
  15. {
  16. ui->lbBack->setText("↓");
  17. publish_vel(velpub, 0.15, 0);
  18. }
  19.  
  20. /*
  21. //para cima
  22. if( ( joystick->getAxis(1) < -1) || (joystick->getAxis(5) < -1) )
  23. {
  24. ui->lbFront->setText("↑");
  25. publish_vel(velpub, 0.15, 0);
  26. }
  27. //para baixo
  28. if( ( joystick->getAxis(1) > 0) || (joystick->getAxis(5) > 0) )
  29. {
  30. ui->lbBack->setText("↓");
  31. publish_vel(velpub, -0.15, 0);
  32.  
  33. }
  34. //para lado direito
  35. if((joystick->getAxis(0)>0) || (joystick->getAxis(4)>0))
  36. {
  37. ui->lbRigth->setText("→");
  38. publish_vel(velpub, 0, -1.2);
  39. }
  40. //para lado esquerdo
  41. if((joystick->getAxis(0) < -1) || (joystick->getAxis(4) < -1 ))
  42. {
  43. ui->lbLeft->setText("←");
  44. publish_vel(velpub, 0, 1.2);
  45.  
  46. }
  47.  
  48. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement