0
$\begingroup$

Rosanswers logo

The data I want to publish is in a tuple. Initially i tried using int64 [] field type in my custom message, but that did not work, which makes sense. How do I use tuple field type?


Originally posted by SS2.0 on ROS Answers with karma: 3 on 2018-01-09

Post score: 0


Original comments

Comment by jayess on 2018-01-09:
Welcome! Can you please show us what you've tried by updating your question with your code and the data that you're trying to publish? Also, what does

did not work

mean? Did you get an error?

Comment by SS2.0 on 2018-01-09:
I do not have access to the code immediately. The data I am trying to publish is a tuple containing 3 ints and a bytearray. The data is bulk data so it is 256 tuples that I am trying to publish at once. When I used int64 [], it gave a serialization error.

Comment by jayess on 2018-01-09:
Ok, when you do get access to it please update your question with it along with a copy and paste of the error.

Comment by SS2.0 on 2018-01-09:
I am not able to copy paste the code here due to the character limit

Comment by jayess on 2018-01-09:
You can edit your question to do that. Comments are good for providing updates to questions for this reason.

Comment by SS2.0 on 2018-01-10:
Thanks for the advice. I have done that.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

From your comment above you'll need to make two messages to do this. The first message will be your tuple containing the three ints and the byte array. Then you'll need to make another message which is an array of the first message type.

By nesting custom messages like this complex data structures can be created. Let us know how you get on with this.


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2018-01-09

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by SS2.0 on 2018-01-09:
Is there a tuple datatype in rospy?

Comment by SS2.0 on 2018-01-09:
(0 0x1a4 0x0000100000000035 8)

This is an example of what I want to publish. There are 256 of these tuples that I want to publish in one go. What fieldtype do I define in my ROS custom message?

Comment by SS2.0 on 2018-01-11:
Got it working now. Thanks for the advice.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.