Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
Oblarg committed Dec 14, 2021
1 parent 5aa63f6 commit 327f8cf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public RobotContainer() {
// A split-stick arcade command, with forward/backward controlled by the left
// hand, and turning controlled by the right.
new RunCommand(() -> m_robotDrive
.arcadeDrive(m_driverController.getY(GenericHID.Hand.kLeft),
m_driverController.getX(GenericHID.Hand.kRight)), m_robotDrive));
.arcadeDrive(m_driverController.getLeftX(),
m_driverController.getRightX()), m_robotDrive));

}

Expand Down Expand Up @@ -111,7 +111,7 @@ private void configureButtonBindings() {
m_shooter::atSetpoint)).whenReleased(new InstantCommand(m_shooter::stopFeeder, m_shooter));

// Drive at half speed when the bumper is held
new JoystickButton(m_driverController, Button.kBumperRight.value)
new JoystickButton(m_driverController, Button.kRightBumper.value)
.whenPressed(() -> m_robotDrive.setMaxOutput(0.5))
.whenReleased(() -> m_robotDrive.setMaxOutput(1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
package io.github.oblarg.logexample.subsystems;

import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.PWMVictorSPX;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

import io.github.oblarg.logexample.Constants.DriveConstants;
Expand All @@ -21,14 +21,14 @@
public class DriveSubsystem extends SubsystemBase implements Loggable {
// The motors on the left side of the drive.
@Log.MotorController(name = "Left Motors")
private final SpeedControllerGroup m_leftMotors =
new SpeedControllerGroup(new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
private final MotorControllerGroup m_leftMotors =
new MotorControllerGroup(new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));

@Log.MotorController(name = "Right Motors")
// The motors on the right side of the drive.
private final SpeedControllerGroup m_rightMotors =
new SpeedControllerGroup(new PWMVictorSPX(DriveConstants.kRightMotor1Port),
private final MotorControllerGroup m_rightMotors =
new MotorControllerGroup(new PWMVictorSPX(DriveConstants.kRightMotor1Port),
new PWMVictorSPX(DriveConstants.kRightMotor2Port));

@Log.DifferentialDrive(name = "Drive")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

package io.github.oblarg.logexample.subsystems;

import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.PWMVictorSPX;
import edu.wpi.first.wpilibj.controller.PIDController;
import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward;
import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
import edu.wpi.first.wpilibj2.command.PIDSubsystem;

import io.github.oblarg.logexample.Constants.ShooterConstants;
Expand Down
42 changes: 26 additions & 16 deletions lib/src/main/java/io/github/oblarg/oblog/annotations/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Min</td><td>Number</td><td>0</td><td>The minimum value of the dial</td></tr>
* <tr><td>Max</td><td>Number</td><td>100</td><td>The maximum value of the dial</td></tr>
Expand Down Expand Up @@ -245,6 +246,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Visible time</td><td>Number</td><td>30</td>
* <td>How long, in seconds, should past data be visible for</td></tr>
Expand Down Expand Up @@ -321,6 +323,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Color when true</td><td>Color</td><td>"green"</td>
* <td>Can be specified as a string ({@code "#00FF00"}) or a rgba integer ({@code 0x00FF0000})
Expand Down Expand Up @@ -404,6 +407,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Min</td><td>Number</td><td>0</td><td>The minimum value of the bar</td></tr>
* <tr><td>Max</td><td>Number</td><td>5</td><td>The maximum value of the bar</td></tr>
Expand Down Expand Up @@ -485,11 +489,11 @@
}

/**
* Displays a {@link edu.wpi.first.wpilibj.PowerDistributionPanel PowerDistributionPanel}. <br>
* Displays a {@link edu.wpi.first.wpilibj.PowerDistribution PowerDistributionPanel}. <br>
* Supported types:
*
* <ul>
* <li>{@link edu.wpi.first.wpilibj.PowerDistributionPanel}
* <li>{@link edu.wpi.first.wpilibj.PowerDistribution}
* </ul>
*
* <br>
Expand Down Expand Up @@ -628,36 +632,37 @@
}

/**
* Displays a {@link edu.wpi.first.wpilibj.SpeedController SpeedController}. The speed controller
* Displays a {@link edu.wpi.first.wpilibj.motorcontrol.MotorController MotorController}. The speed controller
* will be controllable from the dashboard when test mode is enabled, but will otherwise be
* view-only. <br>
* Supported types:
*
* <ul>
* <li>{@link edu.wpi.first.wpilibj.PWMSpeedController}
* <li>{@link edu.wpi.first.wpilibj.DMC60}
* <li>{@link edu.wpi.first.wpilibj.Jaguar}
* <li>{@link edu.wpi.first.wpilibj.PWMTalonSRX}
* <li>{@link edu.wpi.first.wpilibj.PWMVictorSPX}
* <li>{@link edu.wpi.first.wpilibj.SD540}
* <li>{@link edu.wpi.first.wpilibj.Spark}
* <li>{@link edu.wpi.first.wpilibj.Talon}
* <li>{@link edu.wpi.first.wpilibj.Victor}
* <li>{@link edu.wpi.first.wpilibj.VictorSP}
* <li>{@link edu.wpi.first.wpilibj.SpeedControllerGroup}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMMotorController}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.DMC60}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Jaguar}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMTalonSRX}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.SD540}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Spark}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Talon}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Victor}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.VictorSP}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup}
* </ul>
*
* <br>
* Custom properties:
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Orientation</td><td>String</td><td>"HORIZONTAL"</td>
* <td>One of {@code ["HORIZONTAL", "VERTICAL"]}</td></tr>
* </table>
*/
@Repeatable(SpeedControllers.class)
@Repeatable(MotorControllers.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@interface MotorController {
Expand Down Expand Up @@ -711,7 +716,7 @@

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@interface SpeedControllers {
@interface MotorControllers {
MotorController[] value();
}

Expand All @@ -729,6 +734,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Min</td><td>Number</td><td>-1</td>
* <td>The minimum acceleration value to display</td></tr>
Expand Down Expand Up @@ -827,6 +833,7 @@
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Range</td><td>{@link edu.wpi.first.wpilibj.interfaces.Accelerometer.Range}</td><td>k16G</td><td>The accelerometer range</td></tr>
* <tr><td>Show value</td><td>Boolean</td><td>true</td>
Expand Down Expand Up @@ -920,6 +927,7 @@ edu.wpi.first.wpilibj.interfaces.Accelerometer.Range range() default
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Major tick spacing</td><td>Number</td><td>45</td><td>Degrees</td></tr>
* <tr><td>Starting angle</td><td>Number</td><td>180</td>
Expand Down Expand Up @@ -1006,6 +1014,7 @@ edu.wpi.first.wpilibj.interfaces.Accelerometer.Range range() default
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Number of wheels</td><td>Number</td><td>4</td><td>Must be a positive even integer
* </td></tr>
Expand Down Expand Up @@ -1092,6 +1101,7 @@ edu.wpi.first.wpilibj.interfaces.Accelerometer.Range range() default
*
* <table>
* <caption></caption>
* <tr><th>Name</th><th>Type</th><th>Default Value</th><th>Notes</th></tr>
* <tr><td>Show velocity vectors</td><td>Boolean</td><td>true</td></tr>
* </table>
Expand Down

0 comments on commit 327f8cf

Please sign in to comment.