Announcement

Collapse
No announcement yet.

@TeleOp @Autonomous annotations

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

  • @TeleOp @Autonomous annotations

    I've been tinkering around with Android programming for a few years, but this FTC SDK is the first time I've used custom annotations. I've been reading up on them, and as near as I can tell, the annotations are really meant to be used as meta data for the code, such as when building javadocs. But it seems here we are using the annotations to actually do runtime things, such as determining what opmode you are in. I'm not criticizing. I'm just trying to understand the annotations better.

    Are we using the annotations in way in which they weren't exactly designed for? Or is this pretty common use of annotations?

  • #2
    Hi,

    The annotations as used in the FTC SDK are metadata, letting the FTC runtime know that the class is a specific type of OpMode (Tele-op vs. Auto), and giving it a human-readable name, a grouping, etc. This is an industry-standard usage of Java annotations.

    (note that the "type" Tele-op vs. Auto, is effectively just another grouping, and enables a timer at the driver station. It doesn't change the programming model. Both are OpModes, and developers are free to choose linear or plain op-modes for both tele-op and autonomous programs).

    - Mark

    Comment

    Working...
    X