Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

The get*() methods that are used to access SmartDashboard can fail silently #21

Open

Description

@brettle

I'm referring to methods like this one:

public int getButton(String key, int def) {
if (!SmartDashboard.containsKey(key)) {
SmartDashboard.putNumber(key, def);
}
return (int) SmartDashboard.getNumber(key, def);
}

Consider what happens if there is already an entry with the requested key but it is of a different type.

Activity

  1. dfang314 commented on Jan 17, 2018

    @dfang314
    Contributor

    It would just return the default. However, this should never be the case since the convention I already set (and tbh will most likely change, this is one great reason why it shouldn't change) is greatly specific ("such as 'Button/Shift Drive' or 'Port/LeftTalonSRXDrive' [the booleans are a separate matter that will be dealt with (hopefully) tomorrow to the existing standard]) therefore imo at least there is no worry about overlap of keys. (Sorry for so many parentheses so here's some more)

  2. brettle commented on Jan 17, 2018

    @brettle
    MemberAuthor

    "this should never be the case" + "convention" + Murphy's Law = "this is bound to happen at some point"

    My concern here is with the fact that there is no indication that this unexpected condition has occurred. Simply logging the error is sufficient.

  3. dfang314 commented on Feb 10, 2018

    @dfang314
    Contributor

    Added printing to Standard Error in last commit (currently in a pull request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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