Skip to main content

Pathplanner Projects

Pathfinding on Pathplanner

Objectives

  • Implement pathfinding command to an arbitrary position on the field in Simulation and on Hardware
  • Use Advantagescope to view and analyze data from live sources
  •  Simulate code before deploying to a robot

Prepare Development Environment

You will need a laptop with WPILIB VS code, Pathplanner, AdvantageScope, Driver station (if using robot)

Checkout pathplanner-pathfinding branch of Team3176/Code_2024 

Simulate Base Code

verify that the robot code is set for simulation in Constants.java the robot type should be RobotType robot = RobotType.ROBOT_SIMBOT; 

Click the three dots as if you were deploying and select "Simulate Robot Code"

image.png

select "Sim GUI"

image.png

Set driver station to Blue 1

image.png

Then set robot to disabled

image.png

You can only change the robot alliance station when the robot is in Disconnected state

Setup AdvantageScope

Check preferences under Help -> Show Preferences. Set Live source to NetworkTables 4

image.png

Connect to the Simulator by File -> Connect to Simulator

image.png

Add a 3d Field widget by clicking the plus

image.png

On the 3d Field add the robot pose under AdvantageKit/RealOutputs/Drivetrain/Pose. Drag the field into the 2d Poses

Screencastfrom01-25-2024012104PM-ezgif.com-video-to-gif-converter.gif

Drive in simulation

Using the "IJKL" for translation and "WASD" for rotation click into the Robot Simulation window for your keyboard inputs to be registered

you should see the values change in the joysticks panel

image.png

Enable the robot in the robot state to teleoperated

image.png

try driving around with the "keyboard joysticks" (IJKL) and follow the pose on AdvantageScope

Your keyboard inputs are only registered if you are clicked into the robot simulation window. Move this window to one the bottom of your screen and AdvantageScope to the top

Screencastfrom01-25-2024012819PM-ezgif.com-video-to-gif-converter.gif