Subscripted Assignment to Create Array Element
이전 댓글 표시
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.
채택된 답변
추가 답변 (2개)
Yinai Fan
2016년 10월 31일
0 개 추천
Hi I got the same problem, did you solve it? Thank you.
카테고리
도움말 센터 및 File Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!