|
| 1 | +<template> |
| 2 | + <q-page padding> |
| 3 | + <!-- content --> |
| 4 | + <div class="q-pa-md"> |
| 5 | + <div class="q-gutter-sm"> |
| 6 | + <div>Task: <strong>current</strong></div> |
| 7 | + <q-btn-group rounded> |
| 8 | + <q-btn rounded color="primary" label="Start Task" /> |
| 9 | + <q-btn rounded color="red" label="Stop Task" /> |
| 10 | + </q-btn-group> |
| 11 | + <div> |
| 12 | + Facial expression: <strong>{{ lastExpression }}</strong> |
| 13 | + </div> |
| 14 | + <q-btn-group outline rounded> |
| 15 | + <template v-for="(expressionName, index) in expressionList" :key="index"> |
| 16 | + <q-btn |
| 17 | + outline |
| 18 | + color="primary" |
| 19 | + @click=" |
| 20 | + () => { |
| 21 | + express(expressionName); |
| 22 | + } |
| 23 | + " |
| 24 | + :label="expressionName" |
| 25 | + /> |
| 26 | + </template> |
| 27 | + </q-btn-group> |
| 28 | + |
| 29 | + <div>Voice Command</div> |
| 30 | + <q-list bordered separator style="max-width: 350px"> |
| 31 | + <q-item clickable v-ripple> |
| 32 | + <q-item-section> |
| 33 | + <q-item-label overline>Voice</q-item-label> |
| 34 | + <q-item-label>Hello</q-item-label> |
| 35 | + </q-item-section> |
| 36 | + </q-item> |
| 37 | + </q-list> |
| 38 | + |
| 39 | + <div> |
| 40 | + <iframe |
| 41 | + width="400" |
| 42 | + height="250" |
| 43 | + src="https://vclock.com/embed/timer/#countdown=00:00:10&enabled=0&seconds=10&onzero=1&theme=1&m=1&sound=xylophone" |
| 44 | + frameborder="0" |
| 45 | + allowfullscreen |
| 46 | + ></iframe> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + </q-page> |
| 51 | +</template> |
| 52 | + |
| 53 | +<script setup> |
| 54 | +import { toRefs, ref, reactive, watch, watchEffect, computed, onMounted } from "vue"; |
| 55 | +import { rosConnection } from "src/utils/RosUtils"; |
| 56 | +
|
| 57 | +const expressionList = ["happy", "sad", "mad", "focused", "confused"]; |
| 58 | +const lastExpression = ref("None"); |
| 59 | +var expressionTopic = new ROSLIB.Topic({ |
| 60 | + ros: rosConnection.ros, |
| 61 | + name: "/face", |
| 62 | + messageType: "std_msgs/String", |
| 63 | +}); |
| 64 | +
|
| 65 | +function express(expressionType) { |
| 66 | + var expressionMsg = new ROSLIB.Message({ data: expressionType }); |
| 67 | + expressionTopic.publish(expressionMsg); |
| 68 | + lastExpression.value = expressionType; |
| 69 | +} |
| 70 | +</script> |
0 commit comments