fixed the pub bug
This commit is contained in:
parent
eb481e0799
commit
b7b1186b58
@ -55,18 +55,23 @@ const stateCounter = ref([0, 0, 0]);
|
|||||||
|
|
||||||
// Open Connection to ROSBridge and subscribe the topics.
|
// Open Connection to ROSBridge and subscribe the topics.
|
||||||
const ros = new ROS.Ros();
|
const ros = new ROS.Ros();
|
||||||
|
const ros_eval = new ROS.Ros();
|
||||||
|
|
||||||
ros.on("connection", () => {
|
ros.on("connection", () => {
|
||||||
stateCounter.value[0] += 1;
|
stateCounter.value[0] += 1;
|
||||||
});
|
});
|
||||||
|
ros_eval.on("connection", () => {});
|
||||||
|
|
||||||
ros.on("error", (error) => {
|
ros.on("error", (error) => {
|
||||||
stateCounter.value[1] += 1;
|
stateCounter.value[1] += 1;
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
|
ros_eval.on("error", () => {});
|
||||||
|
|
||||||
ros.on("close", () => {
|
ros.on("close", () => {
|
||||||
stateCounter.value[2] += 1;
|
stateCounter.value[2] += 1;
|
||||||
});
|
});
|
||||||
|
ros_eval.on("close", () => {});
|
||||||
|
|
||||||
function updateConnectionState() {
|
function updateConnectionState() {
|
||||||
connectionState.value = !connectionState.value;
|
connectionState.value = !connectionState.value;
|
||||||
@ -74,9 +79,11 @@ function updateConnectionState() {
|
|||||||
formState.connect = "connected";
|
formState.connect = "connected";
|
||||||
const rosUrl = `ws://${formState.ipaddress}:${formState.port}`;
|
const rosUrl = `ws://${formState.ipaddress}:${formState.port}`;
|
||||||
ros.connect(rosUrl);
|
ros.connect(rosUrl);
|
||||||
|
ros_eval.connect(rosUrl);
|
||||||
} else {
|
} else {
|
||||||
formState.connect = "not connected";
|
formState.connect = "not connected";
|
||||||
ros.close();
|
ros.close();
|
||||||
|
ros_eval.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +127,7 @@ rl_feedback_subscriber.subscribe((msg) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const active_rl_eval_sub = new ROSLIB.Topic({
|
const active_rl_eval_sub = new ROSLIB.Topic({
|
||||||
ros: ros,
|
ros: ros_eval,
|
||||||
name: "/active_rl_eval_request",
|
name: "/active_rl_eval_request",
|
||||||
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
||||||
});
|
});
|
||||||
@ -133,7 +140,7 @@ active_rl_eval_sub.subscribe((msg) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const active_rl_eval_pub = new ROSLIB.Topic({
|
const active_rl_eval_pub = new ROSLIB.Topic({
|
||||||
ros: ros,
|
ros: ros_eval,
|
||||||
name: "/active_rl_eval_response",
|
name: "/active_rl_eval_response",
|
||||||
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
messageType: "active_bo_msgs/msg/ActiveRLEval",
|
||||||
});
|
});
|
||||||
@ -143,7 +150,7 @@ const active_eval_response_first = new ROSLIB.Message({
|
|||||||
weights: pstore.weights,
|
weights: pstore.weights,
|
||||||
});
|
});
|
||||||
console.log(active_eval_response_first);
|
console.log(active_eval_response_first);
|
||||||
active_rl_eval_pub.publish(active_eval_response_first);
|
// active_rl_eval_pub.publish(active_eval_response_first);
|
||||||
|
|
||||||
// function sleep(ms) {
|
// function sleep(ms) {
|
||||||
// return new Promise((resolve) => setTimeout(resolve, ms));
|
// return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
Loading…
Reference in New Issue
Block a user