Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Remove device object cache so there aren't CAN id conflicts #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aar0n-Chung
Copy link
Contributor

@Aar0n-Chung Aar0n-Chung commented Mar 9, 2024

Description

PR written by @rcahoon

We previously had a map from device ID to device object; the map entry is populated the first time that the device with that ID is requested. This allowed e.g. getMotor to be called multiple times and return the same object. This made more sense with software architecture that we used many years ago, but now we ask for each device exactly once in the appropriate Mechanism.

This is now causing problems because it means we can only have one motor with each ID. We now have enough motors of different types that we're out of IDs if we can only have 64 of any motor. We would be ok if we can have 64 of each motor type, which is permitted by the FRC device ID standard.

Thus, we remove the device object maps from the Maroon Framework. The device object will be (re)created when the appropriate method of RobotProvider is called.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Be detailed so that your code reviewer can understand exactly how much and what kinds of testing were done, and which might still be worthwhile to do.

  • Unit tests: [Add your description here]
  • Simulator testing: [Add your description here]
  • On-robot bench testing: [Add your description here]
  • On-robot field testing: [Add your description here]

@Aar0n-Chung Aar0n-Chung requested a review from dejabot March 9, 2024 06:52
Copy link
Contributor

@dejabot dejabot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks!

@rcahoon rcahoon force-pushed the rcahoon/remove-mf-device-cache branch from 58b5f6a to d874fa5 Compare April 19, 2024 07:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants