Error using urROS2Node

59 views (last 30 days)
Jose
Jose on 10 Apr 2024 at 18:35
Commented: Jose on 17 Apr 2024 at 6:56
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 Robot\42 -- /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 Robot\42 -- /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:
  4 Comments
Jishnu
Jishnu on 17 Apr 2024 at 2:14
Edited: Jishnu on 17 Apr 2024 at 4:22
Hello Jose,
It appears to me the necessary ur_dashboard_msgs for service creation is unavailable. We set this up while performing the Hardware setup screens, in case this was not performed earlier could you complete it by following steps below:
  1. Go to the Home tab.
  2. Select Add-Ons > Manage Add-Ons.
  3. Locate the Robotics System Toolbox Support Package for Universal Robots UR Series Manipulator and select the gear icon adjacent to it.
  4. This opens the Setup screen, choose ROS2 and follow the instructions to complete the setup.
After completing the setup, try creating the urROS2Node again, if the issue persist pl. let us know.
Thanks
Jose
Jose on 17 Apr 2024 at 6:56
Hi Jishnu,
thank you very much for your response. I followed the suggested steps, but unfortunatly I still cannot create the urnode. This is the new error:
```
Error using urROS2Node (line 202)
ROS 2 action server "/scaled_joint_trajectory_controller/follow_joint_trajectory" is currently unavailable. Relaunch the ROS2 driver node and create urROS2Node.
```
However, I managed to control a real UR10e robot. So, my issue is clearly with the URsim, and I will work directly with the real robot.
Thanks for the support.

Sign in to comment.

Answers (0)

Categories

Find more on Network Connection and Exploration 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!