Problems with trajectory_msgs/JointTrajectory message type in Matlab-ROS
I am working with ROS toolbox in Matlab, I want to publish a message inside a topic to move the joints of my robot, but when I execute the command line:
msg.Points.Positions=zeros(6,1);
I get the following message:
Property assignment is not allowed when the object is empty. Use subscribed assignment to create an array element.
I have already searched many Matlab forums for the problem but nowhere have I seen the solution, has anyone worked with the ROS message type trajectory_msgs/JointTrajectory in Matlab?
I used it without any problem in C++, but I don't know what the problem is in Matlab, nor do I understand why the value of the Points attribute of the message cannot be modified, it seems that it cannot be made non-empty.
My complete code is as follows:
clc;
clear;
rosshutdown;
rosinit;
node=ros.Node('/kuka_joints');
pub= ros.Publisher(node,'/kuka_arm_controller/command','trajectory_msgs/JointTrajectory');
msg = rosmessage(pub);
msg.JointNames={'joint_A1' 'joint_A2' 'joint_A3' 'joint_A4' 'joint_A5' 'joint_A6'};
msg.Points.Positions=zeros(6,1);
send (pub,msg);
If I open the ROS message type in the Matlab workspace, this appears:
Here is an example of a problem similar to mine but the solution didn't work for me. I have several days with this problem.