- What is the action type of '/gripper_action'.
- Is it a custom action that you created? If so, it is possible to share that with us?
- Where is your action server running (os, ros-version)?
- Do you see the error only after 'delete(gripper_actClient);' ? Or any other line of above code is responsible for this issue?
- Do you see the same issue with some other action type as well?
MATLAB has encountered an internal problem after deleting the action client
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Xin Xing
am 2 Nov. 2021
Kommentiert: Yongqing Li
am 1 Dez. 2022
Hallo,
Before, I used MATLAB to define actionclient to control the actionserver in ROS. After using it, I didn’t want to disconnect from ROS so that I could continue to send goals to actionserver. Therefore, I only deleted the current actionclient, as in the following example.
[gripper_actClient, gripper_msg] = rosactionclient('/gripper_action');
waitForServer(gripper_actClient);
gripper_msg.Type = 0;
[resultMsg, resultState] = sendGoalAndWait(gripper_actClient, gripper_msg);
delete(gripper_actClient);
However, after that, when I wanted to perform any operation in MATLAB, an error message appeared.
Connection to process with Exchange: "45b2b5d4-bb67-48e5-bf98-267b41dba48d " was lost.
I had to close matlab and restart it. When I run the above code again, it was still the same result. Has anyone encountered the same problem?
I used MATLAB R2021b in windows. I have also tried in Ubuntu 16.04 and there was same problem, but in macOS Big Sur (Version 11) not.
4 Kommentare
Prabeen Sahu
am 9 Nov. 2021
Hi Xin,
When you are going to delete the simple action client and the goal is not yet completed, you probably don’t want the goal to be running in simple action server. So before deleting the client, please try cancelling the goal through the client.
gripper_actClient.cancelGoal();
pause(0.2);
delete(gripper_actClient);
This probably will resolve your issue. If not, please reach out to us through the MathWorks® Technical Support. We may need more information to help you out.
-Prabeen
Akzeptierte Antwort
Karthik Reddy Vennapureddy
am 12 Mai 2022
Hi Xin,
In the action server callback implementation, the Preempt logic is outside the while loop and is never reached when the goal is being cancelled. When the goal is running by the server and we send a cancelGoal request from action client to action server, due to incorrect implementation of action server callback the goal keeps running and tries to send the feedback even if the actionclient is deleted and hence the issue.
The goal will be active until we make the status of goal as preempted or aborted in the action server. In this case, this is being done outside of while loop, which makes it infinite loop. So, to avoid this error please follow one of the below solutions.
Solution 1: Move the Preempt logic into while condition as below.
while(as.isActive())
{
...
...
//----------------------- Preempt -----------------
if(as.isPreemptRequested() || !ros::ok())
{
ROS_WARN("%s: Preempted", action_name.c_str());
as.setPreempted();
success = false;
}
else
{
success = true;
ROS_INFO("\nType: %i [0 - Basic mode 1 - Pinch mode 2 - Wide mode 3 - Scissor mode] \nWidth: %i \nSpeed: %i of 255\nForce: %i of 255", goal->type, weite, gswk, kraft);
}
oldStatus++;
r.sleep();
}
Solution 2: Change the while condition as below:
while(as.isActive() && !as.isPreemptRequested() && ros::ok())
{
....
}
Thanks,
Karthik Reddy
3 Kommentare
Yongqing Li
am 1 Dez. 2022
function [return_agent_pos_matrix,return_agent_index] = sendAllGoals(params,agent_pos,goal,ares_actClients,...
goalMsgs,ares_odomSubs, move_base_status_subs)
POSE_X = 1; %坐标 X
POSE_Y = 2; %坐标 Y
agent_num = params.agent_num;
agent_index = 1 : agent_num;
disp('sendgoal')
for i = 1:agent_num
goalMsgs(i).TargetPose.Pose.Position.X = goal(i,POSE_X);
goalMsgs(i).TargetPose.Pose.Position.Y = goal(i,POSE_Y);
goalMsgs(i).TargetPose.Pose.Orientation.Z = 0.99;
goalMsgs(i).TargetPose.Header.FrameId = 'map';
goalMsgs(i).TargetPose.Header.Stamp = rostime("now");
sendGoal(ares_actClients(i),goalMsgs(i));
end
...
% 仿真时间超过120s或者所有机器人到达设定的目标点
cancelAllGoals(ares_actClients(1));
...
return_agent_pos_matrix = agent_pos;
return_agent_index = agent_index;
end
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!