Error using urROS2Node
Hi,
I am using MATLAB 2024a in linux, where I have installed ROS 2 and Dependencies as proposed in here by using the automated method.
As can be seen in the picture, evrething seems to work fine.
However, I am trying to connect to the UR simulator, as explained in this example using this script:
clear, clc;
ur5e = loadrobot(‘universalUR5e’);
username = ‘xxxxxx’;
password = ‘xxxxxxx’;
ROS2Folder = ‘/opt/ros/humble’;
ROS2Workspace = ‘/opt/ros/humble’; % In case of binary installation, ROS 2 Work-space is same as ROS 2 Folder
ROS2DeviceAddress = ‘192.168.56.1’;
robotAddress = ‘192.168.56.101’;
device = ros2device(ROS2DeviceAddress,username,password);
device.ROS2Folder = ROS2Folder;
device.ROS2Workspace = ROS2Workspace;
generateAndTransferLaunchScriptROS2GettingStarted(device,ROS2Workspace,robotAddress);
pause(10)
ur = urROS2Node(‘RigidBodyTree’,ur5e);
and modifying the associated function so it works on simulation:
function generateAndTransferLaunchScriptROS2GettingStarted(device,WorkSpaceFolder,RobotAddress)
% Open a file to write set of commands to launch simulated UR5e
% in URSim
fid=fopen(fullfile(tempdir,"launchUR5eROS2.sh"),"w+");
% launch depending on the installation of ros2 ur driver
if strcmp(WorkSpaceFolder, device.ROS2Folder)
% Launch command for binary installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,RobotAddress);
else
% Launch command for source installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; source %s/install/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,WorkSpaceFolder,RobotAddress);
end
fclose(fid);
% Copy file into ROS2 device
putFile(device,fullfile(tempdir,’launchUR5eROS2.sh’),’~/’)
% Make the shell script executable
system(device,’chmod a+x ~/launchUR5eROS2.sh’);
% Launch the script
% system(device,’./launchUR5eROS2HWSetup.sh &’);
system(device,’./launchUR5eROS2.sh &’); % JL: I use this instead
end
The UR sim loger viewer indicates that the communication is reached.
However, I am getting this error:
Error using ros.internal.getEmptyMessage>getMessageDataAndInfo (line 70)
How could I solve it so I can continue with the example execution?
Screenshot of the Matlab and urSim windows:Hi,
I am using MATLAB 2024a in linux, where I have installed ROS 2 and Dependencies as proposed in here by using the automated method.
As can be seen in the picture, evrething seems to work fine.
However, I am trying to connect to the UR simulator, as explained in this example using this script:
clear, clc;
ur5e = loadrobot(‘universalUR5e’);
username = ‘xxxxxx’;
password = ‘xxxxxxx’;
ROS2Folder = ‘/opt/ros/humble’;
ROS2Workspace = ‘/opt/ros/humble’; % In case of binary installation, ROS 2 Work-space is same as ROS 2 Folder
ROS2DeviceAddress = ‘192.168.56.1’;
robotAddress = ‘192.168.56.101’;
device = ros2device(ROS2DeviceAddress,username,password);
device.ROS2Folder = ROS2Folder;
device.ROS2Workspace = ROS2Workspace;
generateAndTransferLaunchScriptROS2GettingStarted(device,ROS2Workspace,robotAddress);
pause(10)
ur = urROS2Node(‘RigidBodyTree’,ur5e);
and modifying the associated function so it works on simulation:
function generateAndTransferLaunchScriptROS2GettingStarted(device,WorkSpaceFolder,RobotAddress)
% Open a file to write set of commands to launch simulated UR5e
% in URSim
fid=fopen(fullfile(tempdir,"launchUR5eROS2.sh"),"w+");
% launch depending on the installation of ros2 ur driver
if strcmp(WorkSpaceFolder, device.ROS2Folder)
% Launch command for binary installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,RobotAddress);
else
% Launch command for source installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; source %s/install/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,WorkSpaceFolder,RobotAddress);
end
fclose(fid);
% Copy file into ROS2 device
putFile(device,fullfile(tempdir,’launchUR5eROS2.sh’),’~/’)
% Make the shell script executable
system(device,’chmod a+x ~/launchUR5eROS2.sh’);
% Launch the script
% system(device,’./launchUR5eROS2HWSetup.sh &’);
system(device,’./launchUR5eROS2.sh &’); % JL: I use this instead
end
The UR sim loger viewer indicates that the communication is reached.
However, I am getting this error:
Error using ros.internal.getEmptyMessage>getMessageDataAndInfo (line 70)
How could I solve it so I can continue with the example execution?
Screenshot of the Matlab and urSim windows: Hi,
I am using MATLAB 2024a in linux, where I have installed ROS 2 and Dependencies as proposed in here by using the automated method.
As can be seen in the picture, evrething seems to work fine.
However, I am trying to connect to the UR simulator, as explained in this example using this script:
clear, clc;
ur5e = loadrobot(‘universalUR5e’);
username = ‘xxxxxx’;
password = ‘xxxxxxx’;
ROS2Folder = ‘/opt/ros/humble’;
ROS2Workspace = ‘/opt/ros/humble’; % In case of binary installation, ROS 2 Work-space is same as ROS 2 Folder
ROS2DeviceAddress = ‘192.168.56.1’;
robotAddress = ‘192.168.56.101’;
device = ros2device(ROS2DeviceAddress,username,password);
device.ROS2Folder = ROS2Folder;
device.ROS2Workspace = ROS2Workspace;
generateAndTransferLaunchScriptROS2GettingStarted(device,ROS2Workspace,robotAddress);
pause(10)
ur = urROS2Node(‘RigidBodyTree’,ur5e);
and modifying the associated function so it works on simulation:
function generateAndTransferLaunchScriptROS2GettingStarted(device,WorkSpaceFolder,RobotAddress)
% Open a file to write set of commands to launch simulated UR5e
% in URSim
fid=fopen(fullfile(tempdir,"launchUR5eROS2.sh"),"w+");
% launch depending on the installation of ros2 ur driver
if strcmp(WorkSpaceFolder, device.ROS2Folder)
% Launch command for binary installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,RobotAddress);
else
% Launch command for source installation
fprintf(fid,"gnome-terminal –title=42Simulated UR5e Robot42 — /bin/bash -c ‘source %s/setup.bash; source %s/install/setup.bash; ros2 launch ur_robot_driver ur5e.launch.py launch_rviz:=false robot_ip:=%s’",device.ROS2Folder,WorkSpaceFolder,RobotAddress);
end
fclose(fid);
% Copy file into ROS2 device
putFile(device,fullfile(tempdir,’launchUR5eROS2.sh’),’~/’)
% Make the shell script executable
system(device,’chmod a+x ~/launchUR5eROS2.sh’);
% Launch the script
% system(device,’./launchUR5eROS2HWSetup.sh &’);
system(device,’./launchUR5eROS2.sh &’); % JL: I use this instead
end
The UR sim loger viewer indicates that the communication is reached.
However, I am getting this error:
Error using ros.internal.getEmptyMessage>getMessageDataAndInfo (line 70)
How could I solve it so I can continue with the example execution?
Screenshot of the Matlab and urSim windows: urros2node, ur robot, ros2 MATLAB Answers — New Questions