Announcement

Collapse
No announcement yet.

Our Robot Won't Start

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

  • Our Robot Won't Start

    Hello. Our team would like to know why our robot is not moving. The gamepad is configured and we have successfully built our code. However, we do not know why it is not working. We have assigned our motors as "leftmotor" and "rightmotor." This is our following code: https://docs.google.com/document/d/1...it?usp=sharing
    Please feel free to comment on our errors and ask questions on our code.
    Last edited by Team Determin8; 03-02-2020, 08:24 PM.

  • #2
    can you make the document public?

    Comment


    • #3
      It should be public.

      Comment


      • #4
        It should now be public: https://docs.google.com/document/d/1...it?usp=sharing

        Comment


        • #5
          If I understand correctly the hardwaremap you create in your hardware class is a different one than in your driver class. You want to pass a reference to the hardwaremap so you're pointing at the one in the driver class. Or just follow the example more carefully.

          From the hardware example -

          public void init(HardwareMap ahwMap) { // Save reference to Hardware map
          hwMap = ahwMap;
          // Define and Initialize Motors
          leftDrive = hwMap.get(DcMotor.class, "left_drive");

          Comment


          • #6
            I am assuming that by not running you mean it is not taking commands from the game pad.

            Is the game pad connection stable. Do you continue to see the game pad symbol at the top of your driver station phone. Disconnects can be common.

            Are you seeing any errors on the screen when you select the teleop program.

            Comment


            • #7
              When I connect the gamepad, it does show on the phone, but I can't make the robot move after moving the right and left sticks or when I press the start and a button at the same time.

              Comment


              • #8
                Originally posted by 3805Mentor View Post
                If I understand correctly the hardwaremap you create in your hardware class is a different one than in your driver class. You want to pass a reference to the hardwaremap so you're pointing at the one in the driver class. Or just follow the example more carefully.

                From the hardware example -

                public void init(HardwareMap ahwMap) { // Save reference to Hardware map
                hwMap = ahwMap;
                // Define and Initialize Motors
                leftDrive = hwMap.get(DcMotor.class, "left_drive");
                Where should I put this? In my robot hardware code or driver controlled?

                Comment


                • #9
                  I don't think the handling of the HardwareMap object is the problem. The DriverControlled.init() method passes its valid HardwareMap object to the RobotHardware.init method. That method
                  uses this HardwareMap parameter to instantiate the leftMotor and rightMotor fields. True, the RobotHardware field named hardwareMap never gets instantiated, but as the code is now, it isn't being used (any attempt to use it would provoke a null reference exception). Suggestions:

                  1. Add some telemetry to display the values you are getting from gamepad1, to make sure it is functioning properly.
                  2. Make sure your motors are plugged in to the same ports on the Rev Expansion Hub that your config file says they are plugged into.

                  Once you get the motors moving, you'll probably need to use setDirection to reverse one of them.

                  Comment


                  • #10

                    JKenney was right. I asked my son to explain it to me. (Proud Dad moment, son was in FTC, graduated CS B.S., working as programmer) . I don't know why the example is written as it is, my son says it is redundant unless hardwareMap is used outside of scope of init in which case this.hardwareMap = hardwareMap or the example code is needed. (If I understood correctly.)

                    I copied and pasted the code you posted into my system, it works for me.

                    Look at the bottom of the robotController phone screen. Do you see the gamepad numbers change?

                    Comment


                    • #11
                      Question: Must I have two gamepads or just one? I want to test to see if the robot drives and I only have one gamepad available. Also, how do I connect the gamepad to the robot?

                      Comment


                      • #12
                        One gamepad is fine. Plug it into the Driver Station phone using a USB OTG cable. Press Start-A on the gamepad to tell the system that it is gamepad 1.

                        Comment


                        • #13
                          And just for clarity, if you want to connect 2 gamepads, the second gamepad is activated by pressing Start - B......

                          Comment


                          • #14
                            Hello. in order to start the robot, should I use the game pad code?

                            Comment


                            • #15
                              https://www.firstinspires.org/sites/...o-tutorial.pdf

                              This is the Android Studio tutorial. I think you need the instructions from page 122 on at this point, but before page 98 it walks you through the robot configuration as well.

                              Basically you want your controller(s) connected to your driver station and selected as a or b before you select the teleop program on the right drop down on the driver station phone.

                              key learnings include:
                              comment out disabled line so that the program is selectable on the phone
                              verify you are connected to the ports you configure ( remember it is 0-3) on phone and expansion hub.
                              verify your WiFi direct is working and phones are connected.
                              expansion hub is green with flashing yellow indicating hub. If blue you are not connecting to the robot phone.

                              Comment

                              Working...
                              X