So, what I found out until now, that for some reasons in
//pack spd, acc, jrk
no values are stored. However, pose works. So the error message is shown
because I want to access non existing data.
I can print all data in the for-loops and spd[i], acc[i[, and jrk[i]
contain values. I also can access them after storing it in Control2Arm.
They just don't survive serialization and parsing.
B
On Wednesday, October 1, 2014 5:18:46 PM UTC+2, BKonz wrote:
Hello,
I have the following Message in my .proto file:
message Control2Arm{
required int32 command = 1;
repeated double pose = 2;
repeated double spd = 3;
repeated double acc = 4;
repeated double jrk = 5;
}
In one class I do this:
Control2Arm c2a;
c2a.set_command(1);
//pack pose
for (int i = 0; i 3; i++) {
for (int j = 0; i 3; i++) {
c2a.add_pose(pose(i, j));
}
}
//pack spd
for (int i = 0; i 3; i++) {
c2a.add_spd(spd[i]);
}
//pack acc
for (int i = 0; i 3; i++) {
c2a.add_acc(acc[i]);
}
//pack jrk
for (int i = 0; i 3; i++) {
c2a.add_jrk(jrk[i]);
}
std::string s;
c2a.SerializeToString(s);
later I parse it:
Control2Arm t;
bool parsed = t.ParseFromArray(_str[0], _str.size());
It works when I don't use repeated in the message and only send one value.
With repeated I get:
[libprotobuf FATAL
/usr/local/include/google/protobuf/repeated_field.h:613] CHECK failed:
(index) (size()):
Is the error in the part I posted?
Thanks a lot.
B
--
You received this message because you are subscribed to the Google Groups
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.