Announcement

Collapse
No announcement yet.

Try/Catch Exceptions for Missing Hardware

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

  • Try/Catch Exceptions for Missing Hardware

    How do you handle "missing" hardware in your code?

    Last year we had Try/Catch blocks for all motors etc... and then checks in the programs to make sure variable is not null before doing anything with it, but these checks have been removed in the samples for this season's SDK.

    For example, last year during a match our gyro cable got cut. The Try/Catch logic handled it without blowing up the program, though of course gyro information couldn't be used. Without those checks in there, wouldn't it just abort the OpMode if something like this happens?

    We also used the configuration file & programs from our competition bot on a smaller testbot (which didn't have all of the servos & motors). The Try/Catch logic also allowed this without aborting, so we could test just certain parts of the program. This year we need to set up configurations with just the actual hardware & comment out any references in the programs to servos, etc... the test bot does not have.

  • #2
    We let the SDK handle it.

    From the SDK Release notes (16.02.09)
    When running an op mode, if one or more modules gets disconnected, the RC & DS will display warnings,and robot will keep on working in spite of the missing module(s).

    Comment


    • #3
      Originally posted by FTC4160 View Post
      We let the SDK handle it.

      From the SDK Release notes (16.02.09)
      We do this too. Before we taped the motor connectors on, they would come disconnected and one wheel would still work.
      -JavaCrash, Programmer for 11496.

      “I am not a product of my circumstances. I am a product of my decisions.” - Stephen Covey

      Comment

      Working...
      X