Announcement

Collapse
No announcement yet.

Using the Joysticks - RobotC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using the Joysticks - RobotC

    After receiving some feedback on the Encoders Tutorial posted a few weeks ago, Say Watt began looking for a new topic to write about. After receiving a few questions about the details of getting Teleop programs to work, we decided to write up a small tutorial on programming Joystick code in RobotC.

    You can find the tutorial here.

  • #2
    How do you code the directional pad?

    Comment


    • #3
      > How do you code the directional pad?

      Here is an example from Team 1001, a few years ago:
      else if(joystick.joy1_TopHat != -1)
      {
      // the top hat buttons say "turn to that compass point".
      int desiRightWallHeading = joystick.joy1_TopHat * (360/8);
      turnStart(); // Remember the starting position
      turn(desiRightWallHeading); // turn until you get to this heading
      }

      joystick.joy1_TopHat is -1 if not pressed, and otherwise 0 through 7. e.g. if it is pushed to the right, that is East, and it will return 2, and the code above will say, "90 degrees".

      yammv.

      Good Luck,
      David Fort
      Mentor, Teams 1001, 4316

      Comment


      • #4
        Our team is using a quadratic equation for converting the joystick values into the motor powers. We haven't tested it yet because our drivetrain is not yet done (we did a really overly complicated design). But, if you have tried this before, does it work well? and if so, you might want to make a tutorial for that too?
        Qingyang Chen
        FTC Team 5485 - PRO, Horseheads, NY
        Sponsored by Corning Inc.
        Join our fan page: http://www.facebook.com/ftcpro

        Comment

        Working...
        X