Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Oct 25, 2024
1 parent cd1ff08 commit 4680a07
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 37 deletions.
2 changes: 1 addition & 1 deletion core/frontend/src/components/kraken/BackAlleyTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export default Vue.extend({
return []
}
return (this.manifest as ExtensionData[]).sort(
return this.manifest as ExtensionData[].sort(
(a, b) => (b?.repo_info?.downloads ?? 0) - (a?.repo_info?.downloads ?? 0),
)
},
Expand Down
50 changes: 40 additions & 10 deletions core/frontend/src/components/vehiclesetup/OrientationPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,29 +179,31 @@ export default {
scene.background = new THREE.Color(0xffffff)
// Add arrows for the x, y, and z axes
const arrowHelperX = new THREE.ArrowHelper(new THREE.Vector3(0.1, 0, 0), new THREE.Vector3(0, 0, 0), 0.1, 0xff0000)
const arrowHelperX = new THREE.ArrowHelper(new THREE.Vector3(0.1, 0, 0), new THREE.Vector3(0, 0, 0), 0.1, 0xffaaaa)
this.arrows.push(arrowHelperX)
scene.add(arrowHelperX)
const arrowHelperY = new THREE.ArrowHelper(new THREE.Vector3(0, 5, 0), new THREE.Vector3(0, 0, 0), 0.1, 0x00ff00)
const arrowHelperY = new THREE.ArrowHelper(new THREE.Vector3(0, 5, 0), new THREE.Vector3(0, 0, 0), 0.1, 0xaaffaa)
scene.add(arrowHelperY)
this.arrows.push(arrowHelperY)
const arrowHelperZ = new THREE.ArrowHelper(new THREE.Vector3(0, 0, 5), new THREE.Vector3(0, 0, 0), 0.1, 0x0000ff)
const arrowHelperZ = new THREE.ArrowHelper(new THREE.Vector3(0, 0, 5), new THREE.Vector3(0, 0, 0), 0.1, 0xaaaaff)
scene.add(arrowHelperZ)
this.arrows.push(arrowHelperZ)
// Add TransformControls
this.transformControls = new TransformControls(this.camera, this.renderer.domElement)
this.transformControls.addEventListener('objectChange', (event) => {
console.log(this.object.rotation.x)
orbitControls.enabled = !event.value
this.transformControls.addEventListener('mouseDown', (event) => {
orbitControls.enabled = false
})
this.transformControls.setMode('rotate')
this.transformControls.addEventListener('mouseUp', (event) => {
orbitControls.enabled = true
})
this.transformControls.setMode('translate')
this.transformControls.setSpace('local')
scene.add(this.transformControls)
const animate = () : void => {
requestAnimationFrame(animate)
orbitControls.update()
if (!this.renderer) {
return
}
Expand Down Expand Up @@ -238,8 +240,36 @@ export default {
}
},
add_vehicle_model() {
// ... (keep existing method)
},
if (this.scene) {
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.6/')
const loader = new GLTFLoader()
loader.setDRACOLoader(dracoLoader)
loader.load(
this.vehicle_model,
(gltf) => {
gltf.scene.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.material = new THREE.MeshStandardMaterial({
color: 0x666666, // white
transparent: true,
opacity: 0.05,
depthTest: false,
depthWrite: true,
side: THREE.DoubleSide, // Set material to be double-sided
})
}
})
this.vehicle_obj = gltf.scene
this.scene.add(gltf.scene)
},
undefined,
(error) => {
console.error('An error occurred while loading the GLB model:', error)
},
)
}
},
async add_board_model() {
if (this.scene) {
const dracoLoader = new DRACOLoader()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
<template>
<div class="pt-1 pb-1">
<div v-for="(parameters, section) in filtered_params">
<div v-for="(parameters, section) in filtered_params">
<v-sheet class="ma-5">
<v-card-title>{{ section }}</v-card-title>
<div class="d-flex d-col flex-wrap">
<v-card elevation="2" v-for="param in parameters" class="ma-2 d-flex flex-column" min-width="200px" max-width="250px">
<v-card-title> {{ param.name }}</v-card-title>
<v-card-text>
{{ param.description }}
</v-card-text>
<div class="flex-grow-1"></div>
<v-card-actions>
<v-text-field
label="Current value"
:value="`${printParam(param)} ${param.units ?? ''}`"

disabled
></v-text-field>
<v-btn small><v-icon>mdi-pencil</v-icon></v-btn>
</v-card-actions>
</v-card>
</div>
</v-sheet>
<div class="d-flex d-col flex-wrap">
<v-card v-for="param in parameters" elevation="2" class="ma-2 d-flex flex-column" min-width="200px" max-width="250px">
<v-card-title> {{ param.name }}</v-card-title>
<v-card-text>
{{ param.description }}
</v-card-text>
<div class="flex-grow-1" />
<v-card-actions>
<v-text-field
label="Current value"
:value="`${printParam(param)} ${param.units ?? ''}`"

disabled
/>
<v-btn small>
<v-icon>mdi-pencil</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</div>
</v-sheet>
</div>
</div>
</template>

<script lang="ts">
import { Dictionary } from 'vue-router/types/router.js'
import autopilot_data from '@/store/autopilot'
import Parameter, { printParam } from '@/types/autopilot/parameter'
import { Dictionary } from 'vue-router/types/router.js';
enum Lights {
Lights1 = 59, // RCIN9
Expand Down Expand Up @@ -68,16 +71,14 @@ export default {
// return parameters in servo_params that are on channel 9 and higher
const params = {} as Dictionary<(Parameter | undefined)[]>
for (const [section, parameters] of Object.entries(FS_PARAMS)) {
params[section] = parameters.map((param) => {
return autopilot_data.parameter(param)
})
params[section] = parameters.map((param) => autopilot_data.parameter(param))
}
return params;
return params
},
},
methods: {
printParam,
}
},
}
</script>
<style scoped>
Expand Down

0 comments on commit 4680a07

Please sign in to comment.