Show use of the yarp::os::PortablePair class, to send messages of mixed type. If the component types follow the YARP network data format, then their composition will also.
constexpr double loop_delay = 0.25;
int main(
int argc,
char* argv[])
{
Port port;
PortablePair<Bottle, Vector> pp;
port.open("/pp");
pp.head.fromString("this is the bottle part");
int ct = 1;
int ct2 = 1;
while (true) {
v[0] = ct;
v[1] = ct2;
v[2] = ct * ct2;
pp.body = v;
port.write(pp);
printf("Sent output to %s...\n", port.getName().c_str());
ct++;
if (ct > 10) {
ct2 = 1 + (ct2 + 1) % 10;
ct = 1;
}
}
return 0;
}