diff --git a/src/dummy_selection_provider.cpp b/src/dummy_selection_provider.cpp index a5d884bbb5a616145c75def4a63664f160731e33..3a631af60cf849ea2faff94f47c99e2c5614c533 100644 --- a/src/dummy_selection_provider.cpp +++ b/src/dummy_selection_provider.cpp @@ -28,7 +28,7 @@ nng_socket sock; int rv; void sendSelection(const std::string &object) { - ROS_INFO_STREAM("Selecting random object: " << object); + ROS_INFO_STREAM("Sending selection of: " << object); Selection selection; selection.set_id(object); int length = selection.ByteSize(); @@ -40,12 +40,6 @@ void sendSelection(const std::string &object) { } } -std::string ProtoToJson(const google::protobuf::Message &proto) { - std::string json; - google::protobuf::util::MessageToJsonString(proto, &json); - return json; -} - int main(int argc, char **argv) { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -67,8 +61,7 @@ int main(int argc, char **argv) { ROS_WARN_STREAM("nng_dial returned: " << nng_strerror(rv) << ". Trying to connect again in one second..."); connection_retry_rate.sleep(); } - ROS_INFO_STREAM("nng_dial returned: " << nng_strerror(rv) << " (which is the translation of error code " << rv - << "). Connection established!"); + ROS_INFO_STREAM("NNG connection established to " << URL); ros::Rate loop_rate(200); ros::Rate pause_rate(ros::Duration(2)); // seconds @@ -159,6 +152,7 @@ int main(int argc, char **argv) { pause_rate.sleep(); std::string object{objects[distribution(rng)]}; + ROS_INFO_STREAM("Selecting random object: " << object); sendSelection(object); // wait again, then send the bin object @@ -171,6 +165,9 @@ int main(int argc, char **argv) { std::string bin{bins[binDistribution(rng)]}; ROS_INFO_STREAM("Selecting random bin: " << bin); sendSelection(bin); + + // wait some time before starting the next selection + pause_rate.sleep(); } } } else if (rv == NNG_EAGAIN) {