Subscripted Assignment to Create Array Element
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (2)
Yinai Fan
el 31 de Oct. de 2016
0 votos
Hi I got the same problem, did you solve it? Thank you.
Umer Huzaifa
el 26 de Abr. de 2017
0 votos
Categorías
Más información sobre Publishers and Subscribers en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!