publisher doesnt work 2
This commit is contained in:
parent
7ae87384b4
commit
eb481e0799
@ -138,19 +138,26 @@ const active_rl_eval_pub = new ROSLIB.Topic({
|
|||||||
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
||||||
});
|
});
|
||||||
|
|
||||||
function sleep(ms) {
|
const active_eval_response_first = new ROSLIB.Message({
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
policy: pstore.policy,
|
||||||
}
|
weights: pstore.weights,
|
||||||
|
});
|
||||||
|
console.log(active_eval_response_first);
|
||||||
|
active_rl_eval_pub.publish(active_eval_response_first);
|
||||||
|
|
||||||
|
// function sleep(ms) {
|
||||||
|
// return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
// }
|
||||||
|
|
||||||
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") {
|
||||||
const policy_request = new ROSLIB.ServiceRequest({
|
const policy_request = new ROSLIB.ServiceRequest({
|
||||||
weights: pstore.weights,
|
weights: pstore.policy,
|
||||||
nr_steps: pstore.max_steps,
|
nr_steps: pstore.weights,
|
||||||
});
|
});
|
||||||
|
|
||||||
policy_service.callService(policy_request, function (result) {
|
policy_service.callService(policy_request, function (result) {
|
||||||
@ -162,17 +169,14 @@ watch(
|
|||||||
}
|
}
|
||||||
console.log("Button pressed!");
|
console.log("Button pressed!");
|
||||||
const active_eval_response = new ROSLIB.Message({
|
const active_eval_response = new ROSLIB.Message({
|
||||||
policy: pstore.getPolicy,
|
policy: pstore.policy,
|
||||||
weights: pstore.getWeights,
|
weights: pstore.weights,
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
// 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