Announcement

Collapse
No announcement yet.

Error: User code threw an uncaught exception:

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

  • Error: User code threw an uncaught exception:

    Every time we run our code this shows up
    Error: User code threw an uncaught exception: IllegalArgumentException - Unable to find a hardware device with the name "left_arm"
    We don't have any servos attached, so that is one problem we have.
    And we would like some help to see if it is just a coding or wiring problem.

  • #2
    Your Java code is doing a hardwareMap.dcMotor.get("left_arm") but left_arm is not configured on the robot itself. You'll need to edit the robot configuration on the robot controller and make sure there's a motor (or servo) with that name.

    Comment


    • #3
      we've looked through our code and don't see "left_arm", and we have rewired our robot and re-looked over our stuff but we can't find the problem. We also weren't able to find the hardwareMap.dcMotor.get, any ideas on where it's located? Or would we have to write out the mapping for this? We have taken this code from Github and have followed through the steps we were instructed to do from the pdf document.

      Comment


      • #4
        Originally posted by JacobT View Post
        we've looked through our code and don't see "left_arm", and we have rewired our robot and re-looked over our stuff but we can't find the problem. We also weren't able to find the hardwareMap.dcMotor.get, any ideas on where it's located? Or would we have to write out the mapping for this? We have taken this code from Github and have followed through the steps we were instructed to do from the pdf document.
        It may be under another program which you have open. Only keep the classes that you want on the app open while downloading to the phone.
        R

        Comment


        • #5
          You are using one of the PushbotAutoDrive* op modes, correct? These op modes depend on the class "HardwarePushbot" class, which is in the external/samples directory and uses "left_arm" as shown below:

          Code:
              public void init(HardwareMap ahwMap) {
                  // Save reference to Hardware map
                  hwMap = ahwMap;
          
                  // Define and Initialize Motors
                  leftMotor   = hwMap.dcMotor.get("left_drive");
                  rightMotor  = hwMap.dcMotor.get("right_drive");
                  armMotor    = hwMap.dcMotor.get("left_arm");
          You have to remove or comment all references to 'armMotor' in your code.
          John McDonnell
          Co-Mentor, Team 5873
          https://www.facebook.com/Team5873

          Comment


          • #6
            Originally posted by patfanman101 View Post
            It may be under another program which you have open. Only keep the classes that you want on the app open while downloading to the phone.
            R
            It doesn't matter what window is open or closed, all classes have to compile correctly in order to make the apk.

            Comment


            • #7
              Originally posted by JohnMcDonnell View Post
              You have to remove or comment all references to 'armMotor' in your code.
              To be clear, because the PushbotAutoDrive* op modes depend on the class "HardwarePushbot" class, the "HardwarePushbot" class should be considered part of your code.
              John McDonnell
              Co-Mentor, Team 5873
              https://www.facebook.com/Team5873

              Comment

              Working...
              X