Two Talon Objects

At our event this weekend, we struggled with low voltage during many of our matches and we have been looking at code as a possible culprit.

Our programming lead wrote our Teleop code and our autonomous code (which largely follows the path finding sample code with RamseteController and telemetry) as separate projects and then attempted to merge the two. As a result we realized that the four talons we use on our drivetrain were being constructed in memory in our autoinit and then constructed again in our teleopinit.

We are highly suspicious that having the talon constructed twice could result in the motor controllers being sent two different signals at all times in teleop. The speed controller object constructed in auto being told auto is over set your voltage to 0 and the one constructed in teleop being given commands from the controller.

Does anyone have any experience with this or have any insight as to what might happen as a result?

You shouldn’t be able to construct multiple objects with the same CAN ID. That should cause “HAL: resource already allocated” errors. Based on this, I doubt this is the cause of your issues.

If you share a link to your code (ideally a github or similar repo), we’ll take a look and try to help identify potential issues.

As for the low voltage specifically, that’s usually either a bad battery (e.g. high internal resistance, not fully charged, etc) or excessive current draw (e.g. added mechanical resistance in the mechanism). I’m curious what lead you to believe the code is the cause.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.