+
+
+
\ No newline at end of file
diff --git a/src/pages/DevTab.vue b/src/pages/DevTab.vue
index d45a295..338a6ac 100644
--- a/src/pages/DevTab.vue
+++ b/src/pages/DevTab.vue
@@ -2,10 +2,12 @@
+
Not yet Implemented
Not yet Implemented
Not yet Implemented
From fd17a4db889c5ea83c1804bf3b338907491def3b Mon Sep 17 00:00:00 2001
From: Alan Talavera-Cordova <126989249+YoloMcFroyo@users.noreply.github.com>
Date: Mon, 3 Feb 2025 21:42:47 -0800
Subject: [PATCH 2/5] fix types to be accurate for their given and move
subscriber box within form container
---
src/components/PublishTesterComponent.vue | 42 +++++++++++++++++------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/src/components/PublishTesterComponent.vue b/src/components/PublishTesterComponent.vue
index 6ec5e2e..e8d3181 100644
--- a/src/components/PublishTesterComponent.vue
+++ b/src/components/PublishTesterComponent.vue
@@ -27,10 +27,31 @@ const currentConnectionIdx = computed(() => {
return idx;
});
+function convertMessage(topicType: string, message: string) {
+ switch (topicType) {
+ case 'std_msgs/Int32':
+ return { data: parseInt(message) };
+ case 'std_msgs/Bool':
+ return { data: message.toLowerCase() === 'true' };
+ case 'std_msgs/String':
+ return { data: message };
+ case 'std_msgs/Char':
+ return { data: message.charAt(0) };
+ case 'std_msgs/Float32':
+ return { data: parseFloat(message) };
+ case 'std_msgs/Time':
+ return { data: new Date(message).toISOString() };
+ case 'sensor_msgs/msg/CompressedImage':
+ return { data: message }; // Assuming the message is a base64 encoded string
+ default:
+ return { data: message };
+ }
+}
+
function publishTest() {
const topicName = input1.value;
const topicType = currentConnectionIdx.value === messageTypes.length ? customMessageType.value : input2.value;
- const topicMessage = input3.value;
+ const topicMessage = convertMessage(topicType, input3.value);
if (topicName && topicType && topicMessage) {
const testPublisher = createPublisher({
@@ -38,10 +59,7 @@ function publishTest() {
topicType: topicType as TopicType,
});
- testPublisher.publish({
- data: topicMessage,
- });
- console.log("Published:", { topicName, topicType, data: topicMessage });
+ testPublisher.publish(topicMessage);
const testSubscriber = createSubscriber({
topicName: topicName,
@@ -84,12 +102,14 @@ function publishTest() {