Giter VIP home page Giter VIP logo

yagsl-example's Issues

Investigate Odometry Inversion

When the drive motors are inverted for a Falcon/Falcon/CANCoder setup the odometry is completely reversed as if the sensor readings are not setting inversion states. If this is the case inversion needs to be changed to a psuedo-inverrsion or sensor readings need to be corrected.

Add custom standard deviation version of addVisionMeasurement

While the current version of the method has trustworthiness, it would be beneficial if a completely custom set of standard deviations could be supplied. We are calculating these values in a custom way based on having both photonvision and limelight, and it would be useful to have the ability to pass in these custom standard deviations.

Rename X and Y

X refers to front in module locations and Y refers to left. Should we rename this to front and left respectively to make it less confusing?

This would be a breaking change but it could be worth it.

LockPose not working.

The lockPose() method does not work because it commands module states that have a speed of 0. In the setModuleStates() method, there are a few lines put into place to stop angle movement when speeds are less than 0.1.

Since the lines that stop module angular movement are useful in stopping excessive module movement in place, the lockPose() function should probably be updated, possibly using an overload with setModuleStates().

https://github.com/BroncBotz3481/YAGSL-Example/tree/51-lockpose-not-working is the linked branch for the issue.

Rewrite to Model 95s code

  • Rearrange code into single package.
  • Separate SwerveDrive, SwerveModule, and SwerveController configuration options from Constants.
  • Adopt store configuration at construction style instead of global referencing.
  • Implement SwerveMotor augmentation for SwerveModule.
  • Implement AbsoluteEncoder augmentation for SwerveModule.
  • Separate SwerveModule constants from SwerveMotor constants.
  • Add on state-space estimation.
  • Move helper functions into SwerveMath.
  • Document every function.
  • Separate functions into correct units.
  • Extrapolate calculated constants into Configuration classes for SwerveDrive, SwerveModule, and SwerveMotor.
  • Add support for integrated absolute encoders.
  • Add support for defining PID output ranges.
  • Switch Odometry to SwervePoseEstimator.
  • Make certain configs optional (maybe)
  • Write documentation for JSON.

Fix CANCoder Synchronization

https://www.chiefdelphi.com/t/yet-another-generic-swerve-library-yagsl-beta/425148/159
https://www.chiefdelphi.com/t/yet-another-generic-swerve-library-yagsl-beta/425148/117
Appear to have issues with what is believed to be the cancoder sync.

Possible causes of issues:

  • getAbsolutePosition() not being constrained to (0, 360) because of the offset
  • the synchronizeEncoders() is placed in the periodic updateOdometry() which means a lack of causality with setReference(). Because of the PID loop running on the motor, with the setpoint derived from the past motor measurements and a new measurement, this could cause some unexpected temporary behavior.

It also could be easier to implement a Steer and Drive Controller to wrap the absolute encoder like democat's swervelib. This would match what they do, which is known to work.

Change `fscalar` to `ks`

fscalar in the JSON config is ks and following some normalized documentation should be preferred.

Deferring to @7910f6ba7ee4 since this is a major design change to a function used by them (and apparently all other falcon teams).

Abstract Kinematics

Add enum to select kinematics to SwerveDrive constructor and abstract kinematics to select which one to use.
Steps:

  • Remove 2nd order kinematics
  • Add first order kinematics
  • Abstract first order kinematics
  • Implement 2nd order kinematics
  • Add enum to select which kinematics to use.

Support "X" mode

X mode is where the modules go into 45 degree angles making it immobile which could be useful for protecting against defense.

Cache Sensor Data

Within reason sensor data is not updated as often as we query it. Therefore if sensor data is queries within a timeframe we return the cached data. Caching would occur in Abstracted classes and result in lower CANBus usage. Possible method of doing this would be creating a counter in SwerveDriveTelemetry.

v2 Json Generator issues

There are a few issues with the v2 Json Generator as it stands with the current version of the library

In all instances of 'absoluteEncoderOffset', there is a typo that generates the json as 'absolueEncoderOffset' (missing the t in absolute)

In module properties, the json entry 'freespeedrpm' doesn't exist, can only be 'angleMotorFreeSpeedRPM' according to the build error when I try to build

In all modules, when inverting, it prepends the module name (frontleft, backright, etc) to the angle or motor line, reading backleftangle. The build error indicates the only acceptable fields to be angle and drive, so the frontleft, etc need to be removed. I didn't test to see if it worked with encoders being inverted, but it didn't say that they were an option when I was viewing the stacktrace.

And thats all I noticed with my program. Don't have a robot to test on now, but when I made these three changes to my json files, it built and ran a simulation!

Single wheel driving upon telleop

hi, I'm having an issue where when I start Telyop using the example with all falcons one motor just drives at max speed and when I do autonomous autonomous program goes through and then at the end of it, one motor drives at max speed I've tried unplugging the motor that was driving at max speed and then it just switch to the next drive motor, I've also tried choosing different field configurations like closed field oriented in such get nothing. Any help would be greatly appreciated because I really really like this project.

Add Overridable Settings.

Modules should be able to override the following settings.

  • Encoder pulse per revolution.
  • Free speed RPM.

Address heading drift

Track the desired position of the robot and control the heading exclusively by that.

Extend Rotation2d

Rotation2d needs to store the original unoptimized angle it was instantiated with to determine the given angle from the absolute encoders

(note: This will NEVER work with thrifty encoders or those which cant exceed 360deg)

Document TimedRobot base class dependency and support AdvantageKit LoggedRobot

Presently, swervelib has several modules that call Robot.getInstance().addPeriodic() to set up periodic operations:

  • SwerveModule.java
  • encoders/PWMAnalogEncoder.java
  • encoders/PWMDutyCycleEncoder.java

The use of addPeriodic() implicitly creates a dependency on Robot being a subclass of edu.wpi.first.wpilibj.TimedRobot. However, this is not the case when using the AdvantageKit library from FRC 6328 for logging and log playback. AdvantageKit requires the use of a LoggedRobot base class, which does not supply the addPeriodic functionality.

Minimally, the dependency on TimedRobot should be documented.

For cases where LoggedRobot is being used as the robot base class, it is suggested that a Timer (edu.wpi.first.wpilibj.Timer) or similar class be used in a swerve subsystem to provide periodic callbacks to swerve components.

Remove `fscalar` as a config option?

With the voltage scaling fix for talon motors, everything seems to work as expected, suggesting that a scalar for the feedforward is not needed. Should we remove this option now that the theoretical feedforward works as expected?

Steering Issues

          i fixed the positions and used the pre tried config options but now im haveing an issue were the robot will not turn correcctly as both sticks seem to drive until both are operated at the same time were they then seem to steer

Originally posted by @aidenm05 in #37 (comment)

Fix Wording for Encoder

Encoder pulse per rotation is not for "non-integrated encoders" only, it is the total pulses for the motor controller encoders, which is 2048 for falcons

FAQ

If the robot spins out of control in autonomous or teleop absolute drive the gyro is inverted.

Fix TalonFX ArbitraryFeedforward (uses percentage output not voltage)

The ArbitraryFeedforward in the set() method for TalonFX motors takes in an input of percentage output from (-1, 1). The current assumption was that it takes in voltage. This should be fixed by just dividing the input of the setReference() method by the nominal voltage (and storing a local nominal voltage to do so).

Add 2nd Order Kinematics Taking into account chassis acceleration.

The current second order kinematics only uses omega squared, the angular speed of the robot in the calculations. This means that physically, the kinematics only produce the intended result when the robot is already spinning, then moves translationally. When the robot starts spinning and moving at the same time, it does not go straight.

The acceleration vector line should be updated to include a rough approximation of:

  • angular acceleration
  • translational acceleration in x
  • translational acceleration in y

This can probably be approximated just simply using a timer to find the change over timestep per iteration, storing the past chassis speeds inside of the kinematics class.

https://github.com/BroncBotz3481/YAGSL-Example/tree/52-add-2nd-order-kinematics-taking-into-account-chassis-acceleration is the linked branch.

Strafing on a 45 is about half speed.

HI, love the library, only having one issue, when I try and tele-op drive on a 45, so a combination of X and Y with no rotation, the robot moves at about half the absolute speed compared to when only moving in the X and Y.

Any ideas?

@thenetworkgrinch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.