publisher doesnt work
This commit is contained in:
parent
12c5fd25be
commit
7ae87384b4
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="/CPS_White.ico">
|
<link rel="icon" href="/CPS_White.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Vite App</title>
|
<title>Active BO</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -137,30 +137,14 @@ const active_rl_eval_pub = new ROSLIB.Topic({
|
|||||||
name: "/active_rl_eval_response",
|
name: "/active_rl_eval_response",
|
||||||
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
||||||
});
|
});
|
||||||
// const active_rl_eval_service = new ROSLIB.Service({
|
|
||||||
// ros: ros,
|
function sleep(ms) {
|
||||||
// name: "/active_rl_eval_srv",
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
// serviceType: "active_bo_msgs/srv/ActiveRLEval",
|
}
|
||||||
// });
|
|
||||||
//
|
|
||||||
// let currentResponse = null;
|
|
||||||
// let currentServiceId = null;
|
|
||||||
// const pendingRequest = ref(false);
|
|
||||||
//
|
|
||||||
// active_rl_eval_service.advertise(function (request, response) {
|
|
||||||
// currentResponse = response;
|
|
||||||
// currentServiceId = this.id;
|
|
||||||
// pendingRequest.value = true;
|
|
||||||
//
|
|
||||||
// pstore.setPolicy(request["old_policy"]);
|
|
||||||
// pstore.setWeights(request["old_weights"]);
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => cstore.getSendWeights,
|
() => cstore.getSendWeights,
|
||||||
() => {
|
async () => {
|
||||||
const usr_mode = cstore.getUserMode;
|
const usr_mode = cstore.getUserMode;
|
||||||
|
|
||||||
if (usr_mode === "manually") {
|
if (usr_mode === "manually") {
|
||||||
@ -172,25 +156,6 @@ watch(
|
|||||||
policy_service.callService(policy_request, function (result) {
|
policy_service.callService(policy_request, function (result) {
|
||||||
pstore.setPolicy(result.policy);
|
pstore.setPolicy(result.policy);
|
||||||
});
|
});
|
||||||
// } else if (usr_mode === "active BO") {
|
|
||||||
// if (!pendingRequest.value) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// console.log('after Button')
|
|
||||||
// currentResponse["new_policy"] = pstore.getPolicy;
|
|
||||||
// currentResponse["new_weights"] = pstore.getWeights;
|
|
||||||
//
|
|
||||||
// active_rl_eval_service.ros.callOnConnection({
|
|
||||||
// op: "service_response",
|
|
||||||
// service: active_rl_eval_service.name,
|
|
||||||
// values: currentResponse,
|
|
||||||
// result: true,
|
|
||||||
// id: currentServiceId,
|
|
||||||
// });
|
|
||||||
// console.log('call on connection')
|
|
||||||
// pendingRequest.value = false;
|
|
||||||
// currentResponse = null;
|
|
||||||
// currentServiceId = null;
|
|
||||||
} else if (usr_mode === "active BO") {
|
} else if (usr_mode === "active BO") {
|
||||||
if (!pendingRequest.value) {
|
if (!pendingRequest.value) {
|
||||||
return;
|
return;
|
||||||
@ -202,8 +167,12 @@ watch(
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log(active_eval_response);
|
console.log(active_eval_response);
|
||||||
|
for (let i = 0; i < 10; i++) {
|
||||||
|
console.log(i);
|
||||||
|
|
||||||
active_rl_eval_pub.publish(active_eval_response);
|
active_rl_eval_pub.publish(active_eval_response);
|
||||||
|
await sleep(1000);
|
||||||
|
}
|
||||||
console.log("New Policy/ Weights published");
|
console.log("New Policy/ Weights published");
|
||||||
// pendingRequest.value = false;
|
// pendingRequest.value = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user