Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 4

Comment by LucB for Just running these in an ipython terminal to look at the data, this is definitely not just a 1D list of data. Its a list of lists... of lists. You'd need to either flatten this out or create a new ROS message that is a list of list of lists of floats (though the outer most list only as the 1 enter, so maybe just list of lists). sens_data=np.zeros((1, 100, 10)) sens_data.tolist() Out[4]: [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]]

Next: Comment by stevemacenski for Just running these in an ipython terminal to look at the data, this is definitely not just a 1D list of data. Its a list of lists... of lists. You'd need to either flatten this out or create a new ROS message that is a list of list of lists of floats (though the outer most list only as the 1 enter, so maybe just list of lists). sens_data=np.zeros((1, 100, 10)) sens_data.tolist() Out[4]: [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]]
$
0
0
Thanks for your answer!! If i flatten it, how can i get the previous shape on the subscriber site? So far i got no experience with creating a custom message. Could you maybe give me an example on how i could do this? I couldn‘t figure out how it works on the [tutorial](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html) for numpy arrays. I also tried to convert it to a string which is deprecated and converts it direct to bytes. But also sending this message with bytes didn’t work. The data i collect is Sensordata. The purpose of sending this data is, that i have a AI which is predicting something based on the Sensordata. The AI is a LSTM-Network, thats why the data has to be in that shape. Maybe there is a better way of getting the data to my AI node?

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>