debugging

This commit is contained in:
Niko Feith 2023-05-26 16:14:57 +02:00
parent 94af7725bd
commit 5c28ceab9d
2 changed files with 7 additions and 34 deletions

View File

@ -68,7 +68,7 @@ function buildChart() {
display: false, display: false,
}, },
verticalLinePlugin: { verticalLinePlugin: {
xValue: rlstore.current_time, xValue: rlstore.getCurrentTime,
}, },
}, },
lineTension: 0, lineTension: 0,
@ -111,6 +111,8 @@ watch(
.fill(0) .fill(0)
.map((_, i) => i); .map((_, i) => i);
chartHandle.data.datasets[0].data = policy; chartHandle.data.datasets[0].data = policy;
chartHandle.options.plugins.verticalLinePlugin.xValue =
rlstore.current_time;
chartHandle.update(); chartHandle.update();
} }
@ -125,6 +127,8 @@ watch(
.fill(0) .fill(0)
.map((_, i) => i); .map((_, i) => i);
chartHandle.data.datasets[0].data = policy; chartHandle.data.datasets[0].data = policy;
chartHandle.options.plugins.verticalLinePlugin.xValue =
rlstore.current_time;
chartHandle.update(); chartHandle.update();
} }

View File

@ -105,13 +105,6 @@ watch(stateCounter.value, (newValue) => {
} }
}); });
// Policy Service
const policy_service = new ROS.Service({
ros: ros,
name: "/policy_srv",
serviceType: "active_bo_msgs/srv/WeightToPolicy",
});
// 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,
@ -122,6 +115,7 @@ const rl_feedback_subscriber = new ROS.Topic({
rl_feedback_subscriber.subscribe((msg) => { rl_feedback_subscriber.subscribe((msg) => {
rlstore.setDim(msg.height, msg.width); rlstore.setDim(msg.height, msg.width);
rlstore.setRgbArrays(msg.red, msg.green, msg.blue); rlstore.setRgbArrays(msg.red, msg.green, msg.blue);
rlstore.setCurrentTime(msg.current_time);
}); });
const active_rl_eval_sub = new ROS.Topic({ const active_rl_eval_sub = new ROS.Topic({
@ -143,32 +137,12 @@ const active_rl_eval_pub = new ROS.Topic({
messageType: "active_bo_msgs/msg/ActiveRL", messageType: "active_bo_msgs/msg/ActiveRL",
}); });
// const active_eval_response_first = new ROSLIB.Message({
// 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,
() => { () => {
const metric = cstore.getMetric; const metric = cstore.getMetric;
if (metric === "manually") { if (metric === "active BO") {
const policy_request = new ROS.ServiceRequest({
weights: pstore.policy,
nr_steps: pstore.weights,
});
policy_service.callService(policy_request, function (result) {
pstore.setPolicy(result.policy);
});
} else if (metric === "active BO") {
if (!pendingRequest.value) { if (!pendingRequest.value) {
return; return;
} }
@ -200,11 +174,6 @@ const bo_service = new ROS.Service({
serviceType: "active_bo_msgs/srv/BO", serviceType: "active_bo_msgs/srv/BO",
}); });
// const active_bo_service = new ROSLIB.Service({
// ros: ros,
// name: "/active_bo_srv",
// serviceType: "active_bo_msgs/srv/ActiveBO",
// });
const active_bo_pending = ref(false); const active_bo_pending = ref(false);
const active_bo_request = new ROS.Topic({ const active_bo_request = new ROS.Topic({