🙊 Adds sonar support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { BufferGeometry, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Object3D, SphereGeometry, Vector3, type NormalBufferAttributes, type Object3DEventMap } from 'three';
|
||||
import { BufferGeometry, ConeGeometry, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Object3D, SphereGeometry, Vector3, type NormalBufferAttributes, type Object3DEventMap } from 'three';
|
||||
import uzip from 'uzip';
|
||||
import { ModesEnum, kinematicData, mode, model, outControllerData, servoAnglesOut, servoAngles, mpu, jointNames } from '$lib/stores';
|
||||
import { footColor, isEmbeddedApp, throttler, toeWorldPositions } from '$lib/utilities';
|
||||
@@ -178,6 +178,17 @@
|
||||
trace_lines.push(geometry);
|
||||
sceneManager.scene.add(line);
|
||||
}
|
||||
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const coneGeometry = new ConeGeometry(0.1, 20+0.01*i, 32);
|
||||
const coneMaterial = new MeshBasicMaterial({ color: 0x00ff00, transparent: true, opacity: 0.2 });
|
||||
const cone = new Mesh(coneGeometry, coneMaterial);
|
||||
cone.rotation.x = Math.PI / 2
|
||||
cone.position.y = 2
|
||||
cone.position.x = -0.25 + 0.5*i
|
||||
cone.position.z = -10
|
||||
sceneManager.scene.add(cone);
|
||||
}
|
||||
};
|
||||
|
||||
const renderTraceLines = (foot_positions: Vector3[]) => {
|
||||
|
||||
@@ -18,7 +18,8 @@ import {
|
||||
EquirectangularReflectionMapping,
|
||||
ACESFilmicToneMapping,
|
||||
MathUtils,
|
||||
MeshStandardMaterial
|
||||
MeshStandardMaterial,
|
||||
Group
|
||||
} from 'three';
|
||||
import { Sky } from 'three/addons/objects/Sky.js';
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
||||
@@ -72,6 +73,7 @@ export default class SceneBuilder {
|
||||
highlightMaterial: any;
|
||||
sky!: Sky;
|
||||
transformControl: TransformControls;
|
||||
public modelGroup!: Group;
|
||||
|
||||
constructor() {
|
||||
this.scene = new Scene();
|
||||
@@ -282,8 +284,10 @@ export default class SceneBuilder {
|
||||
};
|
||||
|
||||
public addModel = (model: any) => {
|
||||
this.modelGroup = new Group();
|
||||
this.modelGroup.add(model);
|
||||
this.model = model;
|
||||
this.scene.add(model);
|
||||
this.scene.add(this.modelGroup);
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export const servoAngles: Writable<number[]> = writable([
|
||||
export const logs = writable([] as string[]);
|
||||
export const battery = writable({});
|
||||
export const mpu = writable({ heading: 0 });
|
||||
export const sonar = writable([0, 0]);
|
||||
export const distances = writable({});
|
||||
|
||||
export interface socketDataCollection {
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
if ($page.data.features.analytics) socket.on('analytics', handleAnalytics);
|
||||
if ($page.data.features.battery) socket.on('battery', handleBattery);
|
||||
if ($page.data.features.download_firmware) socket.on('otastatus', handleOAT);
|
||||
if ($page.data.features.sonar) socket.on('sonar', data => console.log(data))
|
||||
};
|
||||
|
||||
const removeEventListeners = () => {
|
||||
|
||||
@@ -15,5 +15,6 @@ build_flags =
|
||||
-D FT_BMP=1
|
||||
-D FT_GPS=0
|
||||
-D FT_WS2812=1
|
||||
-D FT_USS=0
|
||||
-D FT_SERVO=1
|
||||
-D FT_ADS1115=1
|
||||
|
||||
@@ -33,6 +33,7 @@ void FeaturesService::begin() {
|
||||
root["imu"] = FT_IMU;
|
||||
root["mag"] = FT_MAG;
|
||||
root["bmp"] = FT_BMP;
|
||||
root["sonar"] = FT_USS;
|
||||
root["firmware_version"] = APP_VERSION;
|
||||
root["firmware_name"] = APP_NAME;
|
||||
root["firmware_built_target"] = BUILD_TARGET;
|
||||
|
||||
Reference in New Issue
Block a user