Publishing joint information from a Gazebo plugin

Hi !

I am looking to be able to publish some info of my robot joints from a plugin (I don’t want to use ROS). I created two types of custom messages :

syntax = “proto2”;
package gazebo_plugin_msgs.msgs;
import “vector3d.proto”;

message JointMessage
{
required string name =1;
required gazebo.msgs.Vector3d velocity =2;
required gazebo.msgs.Vector3d position = 3;

}

And :

syntax = “proto2”;
package gazebo_plugin_msgs.msgs;
import “joint_message.proto”;

message JointVMessage
{
required gazebo_plugin_msgs.msgs.JointMessage joint1 =1;
required gazebo_plugin_msgs.msgs.JointMessage joint2 =2;
required gazebo_plugin_msgs.msgs.JointMessage joint3 =3;
required gazebo_plugin_msgs.msgs.JointMessage joint4 =4;
optional gazebo_plugin_msgs.msgs.JointMessage joint5 =5;
optional gazebo_plugin_msgs.msgs.JointMessage joint6 =6;
optional gazebo_plugin_msgs.msgs.JointMessage joint7 =7;
optional gazebo_plugin_msgs.msgs.JointMessage joint8 =8;

}

My problem is that I don’t know how to write my messages in the code. I tried :

And some other possibilities but I am always faced to same error :

error: passing ‘const gazebo::msgs::Vector3d’ as ‘this’ argument discards qualifiers [-fpermissive]
joint_to_publish.velocity() = gazebo::msgs::Convert(vel);

I am a beginner in c++ use, and I don’t understand why my element “joint_to_publish” is “const”. I had problem to set its name, now it is working, but I don’t know how to set its velocity and position (both Vector3d).
Can you help me please?
Thanks in advance, have a good day :slight_smile: