首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ROS中运行Simulink FMU时出错:“创建dllfmu失败”

问在ROS中运行Simulink FMU时出错:“创建dllfmu失败”
EN

Stack Overflow用户
提问于 2022-04-27 07:26:52
回答 1查看 73关注 0票数 0

我试图在ROS中运行一个Simulink FMU,以便在Gazebo进行联合仿真。我已经能够在Python中模拟和验证FMU,但是,当我尝试在ROS中加载它时,我得到了一个错误。

我正在尝试这个问题,问题是ROS无法找到Linux的二进制文件(二进制文件/Linux 64中的fmu_traject.so文件),因为FMU是在Windows 10中导出的,我试图在Ubuntu18.04中加载它。解决方案只是从安装在Ubuntu machine.next命令中的MATLAB-Simulink从这指南导出FMU。在第一航站楼:

代码语言:javascript
复制
source /opt/ros/dashing/setup.bash
cd ~/FMI/Trajectory # The path where the FMU is
ros2 run fmi_adapter fmi_adapter_node __params:=my_params.yaml

以防万一,文件"my_parmas.yaml"只包含到FMU的路径:

代码语言:javascript
复制
fmi_adapter_node:
  ros__parameters:
    fmu_path: '/home/ubuntu1804/FMI/Trajectory/fmu_traject.fmu'

在第二航站楼:

代码语言:javascript
复制
source /opt/ros/dashing/setup.bash
ros2 lifecycle set /fmi_adapter_node configure
ros2 lifecycle set /fmi_adapter_node activate

在运行ros2 lifecycle set /fmi_adapter_node configure之后,将在终端2中打印以下内容:

代码语言:javascript
复制
Transitioning failed

下一个错误出现在终端1中:

代码语言:javascript
复制
[ERROR][FMI2XML] Start attribute is required for this causality, variability and initial combination
[FATAL][FMILIB] Could not change to the DLL directory /tmp/fmi_adapter_DrX8pj/binaries/linux64/
[FATAL][FMILIB] The FMU contains no binary for this platform.
[ERROR] []: Caught exception in callback for transition 10
[ERROR] []: Original error: Creation of dllfmu failed!
[WARN] []: Error occurred while doing error handling.

此外,我还测试了如何创建一个启动文件并以以下方式运行它。

代码语言:javascript
复制
source /opt/ros/dashing/setup.bash
cd ~/FMI/Trajectory # The path where the FMU is
ros2 launch SimulinkFMU_launcher.launch.py

我在启动文件"SimulinkFMU_launcher.launch.py"下面附加,它完全基于上述指南。

代码语言:javascript
复制
import ament_index_python.packages

import launch
import launch.actions
import launch.launch_description_sources
import launch.substitutions


def generate_launch_description():
    # fmu_path = (ament_index_python.packages.get_package_share_directory('fmi_adapter_examples') +
    #             '/share/DampedPendulum.fmu')
    fmu_path = 'FMI/Trajectory/fmu_traject.fmu'

    fmi_adapter_description = launch.actions.IncludeLaunchDescription(
        launch.launch_description_sources.PythonLaunchDescriptionSource(
            ament_index_python.packages.get_package_share_directory(
                'fmi_adapter') + '/launch/fmi_adapter_node.launch.py'),
        launch_arguments={'fmu_path': fmu_path}.items())

    description = launch.LaunchDescription()
    description.add_action(fmi_adapter_description)

    return description

这是我在启动文件中获得的日志:

代码语言:javascript
复制
[INFO] [launch]: All log files can be found below /home/ubuntu1804/.ros/log/2022-04-27-09-24-45-820715-ubuntu-13445
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [fmi_adapter_node-1]: process started with pid [13462]
[fmi_adapter_node-1] [ERROR] []: Caught exception in callback for transition 10
[fmi_adapter_node-1] [ERROR] []: Original error: Given FMU file 'FMI/Trajectory/fmu_traject.fmu' not found or cannot be read!
[fmi_adapter_node-1] [WARN] []: Error occurred while doing error handling.
[ERROR] [launch_ros.actions.lifecycle_node]: Failed to make transition 'TRANSITION_CONFIGURE' for LifecycleNode '/fmi_adapter_node'
EN

回答 1

Stack Overflow用户

发布于 2022-05-02 06:20:01

问题是ROS无法找到Linux的二进制文件(二进制文件/Linux 64中的fmu_traject.so文件),因为FMU是在Windows 10中导出的,我试图在Ubuntu18.04中加载它。解决方案只是从安装在Ubuntu机器上的导出FMU。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72024837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档