Skip to content

Commit

Permalink
Activation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
evrys committed Nov 29, 2024
1 parent 8e34425 commit 4167ae9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
32 changes: 15 additions & 17 deletions src/components/3d-viewport/SafetyZonesRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SafetySetupSafetyZone } from "@wandelbots/wandelbots-js"
import { type GroupProps } from "@react-three/fiber"
import type { Geometry } from "@wandelbots/wandelbots-api-client"
import type { SafetySetupSafetyZone } from "@wandelbots/wandelbots-js"
import * as THREE from "three"
import { ConvexGeometry } from "three-stdlib"
import { type GroupProps } from "@react-three/fiber"

export type SafetyZonesRendererProps = {
safetyZones: SafetySetupSafetyZone[]
Expand Down Expand Up @@ -89,21 +89,19 @@ export function SafetyZonesRenderer({
return null
}
return (
<>
<mesh key={`${index}-${i}`} geometry={convexGeometry}>
<meshStandardMaterial
key={index}
attach="material"
color="#009f4d"
opacity={0.2}
depthTest={false}
depthWrite={false}
transparent
polygonOffset
polygonOffsetFactor={-i}
/>
</mesh>
</>
<mesh key={`${index}-${i}`} geometry={convexGeometry}>
<meshStandardMaterial
key={index}
attach="material"
color="#009f4d"
opacity={0.2}
depthTest={false}
depthWrite={false}
transparent
polygonOffset
polygonOffsetFactor={-i}
/>
</mesh>
)
})
})}
Expand Down
8 changes: 4 additions & 4 deletions src/components/jogging/JoggingCartesianTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const JoggingCartesianTab = observer(
opts: JoggingCartesianOpts,
increment: DiscreteIncrementOption,
) {
const jogger = await store.activateJogger()
const jogger = await store.activate()

const tcpPose = jogger.motionStream.rapidlyChangingMotionState.tcp_pose
const jointPosition =
Expand Down Expand Up @@ -99,15 +99,15 @@ export const JoggingCartesianTab = observer(
})
} finally {
store.setCurrentIncrementJog(null)
await store.deactivateJogger()
await store.deactivate()
}
})
}

async function startCartesianJogging(opts: JoggingCartesianOpts) {
if (store.isLocked) return

const jogger = await store.activateJogger()
const jogger = await store.activate()
if (store.activeDiscreteIncrement) {
return runIncrementalCartesianJog(opts, store.activeDiscreteIncrement)
}
Expand All @@ -134,7 +134,7 @@ export const JoggingCartesianTab = observer(
return
}

await store.deactivateJogger()
await store.deactivate()
}

const axisList = [
Expand Down
4 changes: 2 additions & 2 deletions src/components/jogging/JoggingJointRotationControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const JoggingJointRotationControl = externalizeComponent(
>
<ChevronLeft
sx={{
"pointer-events": "none",
pointerEvents: "none",
}}
/>
</IconButton>
Expand Down Expand Up @@ -231,7 +231,7 @@ export const JoggingJointRotationControl = externalizeComponent(
>
<ChevronRight
sx={{
"pointer-events": "none",
pointerEvents: "none",
}}
/>
</IconButton>
Expand Down
4 changes: 2 additions & 2 deletions src/components/jogging/JoggingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class JoggingStore {
return countBy(this.coordSystems, (cs) => cs.name)
}

async deactivateJogger() {
async deactivate() {
const websocket = this.jogger.activeWebsocket

this.jogger.setJoggingMode("increment")
Expand All @@ -199,7 +199,7 @@ export class JoggingStore {
}

/** Activate the jogger with current settings */
async activateJogger() {
async activate() {
if (this.currentTab.id === "cartesian") {
const cartesianJoggingOpts = {
tcpId: this.selectedTcpId,
Expand Down

0 comments on commit 4167ae9

Please sign in to comment.