ToProto Errors

Greetings,

We are working on writing a codelet where we need to use ToProto to send the command, but we are getting a ton of errors which say that there is no matching function call to ToProto. This is the code that we are using to run ToProto:

messages::HolonomicBaseControls command;
  command.speed_x() = 1.0;
  command.speed_y() = 1.0;
  command.angular_speed() = 0.0;  // This simple example sets zero angular speed
  auto param_proto = tx_cmd().initProto();
  ToProto(command, param_proto);
  tx_cmd().publish();

These are the errors that we are getting:

Use --sandbox_debug to see verbose messages from the sandbox
packages/driver2/Driver2.cpp: In member function 'virtual void isaac::Driver2::tick()':
packages/driver2/Driver2.cpp:23:31: error: no matching function for call to 'ToProto(isaac::messages::HolonomicBaseControls&, StateProto::Builder&)'
   ToProto(command, param_proto);
                               ^
In file included from packages/driver2/Driver2.cpp:3:0:
./messages/math.hpp:25:13: note: candidate: void isaac::ToProto(isaac::Quaternionf, QuaternionfProto::Builder)
 inline void ToProto(const Quaternionf q, ::QuaternionfProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:25:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'isaac::Quaternionf {aka Eigen::Quaternion<float>}'
./messages/math.hpp:36:13: note: candidate: void isaac::ToProto(const Quaterniond&, QuaterniondProto::Builder)
 inline void ToProto(const Quaterniond& q, ::QuaterniondProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:36:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Quaterniond& {aka const Eigen::Quaternion<double>&}'
./messages/math.hpp:47:13: note: candidate: void isaac::ToProto(const Vector2f&, Vector2fProto::Builder)
 inline void ToProto(const Vector2f& v, ::Vector2fProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:47:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector2f& {aka const Eigen::Matrix<float, 2, 1>&}'
./messages/math.hpp:56:13: note: candidate: void isaac::ToProto(const Vector3f&, Vector3fProto::Builder)
 inline void ToProto(const Vector3f& v, ::Vector3fProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:56:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector3f& {aka const Eigen::Matrix<float, 3, 1>&}'
./messages/math.hpp:66:13: note: candidate: void isaac::ToProto(const Vector4f&, Vector4fProto::Builder)
 inline void ToProto(const Vector4f& v, ::Vector4fProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:66:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector4f& {aka const Eigen::Matrix<float, 4, 1>&}'
./messages/math.hpp:81:13: note: candidate: void isaac::ToProto(const Vector5f&, Vector5fProto::Builder)
 inline void ToProto(const Vector5f& v, ::Vector5fProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:81:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector5f& {aka const Eigen::Matrix<float, 5, 1, 0, 5, 1>&}'
./messages/math.hpp:93:13: note: candidate: void isaac::ToProto(const Vector2d&, Vector2dProto::Builder)
 inline void ToProto(const Vector2d& v, ::Vector2dProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:93:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector2d& {aka const Eigen::Matrix<double, 2, 1>&}'
./messages/math.hpp:102:13: note: candidate: void isaac::ToProto(const Vector3d&, Vector3dProto::Builder)
 inline void ToProto(const Vector3d& v, ::Vector3dProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:102:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector3d& {aka const Eigen::Matrix<double, 3, 1>&}'
./messages/math.hpp:112:13: note: candidate: void isaac::ToProto(const Vector4d&, Vector4dProto::Builder)
 inline void ToProto(const Vector4d& v, ::Vector4dProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:112:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector4d& {aka const Eigen::Matrix<double, 4, 1>&}'
./messages/math.hpp:127:13: note: candidate: void isaac::ToProto(const Vector5d&, Vector5dProto::Builder)
 inline void ToProto(const Vector5d& v, ::Vector5dProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:127:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector5d& {aka const Eigen::Matrix<double, 5, 1, 0, 5, 1>&}'
./messages/math.hpp:139:13: note: candidate: void isaac::ToProto(const Vector2i&, Vector2iProto::Builder)
 inline void ToProto(const Vector2i& v, ::Vector2iProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:139:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector2i& {aka const Eigen::Matrix<int, 2, 1>&}'
./messages/math.hpp:148:13: note: candidate: void isaac::ToProto(const Vector3i&, Vector3iProto::Builder)
 inline void ToProto(const Vector3i& v, ::Vector3iProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:148:13: note:   no known conversion for argument 1 from 'isaac::messages::HolonomicBaseControls' to 'const Vector3i& {aka const Eigen::Matrix<int, 3, 1>&}'
./messages/math.hpp:158:13: note: candidate: void isaac::ToProto(const Vector4i&, Vector4iProto::Builder)
 inline void ToProto(const Vector4i& v, ::Vector4iProto::Builder builder) {
             ^~~~~~~
./messages/math.hpp:

Could you please guide us as to how to use ToProto in the correct way? Thank you.

The proportional control example under apps/tutorials/proportional_control_cpp addresses close to what you are doing, if you want a reference. The syntax should be

messages::HolonomicBaseControls command;
command.speed_x() = 1.0;
command.speed_y() = 1.0;
command.angular_speed() = 0.0;  // This simple example sets zero angular speed
ToProto(command, tx_cmd().initProto(),tx_cmd().buffers());
tx_cmd().publish();

Just make sure your tx_cmd() is a StateProto.

If you need the syntax for ‘FromProto()’, from what I’ve seen its

FromProto(rx_proto().getProto(),rx_proto().buffers(),message)

If you ever need to check the exact syntax for any of the state conversions, they can be found under engine/gems/state/io.hpp