Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAN Support #1050

Merged
merged 63 commits into from
Aug 17, 2024
Merged

CAN Support #1050

merged 63 commits into from
Aug 17, 2024

Conversation

azaleacolburn
Copy link
Member

@azaleacolburn azaleacolburn commented Jul 26, 2024

Description

Send, receive, and use CAN device data between a robot project and fission.

Objectives

  • Send TalonFX Data
  • Send CANSparkMax Data
  • Make simulated motor fields appear as CAN devices rather than SimDevices
  • CAN Motor Brain Mappings
  • CANEncoder support

Testing Done

  • Test TalonFX in WS Viewer
  • Test CANSparkMax in WS Viewer
  • Make sure CAN Motor inputs map into the brain properly
  • Test CANEncoders on SparkMaxes

For testing:

  1. Build and publish SyntheSim with ./gradlew build and ./gradlew publishToMavenLocal.
  2. Build and run the JavaSample with ./gradlew build and ./gradlew simulateJava.
  3. Run fission
  4. Open fission, spawn a robot, then click the WS Test button in the debug menu (this must be done first).
  5. Verify the connection by opening the WS Viewer panel, you should see a long list of motors and encoders.
  6. Click the RoboRio button to setup CAN output group, select all the CANSparkMax motors and all the WheelDrivers, then click Done
  7. Do the same but for Encoders, this time, just select CANSparkMax[1] and any of the wheel stimuli.
  8. In the robotSimulation screen, click Autonomous, you should see the robot drive forward 20 (feet?), then stop.

We need to have a discussion about how we want device mapping to work, right now every motor in a group's output is averaged and applied to each driver. We need to make it easier to do one to one mappings between motors and drivers, because right now, clicking through the whole menu ~10 times to make an output group for each motor is ridiculous.

Note

Pulled from #1077 for it's encoder framework, so I think just turning that PR into a gyro / joystick PR is the way to go.

Note

CANMotor inputs (eg. supplyCurrent) have been ignored, since they're not simulated in fission.

This PR is a combination of JIRA Issues 1747, 1748, and 1749 for a total of 18 story points.

@azaleacolburn azaleacolburn requested review from HunterBarclay and a team as code owners July 26, 2024 03:20
@azaleacolburn azaleacolburn requested review from a-crowell, Dhruv-0-Arora, PepperLola and LucaHaverty and removed request for a team July 26, 2024 03:20
@azaleacolburn azaleacolburn changed the title Colbura/1747/can motor support CAN Motor Support Jul 26, 2024
@azaleacolburn azaleacolburn added the codesim Code simulation related task. label Jul 26, 2024
@azaleacolburn azaleacolburn self-assigned this Jul 26, 2024
@azaleacolburn azaleacolburn marked this pull request as draft July 26, 2024 23:37
Copy link
Member

@HunterBarclay HunterBarclay left a comment

Choose a reason for hiding this comment

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

I'm unable to build the sample project because it says it can't find CTRE or REV libraries:
image

I built and published SyntheSimJava successfully, however.

@BrandonPacewic
Copy link
Member

I'm unable to build the sample project because it says it can't find CTRE or REV libraries

I built and published SyntheSimJava successfully, however.

@HunterBarclay Did you follow the following instructions from #1043?

  1. Navigate to simulation/samples/JavaSample
  2. Install WPILib utilities if you don't have them
  3. Open the JavaSample project in WPILib VSCode
  4. Install Phoenix v6 and REVLib vendor libraries
    1. https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json
    2. https://software-metadata.revrobotics.com/REVLib-2024.json
  5. Run ./gradlew build && ./gradlew simulateJava

@HunterBarclay
Copy link
Member

@azaleacolburn Why aren't the vendor deps just already added?

Copy link
Collaborator

@a-crowell a-crowell left a comment

Choose a reason for hiding this comment

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

This is so cool! And motors are connecting great! Encoder isn't connecting for me though, so auto doesn't stop.

Copy link
Collaborator

@a-crowell a-crowell left a comment

Choose a reason for hiding this comment

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

Super impressive! If I knew how to get a device from id, I'd let you know, but alas I am without that knowledge and the code is working great. So excited for code sim!

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

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

Super awesome!

@HunterBarclay HunterBarclay merged commit a17f4f6 into dev Aug 17, 2024
13 checks passed
@HunterBarclay HunterBarclay deleted the colbura/1747/can-motor-support branch August 17, 2024 05:43
@PepperLola PepperLola mentioned this pull request Aug 21, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codesim Code simulation related task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants