No announcement yet.

Hardware Map Issue - Servo not found

  • Filter
  • Time
  • Show
Clear All
new posts

  • Hardware Map Issue - Servo not found

    We have a program that compiles with no errors and is based off a program that worked last year. However, when we try running the program on the phones we get told that the servos are not found. It literally says "servo_2 not found". We are using the following command:

    RMbeacon = hardwareMap.servo.get("servo_2");
    Rbeacon = hardwareMap.servo.get("servo_1");

    We did define the servos earlier so that is not the problem and we checked to make sure the name in the phone and program match, it just seems that the program can not call to the servos. Earlier in the code we have a call for the motors that is almost identical (balls = hardwareMap.dcMotor.get("ball_Motor"); ) which the program runs through without errors after initialization. It is only when it hits the line for the servos that is screws up. We have tried changing servos, wires, and servo controllers in case something was glitched - it made no difference.

    Any ideas as to why when the phone looks for servos it cannot find them?
    Is there a new command that we don't know about?
    Can you not just use hardwaremap any more in your code to call for a servo?
    Do you have to write a separate class to define all hardware and call that?

    We are not that skilled at programming which is why we are building off of last year's code that worked so if you could make your answers really basic that would be appreciated.

  • #2
    This error usually occurs if the name in your code (in this case "servo_2") does not match the name of your configuration file on the phone. Check to make sure that the configuration file does indeed say "servo_2". You could also try to delete and recreate the configuration file. As for your questions, the code for a servo is the same as last year, and uses hardwareMap.servo.get("servo_2"). The error is most likely to be from a typo in the config file. If there doesn't seem to be one, can you post both that and a logcat?
    Lead programmer for team 6287, Vertigo


    • #3
      Also make sure that the servos were not mistakenly configured as CR servos.


      • #4
        This is the only log file that we can find.
        It doesn't really seem to tell us anything. Was there another file or something that we can download to troubleshoot this?

        <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
        <Robot type="FirstInspires-FTC">
        <ServoController name="Servo Controller 2" serialNumber="AL00VM7W">
        <ContinuousRotationServo name="servo_2" port="6" />
        <LegacyModuleController name="Legacy Module 1" serialNumber="AL00XPXF">
        <MotorController name="Motor Controller 3" serialNumber="AL00VV95">
        <Motor name="ball_Motor" port="1" />
        <Motor name="forklift_motor" port="2" />
        <MotorController name="Motor Controller 4" serialNumber="AL00VGEI">
        <Motor name="right_drive1" port="1" />
        <Motor name="right_drive2" port="2" />
        <ServoController name="Servo Controller 5" serialNumber="AL00XOBY">
        <Servo name="door_right" port="1" />
        <ContinuousRotationServo name="servo_1" port="2" />
        <ContinuousRotationServo name="servo_3" port="3" />
        <ContinuousRotationServo name="servo_5" port="4" />
        <ContinuousRotationServo name="servo_4" port="5" />
        <Servo name="door_left" port="6" />
        <MotorController name="Motor Controller 6" serialNumber="AL00VSBB">
        <Motor name="left_drive1" port="1" />
        <Motor name="left_drive2" port="2" />


        • #5
          Originally posted by FTC7743 View Post
          We are using the following command:

          RMbeacon = hardwareMap.servo.get("servo_2");
          Rbeacon = hardwareMap.servo.get("servo_1");
          I believe that the code should be
          Hope this helps.


          • #6
            I believe that it appears your configuration file says they are continuous rotation servos, but the code you are using says they are not. So, if they are indeed continuous rotation servos, change your code to refer to them as such. If they are not continuous rotation servos, change your configuration file accordingly.