Skip to content

Commit

Permalink
chore: Format and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay committed Oct 11, 2024
1 parent 5347554 commit cbc9033
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions fission/src/systems/simulation/wpilib_brain/SimInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Mechanism from "@/systems/physics/Mechanism"
import Jolt from "@barclah/jolt-physics"
import JOLT from "@/util/loading/JoltSyncLoader"
import { JoltQuat_ThreeQuaternion, JoltVec3_ThreeVector3 } from "@/util/TypeConversions"
import * as THREE from 'three'
import * as THREE from "three"

export abstract class SimInput {
constructor(protected _device: string) {}
Expand Down Expand Up @@ -101,7 +101,7 @@ export class SimAccelInput extends SimInput {
super(device)
this._robot = robot
this._joltID = this._robot.nodeToBody.get(this._robot.rootBody)
this._prevVel = new THREE.Vector3(0,0,0)
this._prevVel = new THREE.Vector3(0, 0, 0)
}

public Update(deltaT: number) {
Expand Down
2 changes: 1 addition & 1 deletion fission/src/systems/simulation/wpilib_brain/SimOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class CANOutputGroup extends SimOutputGroup {
const average =
this.ports.reduce((sum, port) => {
const device = SimCAN.GetDeviceWithID(port, SimType.CANMotor)
return sum + (device?.get("<percentOutput") as number | undefined ?? 0)
return sum + ((device?.get("<percentOutput") as number | undefined) ?? 0)
}, 0) / this.ports.length

this.drivers.forEach(d => {
Expand Down
2 changes: 1 addition & 1 deletion fission/src/systems/simulation/wpilib_brain/WPILibBrain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class WPILibBrain extends Brain {
return
}

// this.addSimInput(new SimGyroInput("Test Gyro[1]", mechanism))
this.addSimInput(new SimGyroInput("Test Gyro[1]", mechanism))
this.addSimInput(new SimAccelInput("ADXL362[4]", mechanism))
this.addSimInput(new SimDigitalInput("SYN DI[0]", () => Math.random() > 0.5))

Check warning on line 384 in fission/src/systems/simulation/wpilib_brain/WPILibBrain.ts

View check run for this annotation

Autodesk Chorus / security/semgrep

app.chorus.semgrep.rules.njsscan.crypto.node_insecure_random_generator

crypto.pseudoRandomBytes()/Math.random() is a cryptographically weak random number generator.

Check warning on line 384 in fission/src/systems/simulation/wpilib_brain/WPILibBrain.ts

View check run for this annotation

Autodesk Chorus / security/semgrep

app.chorus.semgrep.rules.njsscan.semantic_grep.crypto.node_insecure_random_generator

crypto.pseudoRandomBytes()/Math.random() is a cryptographically weak random number generator.
this.addSimOutput(new SimDigitalOutput("SYN DO[1]"))
Expand Down
6 changes: 4 additions & 2 deletions fission/src/ui/panels/WSViewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function setGeneric(simType: SimType, device: string, field: string, value: stri
const WSViewPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
// const [tb, setTb] = useState(generateTableBody())

const [table, updateTable] = useReducer((_) => generateTableBody(), generateTableBody())
const [table, updateTable] = useReducer(_ => generateTableBody(), generateTableBody())

const [selectedType, setSelectedType] = useState<SimType | undefined>()
const [selectedDevice, setSelectedDevice] = useState<string | undefined>()
Expand All @@ -118,7 +118,9 @@ const WSViewPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
}, [selectedType])

useEffect(() => {
const func = () => { updateTable() }
const func = () => {
updateTable()
}
const id: NodeJS.Timeout = setInterval(func, TABLE_UPDATE_INTERVAL)

return () => {
Expand Down
2 changes: 2 additions & 0 deletions simulation/samples/CppSample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.vscode/
.wpilib/
build/
.settings/

This file was deleted.

0 comments on commit cbc9033

Please sign in to comment.