ROS action client sendGoalAndWait error: Java exception occurred: java.lang.NullPointerException
조회 수: 10 (최근 30일)
이전 댓글 표시
My ROS and matlab are both in Ubuntu system. I'm learning sending action goal messages to ROS by matlab. I run example: "Send and Cancel ROS Action Goals" in matlab, but error occurred. It showed "Java exception occurred: java.lang.NullPointerException". I don't know how to solve this problem. So thanks for who can help me.

-----------------------------------------------------------------------------------------------------------------------

답변 (1개)
Ivan Belyaev
2018년 5월 16일
편집: Ivan Belyaev
2018년 5월 16일
Dear Matlab, I have exact the same problem as Ben Lu except that I use FollowJointTrajectory. I have suspicion that some Java or Matlab ROS update destroyed actionclient in matlab. I tried the simple example from https://de.mathworks.com/help/robotics/ref/sendgoal.html. That works fluently, but with the code below it does not work.
Im working on mac 10.12.6 and have R2017b. Same problem had workmate with windows 10 and R2018.
On sendGoal(youbotClient,youbotGoalMsgs) it throws this:

Here is listing of my matlab program
function kuka_simulink_ros_action
global youbotClient youbotGoalMsgs;
[youbotClient,youbotGoalMsgs] = rosactionclient('/moveit/arm_controller/follow_joint_trajectory', 'control_msgs/FollowJointTrajectory');
waitForServer(youbotClient);
youbotGoalMsgs.Trajectory.JointNames = {'arm_joint_1','arm_joint_2','arm_joint_3','arm_joint_4','arm_joint_5','virtual_theta', 'virtual_x','virtual_y'};
youbotGoalMsgs.GoalTimeTolerance = rosduration(0,500000000);
points = rosmessage('trajectory_msgs/JointTrajectoryPoint');
trajectory = evalin('base', 'youbotTrajectory');
trj = trajectory.Data;
for i=1:length(trajectory.Data)
points(i) = rosmessage('trajectory_msgs/JointTrajectoryPoint');
points(i).Positions = [trj(i,4),trj(i,5),trj(i,6),trj(i,7),trj(i,8),trj(i,1),trj(i,2),trj(i,3)];
points(i).Velocities = [0,0,0,0,0,0,0,0];
points(i).Accelerations = [0,0,0,0,0,0,0,0];
points(i).TimeFromStart = rosduration(trajectory.Time(i));
end
youbotGoalMsgs.Trajectory.Points = points;
sendGoal(youbotClient,youbotGoalMsgs);
%delete(youbotClient);
end
PS One month ago exact the same code did worked!
참고 항목
카테고리
Help Center 및 File Exchange에서 Specialized Messages에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!