How to publish a proto type when the base parent class doesn't use ISAAC_PROTO_TX

the RosToProtoConverter.hpp script has a base class that can be used to parse any kind of ros message and publishes as a proto. But the RosToProto() class doesn’t use ISAAC_PROTO_TX( ) to create a TX, instead it directly uses
alice::ProtoTx<IsaacProtoType>& tx_proto() { return tx_proto_; }
alice::ProtoTx<IsaacProtoType> tx_proto_{this, "proto"};

So, when I try to fill the ToProto( data, tx_proto.initProto(), tx_proto.buffers( ) ), I am not sure how to create an instance of the prototype. (by defauly we use msg = tx_data().initProto() and updating the proto is not applicable here).

The instance type will be IsaacProtoType::Builder for a mutable proto. In your implementation of ToProto, you should not need to instantiate a new proto but modify the argument if I understand your question.

The code in RosToDifferentialBaseCommand.cpp is an example where ToProto has the following definition:

template <typename K, int N>
void ToProto(const State<K, N>& state, StateProto::Builder proto, std::vectorisaac::SharedBuffer& buffers);

Hi @hemals ,
I understand how I can create a new type from StateProto. For example, we have data types defined in differential_base.hpp that can act as the “data” for the ToProto function.
But how does one create <IsaacProtoType>= <ImuProto> . What datatype could I use to substitute to data argument of the ToProto functions. Can use a 6 dimensional vector as the input type for the ToProto function . Also how do I do this for a custom proto defined?
Are these functions defined anywhere else other than “math.hpp” and “messages/state/ directory” ?

Isaac SDK in 2021.1 uses Cap’n Proto for its IDL (Interface Definition Language) for managing protos (protocol buffers). You can take a look at sdk/2020.2/engine/engine/gems/serialization/tests/BUILD for an example of a capnp proto being defined and compiled into your library. ToProto and FromProto are just conventions and you can define and implement them for your protos anywhere you have linked in.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.