-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8827729
commit e330aac
Showing
14 changed files
with
302 additions
and
21 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,31 @@ | ||
<script lang="ts"> | ||
const { angle }: { angle: number } = $props(); | ||
function calculateRotation() { | ||
return `rotate(${angle}deg)`; | ||
} | ||
</script> | ||
|
||
<div class="angle-visualizer"> | ||
<div class="angle-indicator"></div> | ||
</div> | ||
|
||
<style> | ||
.angle-visualizer { | ||
width: 200px; | ||
height: 200px; | ||
border: 1px solid black; | ||
position: relative; | ||
} | ||
.angle-indicator { | ||
width: 100%; | ||
height: 2px; | ||
background-color: blue; | ||
position: absolute; | ||
top: 50%; | ||
left: 0; | ||
transform-origin: left center; | ||
transform: ${calculateRotation()}; | ||
} | ||
</style> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Tooltip as TooltipPrimitive } from "bits-ui"; | ||
import Content from "./tooltip-content.svelte"; | ||
|
||
const Root = TooltipPrimitive.Root; | ||
const Trigger = TooltipPrimitive.Trigger; | ||
|
||
export { | ||
Root, | ||
Trigger, | ||
Content, | ||
// | ||
Root as Tooltip, | ||
Content as TooltipContent, | ||
Trigger as TooltipTrigger, | ||
}; |
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,28 @@ | ||
<script lang="ts"> | ||
import { Tooltip as TooltipPrimitive } from "bits-ui"; | ||
import { cn, flyAndScale } from "$lib/utils.js"; | ||
type $$Props = TooltipPrimitive.ContentProps; | ||
let className: $$Props["class"] = undefined; | ||
export let sideOffset: $$Props["sideOffset"] = 4; | ||
export let transition: $$Props["transition"] = flyAndScale; | ||
export let transitionConfig: $$Props["transitionConfig"] = { | ||
y: 8, | ||
duration: 150, | ||
}; | ||
export { className as class }; | ||
</script> | ||
|
||
<TooltipPrimitive.Content | ||
{transition} | ||
{transitionConfig} | ||
{sideOffset} | ||
class={cn( | ||
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md", | ||
className | ||
)} | ||
{...$$restProps} | ||
> | ||
<slot /> | ||
</TooltipPrimitive.Content> |
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,29 @@ | ||
<script lang="ts"> | ||
import * as Tooltip from '../ui/tooltip'; | ||
const { | ||
name, | ||
current, | ||
limit, | ||
klass | ||
}: { | ||
current: number; | ||
name?: string; | ||
limit?: number; | ||
klass?: string; | ||
[key: string]: unknown; | ||
} = $props(); | ||
</script> | ||
|
||
<div class={klass}> | ||
<Tooltip.Root openDelay={0}> | ||
<Tooltip.Trigger> | ||
<span | ||
class={`rounded-full p-1 ${limit === undefined || current <= limit ? 'bg-green-500' : 'bg-red-500'}`} | ||
>{current.toFixed(4)} amps</span | ||
> | ||
</Tooltip.Trigger> | ||
<Tooltip.Content> | ||
{name} | ||
</Tooltip.Content> | ||
</Tooltip.Root> | ||
</div> |
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,65 @@ | ||
<script lang="ts"> | ||
import imgSrc from '$lib/assets/robot.png'; | ||
import { ntEntry } from '../ntEntry.svelte'; | ||
import CurrentDot from './CurrentDot.svelte'; | ||
import type { NetworkTables } from 'ntcore-ts-client'; | ||
const { nt }: { nt: NetworkTables } = $props(); | ||
const intakeCurrent = ntEntry(nt, '/AdvantageKit/RealOutputs/Intake/IntakeCurrent', 'double'); | ||
const passthroughCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/Intake/PassthroughCurrent', | ||
'double' | ||
); | ||
const ampBarCurrent = ntEntry(nt, '/AdvantageKit/RealOutputs/AmpBar/Current', 'double'); | ||
const shooterCurrent = ntEntry(nt, '/AdvantageKit/RealOutputs/Shooter/ShooterCurrent', 'double'); | ||
const shooterFollowCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/Shooter/ShooterFollowCurrent', | ||
'double' | ||
); | ||
const feederCurrent = ntEntry(nt, '/AdvantageKit/RealOutputs/Shooter/FeederCurrent', 'double'); | ||
// const totalShooterCurrent = $derived( | ||
// (shooterCurrent.value ?? 0) + (shooterFollowCurrent.value ?? 0) + (feederCurrent.value ?? 0) | ||
// ); | ||
</script> | ||
|
||
<div class="relative h-fit w-full"> | ||
<img src={imgSrc} alt="" srcset="" class="pr-3" /> | ||
<CurrentDot | ||
klass="absolute bottom-[30%] left-[30%]" | ||
name="Intake" | ||
current={intakeCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<CurrentDot | ||
klass="absolute bottom-[50%] left-[50%]" | ||
name="Passthrough" | ||
current={passthroughCurrent.value ?? 0} | ||
limit={30} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[4%] left-[40%]" | ||
name="Amp Bar" | ||
current={ampBarCurrent.value ?? 0} | ||
limit={5} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[15%] right-[25%]" | ||
name="Shooter Left" | ||
current={shooterCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[15%] left-[40%]" | ||
name="Shooter Right" | ||
current={shooterFollowCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<!-- <CurrentDot | ||
{nt} | ||
klass="absolute bottom-[30%] left-[30%]" | ||
name="Intake" | ||
path="/AdvantageKit/RealOutputs/Intake/Current" | ||
/> --> | ||
</div> |
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,101 @@ | ||
<script lang="ts"> | ||
import imgSrc from '$lib/assets/swerveBase.png'; | ||
import { ntEntry } from '../ntEntry.svelte'; | ||
import CurrentDot from './CurrentDot.svelte'; | ||
import type { NetworkTables } from 'ntcore-ts-client'; | ||
const { nt }: { nt: NetworkTables } = $props(); | ||
const swerveMod0DriveCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule0/DriveMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod0AngleCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule0/AngleMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod1DriveCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule1/DriveMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod1AngleCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule1/AngleMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod2DriveCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule2/DriveMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod2AngleCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule2/AngleMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod3DriveCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule3/DriveMotorCurrent', | ||
'double' | ||
); | ||
const swerveMod3AngleCurrent = ntEntry( | ||
nt, | ||
'/AdvantageKit/RealOutputs/SwerveModule3/AngleMotorCurrent', | ||
'double' | ||
); | ||
</script> | ||
|
||
<div class="relative h-full w-fit"> | ||
<p class="flex justify-center text-xl leading-none">Swerve Front</p> | ||
<img src={imgSrc} alt="" srcset="" class="bg-black" /> | ||
<CurrentDot | ||
klass="absolute top-[10%] left-[7%]" | ||
name="Front left drive" | ||
current={swerveMod0DriveCurrent.value ?? 0} | ||
limit={100} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[20%] left-[7%]" | ||
name="Front left angle" | ||
current={swerveMod0AngleCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[10%] right-[7%]" | ||
name="Front right drive" | ||
current={swerveMod1DriveCurrent.value ?? 0} | ||
limit={100} | ||
/> | ||
<CurrentDot | ||
klass="absolute top-[20%] right-[7%]" | ||
name="Front right angle" | ||
current={swerveMod1AngleCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<CurrentDot | ||
klass="absolute bottom-[20%] left-[7%]" | ||
name="Bottom left drive" | ||
current={swerveMod2DriveCurrent.value ?? 0} | ||
limit={100} | ||
/> | ||
<CurrentDot | ||
klass="absolute bottom-[10%] left-[7%]" | ||
name="Bottom left angle" | ||
current={swerveMod2AngleCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
<CurrentDot | ||
klass="absolute bottom-[20%] right-[7%]" | ||
name="Bottom right drive" | ||
current={swerveMod3DriveCurrent.value ?? 0} | ||
limit={100} | ||
/> | ||
<CurrentDot | ||
klass="absolute bottom-[10%] right-[7%]" | ||
name="Bottom right angle" | ||
current={swerveMod3AngleCurrent.value ?? 0} | ||
limit={60} | ||
/> | ||
</div> |
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