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.

Reply via email to