Programmers of Chief Delphi, My team has an issue with our leds. We are trying to use our ctre CANdle to control addressable leds based on different triggers and variables on our robot. The issue is, the led animations keep persisting. We have recently updated our CANdle to ctre’s new v6 support for it. we ported over the code and and this is the first issue we encounter. Basically, when we tell the leds to go to a solid color using the setControl functionality in the api, it works fine. its only when we try to animate that something goes wrong. after setting one animation through a condition (elevator up and game piece in intake), it persists and doesn’t go away. we try to overwrite by using a state baed system and changing the leds to red after there is no longer coral in the bot, but it blinks for a milisecond (basically one periodic cycle) and then goes back to the animation, which persists. Any Ideas on how to fix this persisting issue? Our code repo can be found here: PepperAdvanced. Please look at commit 53a922d. the most recent commit is temporary and does sort of work but it is periodic based (not what we want) and makes the leds “flicker” due to them constantly being set every periodic cycle. Thanks!
We had the same issue, and we fixed it by using the SingleFadeAnimation animation type and setting the speed to 0 (probably wasn’t the intended way to solve this). This would work for you too, however, you are using phoenix6, which doesn’t provide a parameter for speed. You could try is setting it to an emptyAnimation() before you set it to a solid color. If that doesn’t work you could also try emptyControl(). My guess is setControl() to a solid color only sets the LEDs to that color, but doesn’t change the animation configured.
One issue you might have is that the Candle can support having multiple animations running at once. So instead of the new animation overwriting the slot of the previous one, it takes up a new slot. You could try explicitly stating the slot of each animation in the class constructor and see if that fixes anything.
As was the case in Phoenix 5, CANdle animations keep running until the animation slot is cleared. In Phoenix 5, that was done using the clearAnimation(slot)
API; in Phoenix 6, you would call setControl(new EmptyAnimation(slot))
to accomplish the same thing.
Note that SolidColor
is not an animation (and therefore does not take up an animation slot). It is equivalent to the setLEDs(...)
API from Phoenix 5 and is a one-shot request to set LED colors.
The control requests all default to slot 0, so if you don’t explicitly change the slot, a new animation already overwrites the previous one.