Received Data Error or Not Correct
Closed this issue · 2 comments
JAICHANGPARK commented
Import
import 'package:roslibdart/roslibdart.dart' as roslib;
Topic
- msg_type: type: "std_msgs/UInt8MultiArray",
backpackTopic = roslib.Topic(
ros: ros,
name: '/topic/button/backpack',
type: "std_msgs/UInt8MultiArray",
reconnectOnClose: true,
queueLength: 10,
queueSize: 10);
Error
App Side
I/flutter (12948): {"layout":{"dim":[{"label":"btn_lt_0","size":1,"stride":0},{"label":"btn_lt_1","size":1,"stride":0},{"label":"btn_rt_0","size":1,"stride":0},
{"label":"btn_rt_1","size":1,"stride":0}],"data_offset":0},
"data":"AQAAAA=="}
Flutter Error
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'String' is not a subtype of type 'List<dynamic>?' in type cast
host machine
- topic echo
layout:
dim:
- label: btn_lt_0
size: 1
stride: 0
- label: btn_lt_1
size: 1
stride: 0
- label: btn_rt_0
size: 1
stride: 0
- label: btn_rt_1
size: 1
stride: 0
data_offset: 0
data:
- 1
- 0
- 0
- 0
---
tmtong commented
I would use string as type rather than some complicated type like uintmultiarray. Then transform that string, which is in json format , back to whatever structure you need .
JAICHANGPARK commented
@tmtong
I changed uint8multiarray to int8multiarray
It's works fine
Thanks