usability improvements and saving function

testing for bo and manual usage completed
This commit is contained in:
Niko Feith 2023-05-31 19:08:15 +02:00
parent c9cc658135
commit 84bb5d013f
5 changed files with 118 additions and 33 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<v-row> <v-row>
<v-col> <v-col class="px-4">
<v-row class="d-flex justify-space-evenly"> <v-row class="d-flex justify-space-evenly">
<v-select <v-select
:items="envs" :items="envs"
@ -36,7 +36,7 @@
label="nr episodes" label="nr episodes"
v-model="cstore.nr_episodes" v-model="cstore.nr_episodes"
:step="1" :step="1"
:min="10" :min="1"
:max="200" :max="200"
thumb-label thumb-label
/> />
@ -46,10 +46,11 @@
v-model="cstore.nr_runs" v-model="cstore.nr_runs"
:step="1" :step="1"
:min="1" :min="1"
:max="50" :max="100"
thumb-label thumb-label
/> />
<v-select <v-select
class="justify-space-evenly"
:items="acq_funs" :items="acq_funs"
label="Acquisition Function" label="Acquisition Function"
v-model="acqSelector" v-model="acqSelector"
@ -63,7 +64,10 @@
:max="1" :max="1"
thumb-label thumb-label
/> />
<v-checkbox v-model="cstore.fixed_seed" label="fixed seed" /> <v-row class="justify-space-evenly pa-1">
<v-checkbox v-model="cstore.fixed_seed" label="fixed seed" />
<v-checkbox v-model="cstore.save_result" label="save_result" />
</v-row>
<v-row class="d-flex justify-space-evenly mb-1"> <v-row class="d-flex justify-space-evenly mb-1">
<v-btn color="primary" @click="cstore.setSendWeights()" <v-btn color="primary" @click="cstore.setSendWeights()"
>Send Weights</v-btn >Send Weights</v-btn

View File

@ -105,6 +105,20 @@ watch(stateCounter.value, (newValue) => {
} }
}); });
// State Subscriber
const state_subscriber = new ROS.Topic({
ros: ros,
name: "/active_bo_state",
messageType: "active_bo_msgs/msg/ActiveBOState",
});
state_subscriber.subscribe((msg) => {
rlstore.setCurrentRun(msg.current_run);
rlstore.setCurrentEpisode(msg.current_episode);
rlstore.setBestReward(msg.best_reward);
rlstore.setLastUserReward(msg.last_user_reward);
});
// RL Service + Feedback Subscriber // RL Service + Feedback Subscriber
const rl_feedback_subscriber = new ROS.Topic({ const rl_feedback_subscriber = new ROS.Topic({
ros: ros, ros: ros,
@ -205,6 +219,7 @@ watch(
nr_runs: cstore.nr_runs, nr_runs: cstore.nr_runs,
acquisition_function: cstore.acq_fun, acquisition_function: cstore.acq_fun,
metric_parameter: cstore.metric_parameter, metric_parameter: cstore.metric_parameter,
save_result: cstore.save_result,
}); });
active_bo_pending.value = true; active_bo_pending.value = true;
active_bo_request.publish(request_msg); active_bo_request.publish(request_msg);

View File

@ -1,39 +1,84 @@
<template> <template>
<v-navigation-drawer permanent width="64"> <v-navigation-drawer class="nav-drawer" permanent width="64">
<v-container fluid> <v-list class="py-3">
<v-btn class="sidebar-button" @click="store.setPlay()"> <v-list-item style="padding: 0" class="py-2">
<v-icon v-if="!store.getPlay">mdi-play</v-icon> <div class="tile">
<v-icon v-else>mdi-pause</v-icon> <span
</v-btn> style="
</v-container> font-size: 14px;
<v-card class="pa-0" outlined style="width: 64px"> text-align: center;
<v-card-text> word-wrap: break-word;
<pre> padding: 0;
Current "
Run: >Current <br />
1 Run <br />
</pre> {{ rlstore.current_run }}</span
</v-card-text> >
</v-card> </div>
</v-list-item>
<v-list-item style="padding: 0" class="py-2">
<div class="tile">
<span
style="
font-size: 14px;
text-align: center;
word-wrap: break-word;
padding: 0;
"
>Current <br />
Episode <br />
{{ rlstore.current_episode }}</span
>
</div>
</v-list-item>
<v-list-item style="padding: 0" class="py-2">
<div class="tile">
<span
style="
font-size: 14px;
text-align: center;
word-wrap: break-word;
padding: 0;
"
>Best <br />
Reward <br />
{{ rlstore.best_reward.toFixed(1) }}</span
>
</div>
</v-list-item>
<v-list-item style="padding: 0" class="py-2">
<div class="tile">
<span
style="
font-size: 14px;
text-align: center;
word-wrap: break-word;
padding: 0;
"
>User <br />
Reward <br />
{{ rlstore.last_user_reward.toFixed(1) }}</span
>
</div>
</v-list-item>
</v-list>
</v-navigation-drawer> </v-navigation-drawer>
</template> </template>
<script setup> <script setup>
import { useBWStore } from "@/store/BaseWebsiteStore"; import { useRLStore } from "@/store/RLStore";
const rlstore = useRLStore();
const store = useBWStore();
</script> </script>
<style scoped> <style scoped>
.sidebar-button { .tile {
height: 48px; width: 63px;
width: 48px; height: 64px;
left: -16px; padding: 0;
box-shadow: none; display: flex;
border-radius: 0; align-items: center;
} justify-content: center;
border-top: 1px solid rgba(255, 255, 255, 0.12);
pre { border-bottom: 1px solid rgba(255, 255, 255, 0.12);
margin: 0;
} }
</style> </style>

View File

@ -19,6 +19,7 @@ export const useCStore = defineStore("Control Store", {
sendWeights: false, sendWeights: false,
runner: false, runner: false,
fixed_seed: false, fixed_seed: false,
save_result: false,
}; };
}, },
getters: { getters: {

View File

@ -9,6 +9,10 @@ export const useRLStore = defineStore("RL Store", {
width: 480, width: 480,
height: 320, height: 320,
current_time: 0, current_time: 0,
current_run: 0,
current_episode: 0,
best_reward: 0.0,
last_user_reward: 0.0,
trigger: false, trigger: false,
}; };
}, },
@ -19,6 +23,10 @@ export const useRLStore = defineStore("RL Store", {
getHeight: (state) => state.height, getHeight: (state) => state.height,
getWidth: (state) => state.width, getWidth: (state) => state.width,
getCurrentTime: (state) => state.current_time, getCurrentTime: (state) => state.current_time,
getCurrentRun: (state) => state.current_run,
getCurrentEpisode: (state) => state.current_episode,
getBestReward: (state) => state.best_reward,
getLastUserReward: (state) => state.last_user_reward,
}, },
actions: { actions: {
setRgbArrays(red, green, blue) { setRgbArrays(red, green, blue) {
@ -34,5 +42,17 @@ export const useRLStore = defineStore("RL Store", {
setCurrentTime(value) { setCurrentTime(value) {
this.current_time = value; this.current_time = value;
}, },
setCurrentRun(value) {
this.current_run = value;
},
setCurrentEpisode(value) {
this.current_episode = value;
},
setBestReward(value) {
this.best_reward = value;
},
setLastUserReward(value) {
this.last_user_reward = value;
},
}, },
}); });