Announcement

Collapse
No announcement yet.

Need Help Operating Servos

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

  • Need Help Operating Servos

    I am Samuel Tukua of team 11857 and this is my first year on the robotics team. I am trying to get the servos to work, however, they refuse to do so. So far I have a hardware map file that identifies the servo and sets its initial position (0.0) and direction (Forward). Then, in the Op mode that I have been using, the servo is set to a new position (0.3) with a single line. The servo does not move at all when the Op mode is run or when the hardware map is initialized, what do I need to do.

    EDIT: This is all of the code that pertains to the servo that I have, all other parts work:
    \\
    waitForStart();
    Dismount();
    Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
    IMUDrive(DRIVE_SPEED,25,0);
    IMUDrive(DRIVE_SPEED, 50, 90);
    IMUDrive(DRIVE_SPEED,47,135);
    PlaceMarker();
    IMUDrive(DRIVE_SPEED,78,-45);
    \\
    private void PlaceMarker() {
    while((oppreborn.placeMarker.getPosition()!= .4) && (opModeIsActive())) { oppreborn.placeMarker.setPosition(.4);
    idle();
    \\
    public Servo placeMarker = null;
    \\
    placeMarker =hwMap.get(Servo.class,"place_marker");
    \\
    placeMarker.setDirection(Servo.Direction.FORWARD);
    \\
    placeMarker.setPosition(0.5); \\
    Last edited by Patriotrons; 12-04-2018, 05:57 PM.

  • #2
    Please post your code.

    Comment


    • #3
      3805Mentor I just added code as an edit that includes mention of the servo. If you'd like for me to add more then I can link to my Github.
      Last edited by Patriotrons; 12-04-2018, 06:03 PM.

      Comment


      • #4
        Are you sure the servo is plugged into the Hub the right way? It fits either way but only works one way.
        Don't see why it wouldn't work from the snippet, but it is unnecessarily complex. There is no signal back to the controller where the servo is. getPosition reports the last setPosition, so after the first time through the loop getPosition will be at .4 and it will exit the loop, even though the servo is probably still moving.

        Also the init position you set is .5, you're moving it to 0.4, 18 degrees.

        Comment


        • #5
          Did you program your servo with an SRS programmer because it won't know what the numbers mean unless you program it with that device. That might be why it doesn't move because it doesn't know what the numbers mean.

          Comment

          Working...
          X