layout complete
This commit is contained in:
parent
0cc4dc6a83
commit
899ef5be2e
@ -1,49 +1,90 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container>
|
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12" sm="6">
|
<v-col>
|
||||||
<v-select
|
<v-select
|
||||||
:items="options"
|
:items="options"
|
||||||
label="Select an option"
|
label="User Mode"
|
||||||
v-model="selectedOption"
|
v-model="modeSelector"
|
||||||
></v-select>
|
></v-select>
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12" sm="6" v-for="(slider, index) in sliders" :key="index">
|
|
||||||
<v-slider
|
<v-slider
|
||||||
:max="slider.max"
|
class="control-slider"
|
||||||
:min="slider.min"
|
label="maximum steps"
|
||||||
v-model="slider.value"
|
v-model="pstore.max_steps"
|
||||||
label="Slider {{index+1}}"
|
:step="1"
|
||||||
></v-slider>
|
:min="10"
|
||||||
</v-col>
|
:max="200"
|
||||||
</v-row>
|
thumb-label/>
|
||||||
<v-row>
|
<v-slider
|
||||||
<v-col cols="12" sm="6">
|
class="control-slider"
|
||||||
|
label="nr base funcs"
|
||||||
|
v-model="baseFuncsComp"
|
||||||
|
:step="1"
|
||||||
|
:min="2"
|
||||||
|
:max="20"
|
||||||
|
thumb-label/>
|
||||||
|
<v-slider
|
||||||
|
class="control-slider"
|
||||||
|
label="nr episodes"
|
||||||
|
v-model="cstore.nr_episodes"
|
||||||
|
:step="1"
|
||||||
|
:min="10"
|
||||||
|
:max="200"
|
||||||
|
thumb-label/>
|
||||||
|
<v-slider
|
||||||
|
class="control-slider"
|
||||||
|
label="nr runs"
|
||||||
|
v-model="cstore.nr_runs"
|
||||||
|
:step="1"
|
||||||
|
:min="1"
|
||||||
|
:max="50"
|
||||||
|
thumb-label/>
|
||||||
|
<v-slider
|
||||||
|
class="control-slider"
|
||||||
|
label="greedy"
|
||||||
|
v-model="cstore.greedy"
|
||||||
|
:step="0.01"
|
||||||
|
:min="0"
|
||||||
|
:max="1"
|
||||||
|
thumb-label/>
|
||||||
|
<v-row class="d-flex justify-space-evenly mb-9">
|
||||||
<v-btn color="primary" @click="cstore.setSendWeights()">Send Weights</v-btn>
|
<v-btn color="primary" @click="cstore.setSendWeights()">Send Weights</v-btn>
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" sm="6">
|
|
||||||
<v-btn color="secondary" @click="cstore.setRunner()">Run</v-btn>
|
<v-btn color="secondary" @click="cstore.setRunner()">Run</v-btn>
|
||||||
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {usePStore} from "@/store/PolicyStore";
|
import {usePStore} from "@/store/PolicyStore";
|
||||||
import {useCStore} from "@/store/ControlStore";
|
import {useCStore} from "@/store/ControlStore";
|
||||||
|
import {computed} from "vue";
|
||||||
|
|
||||||
const pstore = usePStore();
|
const pstore = usePStore();
|
||||||
const cstore = useCStore();
|
const cstore = useCStore();
|
||||||
|
|
||||||
const options = ['manually', 'BO', 'active BO'];
|
const options = cstore.user_modes;
|
||||||
const selectedOption = cstore.user_mode;
|
const selectedOption = cstore.mode;
|
||||||
// TODO: Copy code from gpt
|
|
||||||
|
|
||||||
|
const sliders = [
|
||||||
|
{ min: 10, max: 200, value: pstore.max_steps, name: 'max steps', action: pstore.setMaxSteps},
|
||||||
|
{ min: 5, max: 10, value: pstore.nr_weights, name: 'nr base funs', action: pstore.setNrWeights},
|
||||||
|
{ min: 10, max: 200, value: cstore.nr_episodes, name: 'nr episodes', action: cstore.setNrEpisodes},
|
||||||
|
{ min: 1, max: 100, value: cstore.nr_runs, name: 'nr runs', action: cstore.setNrRuns},
|
||||||
|
{ min: 0, max: 1, value: cstore.greedy, name: 'greedy', action: cstore.setGreedy},
|
||||||
|
];
|
||||||
|
const baseFuncsComp = computed({
|
||||||
|
get: () => pstore.nr_weights,
|
||||||
|
set: (value) => pstore.setNrWeights(value),
|
||||||
|
})
|
||||||
|
|
||||||
|
const modeSelector = computed({
|
||||||
|
get: () => cstore.mode,
|
||||||
|
set: (value) => cstore.setUserMode(value)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.control-slider{
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<canvas id="policy-chart"/>
|
<canvas id="policy-chart"/>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -20,7 +18,6 @@ function buildChart() {
|
|||||||
data: {
|
data: {
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Reward',
|
|
||||||
type: 'line',
|
type: 'line',
|
||||||
xAxisID: 'x',
|
xAxisID: 'x',
|
||||||
yAxisID: 'y',
|
yAxisID: 'y',
|
||||||
@ -37,6 +34,11 @@ function buildChart() {
|
|||||||
animation: {
|
animation: {
|
||||||
duration: 0,
|
duration: 0,
|
||||||
},
|
},
|
||||||
|
plugins:{
|
||||||
|
legend: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
mode: 'label',
|
mode: 'label',
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<canvas id="reward-chart"/>
|
<canvas id="reward-chart"/>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -59,6 +57,11 @@ function buildChart() {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
plugins:{
|
||||||
|
legend: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
animation: {
|
animation: {
|
||||||
|
@ -1,15 +1,62 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<v-container fluid class="sub-layout">
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="12" md="8">
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-card class="tile" :style="{ height: 'calc(40vh - 24px)', width: '100%' }">
|
||||||
<policy-plot/>
|
<policy-plot/>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-card class="tile" :style="{ height: 'calc(20vh - 24px)', width: '100%' }">
|
||||||
<weight-tuner/>
|
<weight-tuner/>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-card class="tile" :style="{ height: 'calc(40vh - 24px)', width: '100%' }">
|
||||||
<reward-plot/>
|
<reward-plot/>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" md="4">
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-card class="tile" :style="{ height: 'calc(40vh - 24px)', width: '100%' }">
|
||||||
|
<!-- component 4 here -->
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-card class="tile" :style="{ height: 'calc(60vh - 48px)', width: '100%' }">
|
||||||
|
<control-panel/>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import WeightTuner from "@/components/WeightTuner.vue";
|
import WeightTuner from "@/components/WeightTuner.vue";
|
||||||
import RewardPlot from "@/components/RewardPlot.vue";
|
import RewardPlot from "@/components/RewardPlot.vue";
|
||||||
import PolicyPlot from "@/components/PolicyPlot.vue";
|
import PolicyPlot from "@/components/PolicyPlot.vue";
|
||||||
|
import ControlPanel from "@/components/ControlPanel.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.sub-layout{
|
||||||
|
padding: 0;
|
||||||
|
margin: 1px 0 0 0;
|
||||||
|
}
|
||||||
|
.tile {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
border: 1px solid #333;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="weight-tuner">
|
<v-row no-gutters justify="center" class="weight-tuner">
|
||||||
<v-row no-gutters justify="center">
|
|
||||||
<v-col v-for="(_, idx) in weights">
|
<v-col v-for="(_, idx) in weights">
|
||||||
<div class="weight-container">
|
<div class="weight-container">
|
||||||
<vue-slider v-model="weights[idx]"
|
<vue-slider v-model="weights[idx]"
|
||||||
@ -13,7 +12,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -21,10 +19,11 @@ import { usePStore } from "@/store/PolicyStore";
|
|||||||
|
|
||||||
import VueSlider from "vue-slider-component";
|
import VueSlider from "vue-slider-component";
|
||||||
import 'vue-slider-component/theme/default.css';
|
import 'vue-slider-component/theme/default.css';
|
||||||
|
import {computed} from "vue";
|
||||||
|
|
||||||
const store = usePStore()
|
const store = usePStore()
|
||||||
|
|
||||||
const weights = store.weights;
|
const weights = computed(() => store.weights);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
import * as ROSLIB from 'roslib';
|
|
||||||
import { usePStore } from "../store/PolicyStore";
|
|
||||||
|
|
||||||
const store = usePStore();
|
|
||||||
|
|
||||||
export function PolicyService(ros) {
|
|
||||||
const service = new ROSLIB.Service({
|
|
||||||
ros: ros,
|
|
||||||
name: '/policy_srv',
|
|
||||||
serviceType: 'active_bo_msgs/srv/WeightToPolicy',
|
|
||||||
});
|
|
||||||
|
|
||||||
const request = new ROSLIB.ServiceRequest({
|
|
||||||
weights: store.weights,
|
|
||||||
nr_steps: store.nr_steps,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
@ -3,7 +3,8 @@ import { defineStore } from "pinia";
|
|||||||
export const useCStore = defineStore('Control Store', {
|
export const useCStore = defineStore('Control Store', {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
user_mode: 'manually',
|
mode: null,
|
||||||
|
user_modes: ['manually', 'BO', 'active BO'],
|
||||||
nr_episodes: 10,
|
nr_episodes: 10,
|
||||||
nr_runs: 1,
|
nr_runs: 1,
|
||||||
greedy: 0,
|
greedy: 0,
|
||||||
@ -12,7 +13,7 @@ export const useCStore = defineStore('Control Store', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getUserMode: (state) => state.user_mode,
|
getUserMode: (state) => state.mode,
|
||||||
getNrEpisodes: (state) => state.nr_episodes,
|
getNrEpisodes: (state) => state.nr_episodes,
|
||||||
getNrRuns: (state) => state.nr_runs,
|
getNrRuns: (state) => state.nr_runs,
|
||||||
getGreedy: (state) => state.greedy,
|
getGreedy: (state) => state.greedy,
|
||||||
@ -21,7 +22,7 @@ export const useCStore = defineStore('Control Store', {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setUserMode(value) {
|
setUserMode(value) {
|
||||||
this.user_mode = value;
|
this.mode = value;
|
||||||
},
|
},
|
||||||
setNrEpisodes(value) {
|
setNrEpisodes(value) {
|
||||||
this.nr_episodes = value;
|
this.nr_episodes = value;
|
||||||
|
Loading…
Reference in New Issue
Block a user