Clear Filters
Clear Filters

MATLAB has encountered an internal problem after deleting the action client

5 views (last 30 days)
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');
gripper_msg.Type = 0;
[resultMsg, resultState] = sendGoalAndWait(gripper_actClient, gripper_msg);
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.
Prabeen Sahu
Prabeen Sahu on 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.
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.
Xin Xing
Xin Xing on 10 Nov 2021
Hi Prabeen,
Unfortunately, I still have the same problem after trying a few times. :( But thank you so much for your help, I will ask MathWorks® Technical Support for help.
- Xin

Sign in to comment.

Accepted Answer

Karthik Reddy Vennapureddy
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.
//----------------------- Preempt -----------------
if(as.isPreemptRequested() || !ros::ok())
ROS_WARN("%s: Preempted", action_name.c_str());
success = false;
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);
The same is recommended by ROS Community : Link.
Solution 2: Change the while condition as below:
while(as.isActive() && !as.isPreemptRequested() && ros::ok())
Karthik Reddy
Yongqing Li
Yongqing Li on 1 Dec 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;
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");
% 仿真时间超过120s或者所有机器人到达设定的目标点
return_agent_pos_matrix = agent_pos;
return_agent_index = agent_index;

Sign in to comment.

More Answers (0)


Find more on Publishers and Subscribers in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!