Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Errors finding ExpansionHubEx #8

Open
EddieDL opened this issue Oct 27, 2019 · 12 comments
Open

Errors finding ExpansionHubEx #8

EddieDL opened this issue Oct 27, 2019 · 12 comments

Comments

@EddieDL
Copy link

EddieDL commented Oct 27, 2019

It seems like there are issues calling hub = hardwareMap.get(ExpansionHubEx.class, "Expansion Hub 2"); when things aren't "ready". Specifically we receive errors that the device is missing.

OpModeType: LinearOpMode
When call is made: top of runOpMode()
SDK: 5.2
RevExtensions2: 1.2

Scenario1
If we have just deployed code and we connect the hardware back.

Scenario2
Something causes the Robot Controller to reboot.

Scenario3
You disconnect the USB and connect it again.

Resolution
To fix these issues we terminate the Robot Controller app, disconnect the USB, restart the robot hardware. Start the Robot Controller app and wait for it to be completely up (error showing missing hardware), turn on the robot hardware, connect the USB.

Potential Fix
We noticed that in SDK 5.3 there are some fixes to for the external USB Web Cam. Perhaps if we upgrade to the newer version of the SDK it will resolve this?

We also saw references to calling RevExtensions2 init(), but they suggest that you no longer need to do this.

@David10238
Copy link

As for calling init, a recent version of RE2 removed the need. Idk what version that was though.

@EddieDL
Copy link
Author

EddieDL commented Oct 27, 2019

@David10238 it looks like it was added in 1.2. I also wonder if the following code is the issue. The comments talk about not wanting to "hotswap" the hardware map if we are in the stop opmode.

            if(!(opMode instanceof OpModeManagerImpl.DefaultOpMode))
            {
                RobotLog.dd("RevExtensions2", "Hotswapping hardware map");
                Utils.hotswapHardwareMap();
            }

UPDATE: Nevermind, this code is running in onOpModePreInit() so it is running for all opmodes except stop.

@Windwoes
Copy link
Member

@EddieDL If you connect to the Robot Controller using wireless ADB and watch logcat (filtering for the RevExtensions2 tag) during a failed run, is Hotswapping hardware map printed?

@Windwoes
Copy link
Member

@EddieDL I just tested v1.2 on actual hardware in various different states (e.g. starting the opmode without ExH connected, redeploying RC without hardware connected and then connecting hardware and starting OpMode, etc.) and was not able to reproduce. Is the Hub that you're trying to read from a master or a slave?

@EddieDL
Copy link
Author

EddieDL commented Oct 27, 2019

@FROGbots-4634 thanks for the quick response. I can't play with actual hardware today, but I will grab some logs tomorrow.

Currently we are only using one ExpansionHub.

I am also going to upgrade to SDK 5.3 and see if that changes anything.

@EddieDL
Copy link
Author

EddieDL commented Oct 29, 2019

After upgrading to SDK 5.3 things are WAY better. It seems like our real problem had something to do with the SDK not finding the hub in general. We are using an External USB Camera, and there are fixes for that in SDK 5.3. My guess is that resolved this for us.

Thanks for your help.

@EddieDL EddieDL closed this as completed Oct 29, 2019
@Windwoes
Copy link
Member

Windwoes commented Nov 4, 2019

I'm re-opening this because I've looked at what changed in 5.3 and I can't see any reason why that would fix anything. I think this still needs to be looked into.

@Windwoes Windwoes reopened this Nov 4, 2019
@EddieDL
Copy link
Author

EddieDL commented Nov 13, 2019

@FROGbots-4634 Just to be clear, we are still having issues. I am just not sure if it is related to using ExpansionHubEx or something else. When I said things were improved in 5.3, I think the thing that helped were the improvements to the way external web cams are handled. We are using two on our competition robot and I think that was perhaps exacerbating this issue.

We are still having serious problems with static/disconnects on our robot so we are continuing to investigate this issue.

@Windwoes
Copy link
Member

Windwoes commented Nov 13, 2019

@EddieDL the "the improvements to the way external web cams are handled" was nothing more than changing the app to only use 32-bit native libraries (instead of using 64-bit on supported devices...). Furthermore, those native libraries are only used for webcams/Vuforia. They have no impact on Expansion Hubs or MR controllers.

@Windwoes
Copy link
Member

Windwoes commented Dec 3, 2019

Two other people have hit this issue, so it appears to not be related to your setup. I may end up pushing a hotfix to revert the automatic swapping, since that seems(?) to be what's causing the issue...

@EddieDL
Copy link
Author

EddieDL commented Dec 3, 2019

@FROGbots-4634 I am not sure if you should switch back. We still have this happen, but it is almost always due to starting the RC by plugging it into the robot. Which is easily remedied by restarting the robot. Overall, it is more of a nuisance. Which is probably why I haven't tried rolling back :( I will see if I can test rolling back soon.

If others are having significant issues with this, my suggestion would be to do things to address general ESD/connection issues. That seems to have been what REALLY helped us. Below are the specific things we did, which are mostly pretty standard. We just didn't take the time before our first competition :(

  • New high quality cable to connect the phone to the Rev Hub.
  • Ferite beads on all communication wires.
  • Cover any exposed wiring. Even when you think they are all covered, tape connections. Specifically
    and I2C, PWM connections (servo wires), which usually have exposed metal from the pins.
  • We replaced polycarb with elctro capacitive and electro conductive plastic.
  • Better wire management (right length cables, less connectors, strain relief).

@OviedoRobotics
Copy link

We get an error casting DcMotorEx to RevExtensionsMotor occasionally

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants