Subscripted Assignment to Create Array Element
Mostra commenti meno recenti
Hi,
I am using MATLAB with Robotics System Toolbox. I am running a Gazebo simulation in ROS that I want MATLAB to talk to. In particular, I want to make a node for a given topic related to that simulation. The way to do this is following (as I understood from the tutorials and examples):
pub_cmd=rospublisher('<any topic that receives commands>');
pub_cmd_msg=rosmessage(pub_cmd)
Now, pub_cmd_msg returns the following:
pub_cmd_msg =
ROS JointTrajectory message with properties:
MessageType: 'trajectory_msgs/JointTrajectory'
Header: [1x1 Header]
JointNames: {0x1 cell}
Points: [0x1 JointTrajectoryPoint]
Use showdetails to show the contents of the message.
Now as I try to assign some values to different fields in this pub_cmd_msg, I get the following error:
pub_cmd_msg.Points
ans =
0x1 ROS JointTrajectoryPoint message array with properties:
MessageType
TimeFromStart
Positions
Velocities
Accelerations
Effort
>> pub_cmd_msg.Points.Positions=ones(1,7)
Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.
I have no idea what the error means and how can subscripted assignment help? Kindly guide how can I solve this problem.
Risposta accettata
Più risposte (2)
Yinai Fan
il 31 Ott 2016
0 voti
Hi I got the same problem, did you solve it? Thank you.
Umer Huzaifa
il 26 Apr 2017
0 voti
Categorie
Scopri di più su Publishers and Subscribers in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!