Skip to content

Emit stack trace when RUN_TO_POSITION steps are done out of order #1345

Closed
@Iris-TheRainbow

Description

@Iris-TheRainbow

The Lynx firmware level positional PID provided by RUN_TO_POSITION is an easy way to achieve position control without a team rolling their own PID or using one from a library. However, it does have an issue that is very easy to run in to, even on accident.

Because the position control is run at the firmware level, it is possible to "confuse" a Lynx module until power is cycled by setting the run mode for a DcMotor to RUN_TO_POSITION before you set a target position with .setTargetPosition(). Currently, the SDK basically does no handling of this error, only showing an error on the Driver Station where telemetry is found. There is no stack trace available on the Driver Station or in the robot log.

This makes it very difficult for even experienced programmers to locate where something has gone wrong. With my understanding of the SDK, the class TargetPositionNotSetException should be able to throw a stack trace or add one to the robot log, which would make it easier to correct RUN_TO_POSITION errors.

Ideally, there could be a mechanism to catch the error before it causes a fatal error on the Lynx module, not necessitating the power cycle, though that is a much more complex fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions