1

阿木币

0

精华

3 小时

在线时间

应届白菜

Rank: 1

发表于 2020-5-13 13:40:39 12764 浏览 14 回复

启动仿真后无法与mavros进行链接

执行的launch指令:roslaunch px4 posix_sitl.launch

仿真进程如下:

... logging to /home/ytx/.ros/log/dd705336-94d4-11ea-bc0b-3cf011eaed81/roslaunch-ytx-NH5x-7xRCx-RDx-22764.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ytx-NH5x-7xRCx-RDx:34167/

SUMMARY
========

PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
* /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    sitl (px4/px4)
    vehicle_spawn_ytx_NH5x_7xRCx_RDx_22764_6706198925932835665 (gazebo_ros/spawn_model)

auto-starting new master
process[master]: started with pid [22774]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to dd705336-94d4-11ea-bc0b-3cf011eaed81
process[rosout-1]: started with pid [22787]
started core service [/rosout]
process[sitl-2]: started with pid [22811]
node name: sitl
data path: /home/ytx/PX4/Firmware
commands file: /home/ytx/PX4/Firmware/posix-configs/SITL/init/ekf2/iris
78 WARNING: setRealtimeSched failed (not run as root?)

______  __   __    ___
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

process[gazebo-3]: started with pid [22819]
INFO  [dataman] Unknown restart, data manager file 'rootfs/fs/microsd/dataman' size is 11405132 bytes
INFO  [simulator] Waiting for initial data on UDP port 14562. Please start the flight simulator to proceed..
process[gazebo_gui-4]: started with pid [22828]
process[vehicle_spawn_ytx_NH5x_7xRCx_RDx_22764_6706198925932835665-5]: started with pid [22833]
[ INFO] [1589345256.754300078]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1589345256.754901178]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1589345256.781596758]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1589345256.782301785]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
SpawnModel script started
[INFO] [1589345257.172141, 0.000000]: Loading model XML from file
[INFO] [1589345257.172522, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[INFO] [1589345257.174041, 0.000000]: Calling service /gazebo/spawn_sdf_model
[ INFO] [1589345257.209022244, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[INFO] [1589345257.465322, 0.150000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1589345257.479548718, 0.150000000]: Physics dynamic reconfigure ready.
[vehicle_spawn_ytx_NH5x_7xRCx_RDx_22764_6706198925932835665-5] process has finished cleanly
log file: /home/ytx/.ros/log/dd705336-94d4-11ea-bc0b-3cf011eaed81/vehicle_spawn_ytx_NH5x_7xRCx_RDx_22764_6706198925932835665-5*.log
[ INFO] [1589345257.703929750, 0.150000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1589345257.707741592, 0.150000000]: Camera Plugin (ns = iris)  <tf_prefix_>, set to "iris"
[ INFO] [1589345257.820196198, 0.172000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1589345257.852688379, 0.204000000]: Physics dynamic reconfigure ready.


这时尝试执行:roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"  无法链接至mavros。
与正确运行的例子相比较,发现缺少[simulator]的后续信息以及mavlink的信息。怀疑是不是仿真进程并没有进行完全?
补充:仿真界面可以正常显示。编译源码时使用make posix_sitl_default gazebo后启动的仿真是正常的,可以链接mavlink并进行后续控制。

eason已获得悬赏 2 阿木币

最佳答案

这个问题吧!首先明确一下有两种可以仿真 的方式。第一种是进入Firmware固件下面,执行make指令启动仿真,执行一大串连接mavros。然后可以正常使用。第一种方式100%没问题,有问题的话,那么就是你环境变量的问题了 ...

扫一扫浏览分享
回复

使用道具 举报

0

阿木币

0

精华

182 小时

在线时间

技术大V

Rank: 4

发表于 2020-5-13 17:29:40
能否将你的launch文件公开,看一下?
回复 点赞

使用道具 举报

1

阿木币

0

精华

3 小时

在线时间

应届白菜

Rank: 1

 楼主| 发表于 2020-5-13 17:36:09
chasing 发表于 2020-5-13 17:29
能否将你的launch文件公开,看一下?

<?xml version="1.0"?>
<launch>
    <!-- Posix SITL environment launch script -->
    <!-- launches PX4 SITL, Gazebo environment, and spawns vehicle -->
    <!-- vehicle pose -->
    <arg name="x" default="0"/>
    <arg name="y" default="0"/>
    <arg name="z" default="0"/>
    <arg name="R" default="0"/>
    <arg name="P" default="0"/>
    <arg name="Y" default="0"/>
    <!-- vehicle model and world -->
    <arg name="est" default="ekf2"/>
    <arg name="vehicle" default="iris"/>
    <arg name="mymodel" default="iris_fpv_cam"/>
    <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
    <arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg mymodel)/$(arg mymodel).sdf"/>
    <arg name="rcS" default="$(find px4)/posix-configs/SITL/init/$(arg est)/$(arg vehicle)"/>
    <!-- gazebo configs -->
    <arg name="gui" default="true"/>
    <arg name="debug" default="false"/>
    <arg name="verbose" default="false"/>
    <arg name="paused" default="false"/>
    <arg name="respawn_gazebo" default="false"/>
    <!-- PX4 configs -->
    <arg name="interactive" default="true"/>
    <!-- PX4 SITL -->
    <arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
    <arg     if="$(arg interactive)" name="px4_command_arg1" value=""/>
    <node name="sitl" pkg="px4" type="px4" output="screen" args="$(find px4) $(arg rcS) $(arg px4_command_arg1)" required="true"/>
    <!-- Gazebo sim -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="gui" value="$(arg gui)"/>
        <arg name="world_name" value="$(arg world)"/>
        <arg name="debug" value="$(arg debug)"/>
        <arg name="verbose" value="$(arg verbose)"/>
        <arg name="paused" value="$(arg paused)"/>
        <arg name="respawn_gazebo" value="$(arg respawn_gazebo)"/>
    </include>
    <!-- gazebo model -->
    <node name="$(anon vehicle_spawn)" pkg="gazebo_ros" type="spawn_model" output="screen" args="-sdf -file $(arg sdf) -model $(arg vehicle) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>
</launch>

几乎没改,就是加了个摄像头
回复 点赞

使用道具 举报

0

阿木币

0

精华

182 小时

在线时间

技术大V

Rank: 4

发表于 2020-5-13 17:41:33

如果摄像头部分去了呢?
回复 点赞

使用道具 举报

1

阿木币

0

精华

3 小时

在线时间

应届白菜

Rank: 1

 楼主| 发表于 2020-5-13 17:55:51
chasing 发表于 2020-5-13 17:41
如果摄像头部分去了呢?

还是一样的情况。
回复 点赞

使用道具 举报

0

阿木币

0

精华

182 小时

在线时间

技术大V

Rank: 4

发表于 2020-5-13 18:04:53
beanbee 发表于 2020-5-13 17:55
还是一样的情况。

https://blog.csdn.net/qq_15390133/article/details/105327213 你看一下这个链接,流程一样么?
回复 点赞

使用道具 举报

1

阿木币

0

精华

3 小时

在线时间

应届白菜

Rank: 1

 楼主| 发表于 2020-5-13 18:28:41
当时用的是2进制安装,我卸载一下再源码安装试试吧
回复 点赞

使用道具 举报

209

阿木币

1

精华

52 小时

在线时间

老司机

Rank: 2

发表于 2020-5-14 09:03:49
chasing 发表于 2020-5-13 18:04
https://blog.csdn.net/qq_15390133/article/details/105327213 你看一下这个链接,流程一样么? ...

给版主赞一个
回复 点赞

使用道具 举报

209

阿木币

1

精华

52 小时

在线时间

老司机

Rank: 2

发表于 2020-5-14 09:04:29
chasing 发表于 2020-5-13 18:04
https://blog.csdn.net/qq_15390133/article/details/105327213 你看一下这个链接,流程一样么? ...

带我们飞
回复 点赞

使用道具 举报

185

阿木币

3

精华

71 小时

在线时间

技术大V

Rank: 4

发表于 2020-5-14 09:51:12
论坛快变成PX4 issue区了。。。
回复 点赞

使用道具 举报

下一页 »
12下一页
返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表