Coder config for deploying ROS2 nodes to NVIDIA Jetson Nano running Ubuntu 22.04 - error 'Expected hostname to be nonempty'

9 次查看(过去 30 天)
Hi all,
I'm trying to use Matlab coder (v2024b) to deploy ROS2 nodes, among other things, to a Jetson nano (non-standardly updated to run Ubuntu 22.04 and ROS2 Humble). However, it seems as though the coder is ignoring my device address config. When I try to compile my function (a simple topic subscriber) using the following config, the build fails. The build log has only two lines:
Connecting to ROS 2 device at ''.
Expected hostname to be nonempty.
I am configuring and calling the coder as follows:
deviceAddress = '192.168.55.1'; %SSH IP address
userName = 'user';
password = 'password';
setenv('RMW_IMPLEMENTATION','rmw_cyclonedds_cpp')
% configure coder
cfg = coder.config('exe');
cfg.Hardware = coder.hardware("Robot Operating System 2 (ROS 2)");
cfg.Hardware.ROS2Workspace = '~/ros2_px4_ws';
cfg.Hardware.ROS2Folder = '/opt/ros/humble' ;
cfg.Hardware.BuildAction = "Build and run";
cfg.Hardware.RemoteDeviceAddress = deviceAddress;
cfg.Hardware.RemoteDeviceUsername = userName;
cfg.Hardware.RemoteDevicePassword = password;
cfg.Hardware.DeployTo = "Remote Device";
%cfg.HardwareImplementation.ProdHWDeviceType = 'Intel->x86-64 (Linux 64)';
cfg.HardwareImplementation.ProdHWDeviceType = 'ARM Compatible->ARM 64-bit (LP64)';
cfg.HardwareImplementation.ProdLongLongMode = true;
%generate code
codegen('-config', cfg, '-args', {}, 'ros2Listener_uxrce', '-report');
And the function I am trying to run is:
%MOCAP LISTENER - TEST ROS2 CONNECTION
function ros2Listener_uxrce()
%% LOG DESTINATION
clear imuMsgLog
mocapMsgLog = [];
%% ROS2 INITIALISATIONS
uxrceNode = ros2node("uxrce_node", 2); %create node
uxrceSub = ros2subscriber(uxrceNode, '/fmu/out/sensor_combined', "px4_msgs/SensorCombined", Reliability="besteffort"); % create subscriber
%% RECORDING LOOP
disp('Reading uxrce data...');
for i=1:2000
newUxrceMsg = receive(uxrceSub, 2); %receive mocap message
newUxrceMsg_gyro = newUxrceMsg .gyro_rad;
newUxrceMsg_accel = newUxrceMsg .accelerometer_m_s2;
disp([newUxrceMsg_gyro newUxrceMsg_accel]);
pause(0.2);
end
end
Update: I have tried a similar topic subscriber model in Simulink, and it connected and deployed successfully.
Update: Here is the Simulink build log, for comparison:
### Starting build procedure for: ros2Sub
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Users\Alyssa\Documents\MATLAB\Examples\R2024b\ros\GenerateCUDAROSNodeFromMATLABExample\ros2Sub_ert_rtw
### Generated code for 'ros2Sub' is up to date because no structural, parameter or code replacement library changes were found.
### Saving binary information cache.
### Using toolchain: Colcon Tools
Archive for model 'ros2Sub' is up to date. File location: 'C:\Users\Alyssa\Documents\MATLAB\Examples\R2024b\ros\GenerateCUDAROSNodeFromMATLABExample\ros2Sub.tgz'
### Building 'ros2Sub': all
Success
### Successfully generated all binary outputs.
ROS Device Connection Test
Build and run
Connecting to ROS 2 device at '192.168.55.1'.
Using ROS 2 workspace '/home/alyssa/ws_ros2_px4' to build ROS 2 node.
---
Node 'ros2Sub' is already running. Stopping the running node.
---
Transferring generated code for 'ros2Sub' to ROS device.
Starting build for ROS node.
---
ROS 2 project directory: /home/alyssa/ws_ros2_px4/src
[2.632s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'px4_msgs' is in: /home/alyssa/ws_ros2_px4/install/px4_msgs
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.
If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding px4_msgs
This may be promoted to an error in a future release of colcon-override-check.
Starting >>> px4_msgs
Finished <<< px4_msgs [7.54s]
Starting >>> ros2sub
[Processing: ros2sub]
Finished <<< ros2sub [54.7s]
Summary: 2 packages finished [1min 4s]
---
Running ROS 2 node.
---
Use the 'ros2device' object to stop or start the generated node.
### Successful completion of build procedure for: ros2Sub
Build process completed successfully
Build Summary
Top model targets:
Model Build Reason Status Build Duration
================================================================================
ros2Sub Compilation artifacts were out of date. Code compiled. 0h 1m 19.499s
1 of 1 models built (0 models already up to date)
Build duration: 0h 1m 20.1s
  4 个评论

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 ROS Network Access in Simulink 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by