-
Notifications
You must be signed in to change notification settings - Fork 2
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
Intake #14
Merged
Merged
Intake #14
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cdf625c
Update idle roller voltage; mostly a commit to get the intake branch …
Shom770 5ca64c3
change version of wpilib in the workflow
Shom770 d9ea7c4
initial commit
Shom770 5ae2224
current changes so far
Shom770 6f31d37
working dt:
Shom770 a9faedd
add wrapper class on velocity and position voltage requests
sswadkar d5fd184
update falconutils to 1.1.28
sswadkar 5ebeadf
fix errors
MatthewChoulas fb1eb7e
delete intake stuff for now so we can create a pr
Shom770 0752aff
bring back intake stuff
Shom770 efcfaed
Fix intake issues
Shom770 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/kotlin/com/team4099/lib/phoenix6/PositionVoltage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.team4099.lib.phoenix6 | ||
|
||
import org.team4099.lib.units.AngularVelocity | ||
import org.team4099.lib.units.derived.Angle | ||
import org.team4099.lib.units.derived.ElectricalPotential | ||
import org.team4099.lib.units.derived.degrees | ||
import org.team4099.lib.units.derived.inRotations | ||
import org.team4099.lib.units.derived.inVolts | ||
import org.team4099.lib.units.derived.volts | ||
import org.team4099.lib.units.inRotationsPerSecond | ||
import org.team4099.lib.units.perSecond | ||
import com.ctre.phoenix6.controls.PositionVoltage as PositionVoltagePhoenix6 | ||
|
||
class PositionVoltage( | ||
private var position: Angle, // Assuming an AngularPosition type exists similar to AngularVelocity | ||
private var enableFOC: Boolean = true, | ||
private var feedforward: ElectricalPotential = 0.0.volts, | ||
private var slot: Int = 0, | ||
private var overrideBrakeDurNeutral: Boolean = false, | ||
private var limitForwardMotion: Boolean = false, | ||
private var limitReverseMotion: Boolean = false, | ||
private var velocity: AngularVelocity = 0.0.degrees.perSecond, | ||
) { | ||
|
||
val positionVoltagePhoenix6 = PositionVoltagePhoenix6(position.inRotations, velocity.inRotationsPerSecond, enableFOC, feedforward.inVolts, slot, overrideBrakeDurNeutral, limitForwardMotion, limitReverseMotion) | ||
|
||
fun setPosition(new_position: Angle) { | ||
position = new_position | ||
positionVoltagePhoenix6.Position = new_position.inRotations | ||
} | ||
|
||
fun setEnableFOC(new_enableFOC: Boolean) { | ||
enableFOC = new_enableFOC | ||
positionVoltagePhoenix6.EnableFOC = new_enableFOC | ||
} | ||
|
||
fun setFeedforward(new_feedforward: ElectricalPotential) { | ||
feedforward = new_feedforward | ||
positionVoltagePhoenix6.FeedForward = new_feedforward.inVolts | ||
} | ||
|
||
fun setSlot(new_slot: Int) { | ||
slot = new_slot | ||
positionVoltagePhoenix6.Slot = new_slot | ||
} | ||
|
||
fun setOverrideBrakeDurNeutral(new_override: Boolean) { | ||
overrideBrakeDurNeutral = new_override | ||
positionVoltagePhoenix6.OverrideBrakeDurNeutral = new_override | ||
} | ||
|
||
fun setLimitForwardMotion(new_limitForward: Boolean) { | ||
limitForwardMotion = new_limitForward | ||
positionVoltagePhoenix6.LimitForwardMotion = new_limitForward | ||
} | ||
|
||
fun setLimitReverseMotion(new_limitReverse: Boolean) { | ||
limitReverseMotion = new_limitReverse | ||
positionVoltagePhoenix6.LimitReverseMotion = new_limitReverse | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/kotlin/com/team4099/lib/phoenix6/VelocityVoltage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.team4099.lib.phoenix6 | ||
|
||
import com.ctre.phoenix6.controls.VelocityVoltage as VelocityVoltagePhoenix6 | ||
import org.team4099.lib.units.AngularAcceleration | ||
import org.team4099.lib.units.AngularVelocity | ||
import org.team4099.lib.units.derived.ElectricalPotential | ||
import org.team4099.lib.units.derived.degrees | ||
import org.team4099.lib.units.derived.inVolts | ||
import org.team4099.lib.units.derived.volts | ||
import org.team4099.lib.units.inRotationsPerSecond | ||
import org.team4099.lib.units.inRotationsPerSecondPerSecond | ||
import org.team4099.lib.units.perSecond | ||
|
||
class VelocityVoltage(private var velocity: AngularVelocity, | ||
private var acceleration: AngularAcceleration = 0.0.degrees.perSecond.perSecond, | ||
private var enableFOC:Boolean = true, | ||
private var feedforward: ElectricalPotential = 0.0.volts, | ||
private var slot:Int = 0, | ||
private var overrideBrakeDurNeutral: Boolean = false, | ||
private var limitForwardMotion: Boolean = false, | ||
private var limitReverseMotion: Boolean = false){ | ||
|
||
val velocityVoltagePhoenix6 = VelocityVoltagePhoenix6(velocity.inRotationsPerSecond, acceleration.inRotationsPerSecondPerSecond, enableFOC, feedforward.inVolts, slot, overrideBrakeDurNeutral, limitForwardMotion, limitReverseMotion) | ||
|
||
fun setVelocity(new_velocity: AngularVelocity) { | ||
velocity = new_velocity | ||
velocityVoltagePhoenix6.Velocity = velocity.inRotationsPerSecond | ||
} | ||
|
||
fun setAcceleration(new_accel: AngularAcceleration) { | ||
acceleration = new_accel | ||
velocityVoltagePhoenix6.Acceleration = acceleration.inRotationsPerSecondPerSecond | ||
} | ||
|
||
fun setEnableFOC(new_enableFOC: Boolean) { | ||
enableFOC = new_enableFOC | ||
velocityVoltagePhoenix6.EnableFOC = new_enableFOC | ||
} | ||
|
||
fun setFeedforward(new_feedforward: ElectricalPotential) { | ||
feedforward = new_feedforward | ||
velocityVoltagePhoenix6.FeedForward = new_feedforward.inVolts | ||
} | ||
|
||
fun setSlot(new_slot: Int) { | ||
slot = new_slot | ||
velocityVoltagePhoenix6.Slot = new_slot | ||
} | ||
|
||
fun setOverrideBrakeDurNeutral(new_override: Boolean) { | ||
overrideBrakeDurNeutral = new_override | ||
velocityVoltagePhoenix6.OverrideBrakeDurNeutral = new_override | ||
} | ||
|
||
fun setLimitForwardMotion(new_limitForward: Boolean) { | ||
limitForwardMotion = new_limitForward | ||
velocityVoltagePhoenix6.LimitForwardMotion = new_limitForward | ||
} | ||
|
||
fun setLimitReverseMotion(new_limitReverse: Boolean) { | ||
limitReverseMotion = new_limitReverse | ||
velocityVoltagePhoenix6.LimitReverseMotion = new_limitReverse | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be in the repo, please to add to gitignore