Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ coverage
*.njsproj
*.sln
*.sw?
.lens/*
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="icon" href="/favicon.ico" />
<link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TFR Mission Control</title>
</head>
Expand Down
Binary file added public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/connected-favicon.ico
Binary file not shown.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Mission Control",
"short_name": "",
"icons": [
{ "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
11 changes: 10 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import Navbar from '@/components/Navbar.vue';
import { useRoslibStore } from '@/store/roslibStore';
import { onBeforeUnmount, onMounted } from 'vue';
import { gamepadInit } from '@/lib/controller/gamepad';

import { useFavicon } from '@vueuse/core';
import { computed } from 'vue';
const rosjs = useRoslibStore();

// All global subscribers & publishers that do not belong in a component put in here.
onMounted(() => {
// Create a new connection if the current one is stopped.
Expand All @@ -20,6 +22,13 @@ onBeforeUnmount(() => {
// Stop the websocket when the app unloads.
rosjs.stop = true;
});

// changes favicon based on if web socket is connected or not
const favicon = computed(() =>
rosjs.isWebSocketConnected ? 'connected-favicon.ico' : 'favicon.ico',
);

useFavicon(favicon);
</script>

<template>
Expand Down
17 changes: 17 additions & 0 deletions src/assets/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--nav-bar-size: 4rem;
--black: #000000;
--dark-grey: #212121;
--accent-color: hsl(240, 20%, 20%);
--grey: #303030;
--light-grey: #424242;
--error: #e50000;
Expand All @@ -17,6 +18,7 @@
list-style-type: none;
box-sizing: border-box;
text-decoration: none;

&:hover {
color: inherit;
text-decoration: none;
Expand Down Expand Up @@ -72,6 +74,16 @@ button {
}
}

.dialogue-box {
padding: 10px;
border: 1px solid var(--light-grey);
border-radius: 5px;
background-color: var(--dark-grey);
color: var(--white);
width: 100%;
}

// Page Styles
.two-by-three-grid-page {
display: grid;
width: 100vw;
Expand All @@ -82,5 +94,10 @@ button {
// Can toggle off for debugging
> * {
overflow: hidden;
background-color: var(--accent-color);
padding: 5px;
border: var(--white) 1px solid;
border-radius: 1%;
margin: 0px 2px;
}
}
7 changes: 6 additions & 1 deletion src/components/ExampleComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ const onAndOffHandler = () => {
</script>
<template>
<div>
<h1>Example Data: {{ example.helloWorldSub.msg?.data }}</h1>
<div class="dialogue-box">
<h2>Example Data:</h2>
<p>
{{ example.helloWorldSub.msg?.data }}
</p>
</div>
<button @click="example.helloWorldPub.publish({ data: example.helloWorldSub.msg?.data + '!' })">
Add !
</button>
Expand Down
13 changes: 1 addition & 12 deletions src/components/PublishTesterComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function publishTest() {
<button type="submit">Publish</button>
</div>

<div v-if="receivedMessage" class="subscriber-box">
<div v-if="receivedMessage" class="dialogue-box">
<h2>Received Message:</h2>
<pre>{{ receivedMessage }}</pre>
</div>
Expand Down Expand Up @@ -178,17 +178,6 @@ button {
flex-shrink: 0;
}

.subscriber-box {
margin-top: 20px;
padding: 10px;
border: 1px solid var(--light-grey);
border-radius: 5px;
background-color: var(--dark-grey);
color: var(--white);
width: 300px;
max-height: 80px;
}

pre {
white-space: pre-wrap;
word-wrap: break-word;
Expand Down
51 changes: 28 additions & 23 deletions src/components/arm/ArmModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,45 @@ import { CanBusID, useTelemetryData } from '@/lib/roslibUtils/telemetry';

const { scene } = await useGLTF('newarm.glb');

//TODO: - add remaining bones
// - connect data to bones
//const wrist = scene.getObjectByName('Wrist') as Bone;
const shoulder = scene.getObjectByName('Shoulder') as Bone;
const elbow = scene.getObjectByName('Elbow') as Bone;
const turntable = scene.getObjectByName('Turntable') as Bone;

function degreesToRadians(degrees: number): number {
return degrees * (Math.PI / 180);
}

//default rotations on the 3d model
//const wristDefault = degreesToRadians(12.69);
const shoulderDefault = degreesToRadians(-72.88);
const elbowDefault = degreesToRadians(153.65);
const turntableDefault = degreesToRadians(-37.76);

useTelemetryData([CanBusID.ArmShoulder, CanBusID.ArmElbow], (data) => data.position, null, {
armShoulder: (position) => {
// Multiply the telemetry fraction by 2π to get the incoming additional radians.
const additionalShoulderRotation = position * -2 * Math.PI;
// The final rotation equals the default plus the telemetry offset.
const shoulderRotation = shoulderDefault + additionalShoulderRotation;
shoulder.rotation.x = shoulderRotation;
useTelemetryData(
[CanBusID.ArmShoulder, CanBusID.ArmElbow, CanBusID.ArmTurntable],
(data) => data.position,
null,
{
armShoulder: (position) => {
// Multiply the telemetry fraction by 2π to get the incoming additional radians.
const additionalShoulderRotation = position * -2 * Math.PI;
// The final rotation equals the default plus the telemetry offset.
const shoulderRotation = shoulderDefault + additionalShoulderRotation;
shoulder.rotation.x = shoulderRotation;
},
armElbow: (position) => {
const additionalElbowRotation = position * 2 * Math.PI;
const elbowRotation = elbowDefault + additionalElbowRotation;
elbow.rotation.x = elbowRotation;
},
armTurntable: (position) => {
const additionalTurntableRotation = position * 2 * Math.PI;
const turntableRotation = turntableDefault + additionalTurntableRotation;
turntable.rotation.x = turntableRotation;
},
},
armElbow: (position) => {
const additionalElbowRotation = position * 2 * Math.PI;
const elbowRotation = elbowDefault + additionalElbowRotation;
elbow.rotation.x = elbowRotation;
},
});
);
</script>
<template>
<div id="arm">
Expand All @@ -45,11 +57,4 @@ useTelemetryData([CanBusID.ArmShoulder, CanBusID.ArmElbow], (data) => data.posit
</TresCanvas>
</div>
</template>
<style lang="scss" scoped>
#arm {
height: 100%;
width: 100%;
grid-column: 2 / span 2;
grid-row: 1 / span 2;
}
</style>
<style lang="scss" scoped></style>
21 changes: 21 additions & 0 deletions src/lib/roslibUtils/rosTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type TopicTypeMap = {
'std_msgs/Float32': StdMsg<number>;
'std_msgs/Time': StdMsg<number>;
'sensor_msgs/msg/CompressedImage': CompressedImage;
'sensor_msgs/msg/NavSatFix': NavSatFix;
};

export type TopicType = keyof TopicTypeMap;
Expand All @@ -28,3 +29,23 @@ export type CompressedImage = {
format: 'jpg' | 'png';
data: Uint8Array;
};

//https://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/NavSatFix.html
export type NavSatFix = {
header: {
stamp: {
sec: number;
nanosec: number;
};
frame_id: string;
};
status: {
status: number;
service: number;
};
latitude: number;
longitude: number;
altitude: number;
position_covariance: number[];
position_covariance_type: number;
};
11 changes: 8 additions & 3 deletions src/pages/Arm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ import ArmModel from '../components/arm/ArmModel.vue';
<Suspense>
<ArmModel />
</Suspense>

<h1>Not yet Implemented</h1>
</div>
</template>

<style lang="scss" scoped></style>
<style lang="scss" scoped>
#arm {
height: 100%;
width: 100%;
grid-column: 2 / span 2;
grid-row: 1 / span 2;
}
</style>
4 changes: 0 additions & 4 deletions src/pages/Cameras.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import CameraModule from '@/components/camera/CameraModule.vue';
<div class="two-by-three-grid-page">
<CameraModule :camera-id="0" camera-name="Front" />
<CameraModule :camera-id="1" camera-name="Back" />
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
</template>

Expand Down
5 changes: 0 additions & 5 deletions src/pages/DevTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import PublishTesterComponent from '@/components/PublishTesterComponent.vue';
<div class="two-by-three-grid-page">
<ExampleComponent />
<PublishTesterComponent />
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
</template>

Expand Down
9 changes: 1 addition & 8 deletions src/pages/Help.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<!-- Layout of controls -->
<script setup lang="ts"></script>
<template>
<div class="two-by-three-grid-page">
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
<div class="two-by-three-grid-page"></div>
</template>

<style lang="scss" scoped></style>
14 changes: 7 additions & 7 deletions src/pages/Home.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!--
Show a couple of cameras, basic telemetry, auto/teleop button, reconnect canfd bus button, allow basic info about motors (like power consumption?), battery power level, LATER- shows box of the map
-->
<script setup lang="ts"></script>
<script setup lang="ts">
import ArmModeSelection from '@/components/arm/ArmModeSelection.vue';
import CameraModule from '@/components/camera/CameraModule.vue';
</script>
<template>
<div class="two-by-three-grid-page">
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<CameraModule :camera-id="0" camera-name="Front" />
<CameraModule :camera-id="1" camera-name="Back" />
<ArmModeSelection />
</div>
</template>

Expand Down
2 changes: 0 additions & 2 deletions src/pages/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import InteractiveMap from '@/components/map/InteractiveMap.vue';
<template>
<div class="two-by-three-grid-page">
<InteractiveMap />
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
</template>

Expand Down
9 changes: 1 addition & 8 deletions src/pages/Science.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<!-- Anything related to life detection, science stuff should be here -->
<script setup lang="ts"></script>
<template>
<div class="two-by-three-grid-page">
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
<div class="two-by-three-grid-page"></div>
</template>

<style lang="scss" scoped></style>
5 changes: 0 additions & 5 deletions src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import ConnectionSettings from '@/components/settings/ConnectionSettings.vue';
<template>
<div class="two-by-three-grid-page">
<ConnectionSettings />
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
</template>

Expand Down
4 changes: 0 additions & 4 deletions src/pages/Telemetry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ function getMoteusStateProxy(
</GenericMotorTelemetry>
</div>
</div>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
<h1>Not yet Implemented</h1>
</div>
</template>

Expand Down
Loading