Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开启风插件失败 #79

Open
LChen-99 opened this issue Apr 12, 2023 · 18 comments
Open

开启风插件失败 #79

LChen-99 opened this issue Apr 12, 2023 · 18 comments

Comments

@LChen-99
Copy link

我在indoor1.world中加入了下面这个

base_link

1 0 0
0 1 0
4.0
0 0 0
0
0
0
world_wind

然后gazebo就报错了
[INFO] [1681302260.387756, 0.000000]: Calling service /gazebo/spawn_sdf_model
[ INFO] [1681302260.393789246]: waitForService: Service [/gazebo/set_physics_properties] is now available.
gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename boost::detail::sp_member_access::type boost::shared_ptr::operator->() const [with T = gazebo::event::Connection; typename boost::detail::sp_member_access::type = gazebo::event::Connection*]: Assertion `px != 0' failed.
Service call failed: transport error completing service call: unable to receive data from sender, check sender's logs for details
[ERROR] [1681302261.614085, 0.000000]: Spawn service failed. Exiting.
Aborted (core dumped)
[gazebo-1] process has died [pid 102629, exit code 134, cmd /home/luochen/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/gzserver -e ode /home/luochen/PX4_Firmware/Tools/sitl_gazebo/worlds/indoor1.world __name:=gazebo __log:=/home/luochen/.ros/log/45318b32-d92b-11ed-bcdd-d5d4b190bca3/gazebo-1.log].
log file: /home/luochen/.ros/log/45318b32-d92b-11ed-bcdd-d5d4b190bca3/gazebo-1*.log
[iris_0/iris_0_spawn-4] process has died [pid 102657, exit code 1, cmd /home/luochen/catkin_ws/devel/lib/gazebo_ros/spawn_model -sdf -param model_description -model iris_0 -x 0 -y -4.5 -z 1 -R 0 -P 0 -Y 1.570796 __name:=iris_0_spawn __log:=/home/luochen/.ros/log/45318b32-d92b-11ed-bcdd-d5d4b190bca3/iris_0-iris_0_spawn-4.log].
log file: /home/luochen/.ros/log/45318b32-d92b-11ed-bcdd-d5d4b190bca3/iris_0-iris_0_spawn-4*.log

@LChen-99
Copy link
Author

  <frameId>base_link</frameId>
  <robotNamespace/>
  <xyzOffset>1 0 0</xyzOffset>
  <windDirectionMean>0 1 0</windDirectionMean>
  <windVelocityMean>4.0</windVelocityMean>
  <windGustDirection>0 0 0</windGustDirection>
  <windGustDuration>0</windGustDuration>
  <windGustStart>0</windGustStart>
  <windGustVelocityMean>0</windGustVelocityMean>
  <windPubTopic>world_wind</windPubTopic>

</plugin>

@LChen-99
Copy link
Author

文档说是加这个libWindPlugin.so,但是我根本没找到这个动态库

@andy-zhuo-02
Copy link
Contributor

你好,正如教程里面提及的,"libWindPlugin.so"为Gazebo9自带动态共享库,而不是PX4生成的,一般该文件就在环境变量GAZEBO_PLUGIN_PATH的路径中。

如果你想要找寻该文件,可以在根目录下搜索该文件名进行查找。以我的环境为例子,这个动态库处于/usr/lib/x86_64-linux-gnu/gazebo-11/plugins下。(注:我使用的是gazebo11,但是gazebo9是类似的,这并不影响)

@LChen-99
Copy link
Author

你好,正如教程里面提及的,"libWindPlugin.so"为Gazebo9自带动态共享库,而不是PX4生成的,一般该文件就在环境变量GAZEBO_PLUGIN_PATH的路径中。

如果你想要找寻该文件,可以在根目录下搜索该文件名进行查找。以我的环境为例子,这个动态库处于/usr/lib/x86_64-linux-gnu/gazebo-11/plugins下。(注:我使用的是gazebo11,但是gazebo9是类似的,这并不影响)

你好,我成功加入了风插件,但是好像没用产生作用。无人机飞行没有受到影响

@LChen-99
Copy link
Author

你好,正如教程里面提及的,"libWindPlugin.so"为Gazebo9自带动态共享库,而不是PX4生成的,一般该文件就在环境变量GAZEBO_PLUGIN_PATH的路径中。
如果你想要找寻该文件,可以在根目录下搜索该文件名进行查找。以我的环境为例子,这个动态库处于/usr/lib/x86_64-linux-gnu/gazebo-11/plugins下。(注:我使用的是gazebo11,但是gazebo9是类似的,这并不影响)

你好,我成功加入了风插件,但是好像没用产生作用。无人机飞行没有受到影响

也没有找到和风相关的话题

@andy-zhuo-02
Copy link
Contributor

你可以尝试在launch文件中将gazebo config下的verbose标签打开以查看更多信息。可能会有一条关于风插件的err信息提示你是否需要设置一些参数

@andy-zhuo-02
Copy link
Contributor

注意,当您修改之后,建议可以采用QGC令飞机旋停的方式来检测场景中是否有风,检测无人机旋停的姿态即可

@LChen-99
Copy link
Author

你可以尝试在launch文件中将gazebo config下的verbose标签打开以查看更多信息。可能会有一条关于风插件的err信息提示你是否需要设置一些参数

您好,我打开了verbose这是终端的信息,我并没有看到和风插件相关的
[Msg] Loading world file [/home/luochen/PX4_Firmware/Tools/sitl_gazebo/worlds/indoor1_wind.world]
[INFO] [1681738541.824912, 0.000000]: Calling service /gazebo/spawn_sdf_model
[ INFO] [1681738541.834935381]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[INFO] [1681738541.895163, 1814.801000]: Spawn status: SpawnModel: Entity pushed to spawn queue, but spawn service timed out waiting for entity to appear in simulation under the name iris_0
[ERROR] [1681738541.896206, 1814.801000]: Spawn service failed. Exiting.
[ INFO] [1681738541.901278483, 1814.805000000]: Physics dynamic reconfigure ready.
Warning [parser.cc:950] XML Element[parent], child of element[sensor] not defined in SDF. Ignoring[parent]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.
[ INFO] [1681738542.262027808, 1814.889000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1681738542.262528579, 1814.889000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1681738542.264648502, 1814.889000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[ INFO] [1681738542.264692706, 1814.889000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[ INFO] [1681738542.268829294, 1814.889000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1681738542.269032388, 1814.889000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1681738542.270164016, 1814.889000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[ INFO] [1681738542.271016486, 1814.889000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[ WARN] [1681738542.275636880, 1814.889000000]: missing , set to default: /iris_0/
[ INFO] [1681738542.275685453, 1814.889000000]: set to: /iris_0/imu_gazebo
[ INFO] [1681738542.275698889, 1814.889000000]: set to: imu_link_stereo
[ INFO] [1681738542.275731912, 1814.889000000]: set to: 500
[ INFO] [1681738542.275749855, 1814.889000000]: set to: 0
[ INFO] [1681738542.275797693, 1814.889000000]: set to: 0 0 0
[ INFO] [1681738542.275909554, 1814.889000000]: set to: 0 -0 0
[Msg] Connecting to PX4 SITL using TCP
[Msg] Lockstep is enabled
[Msg] Speed factor set to: 1
[Msg] Using MAVLink protocol v2.0
INFO [simulator] Simulator connected on TCP port 4560.
INFO [commander] LED: open /dev/led0 failed (22)
INFO [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0
INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 34580 remote port 24540
INFO [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO [logger] logger started (mode=all)
INFO [logger] Start file log (type: full)
INFO [logger] Opened full log file: ./log/2023-04-17/13_35_42.ulg
INFO [mavlink] MAVLink only on localhost (set param MAV_BROADCAST = 1 to enable network)
INFO [px4] Startup script returned successfully
[ INFO] [1681738542.597654416, 1815.057000000]: udp0: Remote address: 127.0.0.1:34580
[ INFO] [1681738542.597761863, 1815.057000000]: IMU: High resolution IMU detected!
[ INFO] [1681738542.629630230, 1815.089000000]: FCU: [logger] file:./log/2023-04-17/13_35_42.ulg
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[Wrn] [msgs.cc:1852] Conversion of sensor type[multicamera] not supported.
[iris_0/iris_0_spawn-4] process has died [pid 1048575, exit code 1, cmd /home/luochen/catkin_ws/devel/lib/gazebo_ros/spawn_model -sdf -param model_description -model iris_0 -x 0 -y -4.5 -z 1 -R 0 -P 0 -Y 1.570796 __name:=iris_0_spawn __log:=/home/luochen/.ros/log/23707e24-da8c-11ed-8d0d-395337c18d5a/iris_0-iris_0_spawn-4.log].
log file: /home/luochen/.ros/log/23707e24-da8c-11ed-8d0d-395337c18d5a/iris_0-iris_0_spawn-4*.log
INFO [mavlink] partner IP: 127.0.0.1
[ INFO] [1681738543.581725931, 1816.037000000]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1681738543.582567819, 1816.037000000]: IMU: High resolution IMU detected!
INFO [ecl/EKF] 1776000: EKF aligned, (baro height, IMU buf: 22, OBS buf: 14)
INFO [ecl/EKF] 1776000: reset position to last known position
INFO [ecl/EKF] 1776000: reset velocity to zero
[ERROR] [1681738544.387648240, 1816.841000000]: ODOM: Ex: Could not find a connection between 'iris_0/base_link' and 'base_link_frd' because they are not part of the same tree.Tf has two or more unconnected trees.
[ INFO] [1681738544.391623632, 1816.845000000]: IMU: Attitude quaternion IMU detected!
[ INFO] [1681738544.585264900, 1817.037000000]: GF: Using MISSION_ITEM_INT
[ INFO] [1681738544.585418736, 1817.037000000]: RP: Using MISSION_ITEM_INT
[ INFO] [1681738544.585465258, 1817.037000000]: WP: Using MISSION_ITEM_INT
[ INFO] [1681738544.585520138, 1817.037000000]: VER: 1.1: Capabilities 0x000000000000e4ef
[ INFO] [1681738544.585561182, 1817.037000000]: VER: 1.1: Flight software: 010b0080 (746b3124ab000000)
[ INFO] [1681738544.585589894, 1817.037000000]: VER: 1.1: Middleware software: 010b0080 (746b3124ab000000)
[ INFO] [1681738544.585618304, 1817.037000000]: VER: 1.1: OS software: 050f00ff (ec417d7466666801)
[ INFO] [1681738544.585652132, 1817.037000000]: VER: 1.1: Board hardware: 00000001
[ INFO] [1681738544.585676769, 1817.037000000]: VER: 1.1: VID/PID: 0000:0000
[ INFO] [1681738544.585701997, 1817.037000000]: VER: 1.1: UID: 4954414c44494e4f
[ WARN] [1681738544.588032038, 1817.041000000]: CMD: Unexpected command 520, result 0

@andy-zhuo-02
Copy link
Contributor

你可能弄混了一点:风速信息是以gazebo内部的topic类型发布的,而非ROS的消息发布,用rostopic是无法找到的。

首先,你可以通过(比如)在QGC中令无人机起飞并旋停,通过观察无人机的旋停姿态来确认当前场景内部有没有风;
其次,你可以通过在命令行中输入gz topic --list来查看发布的风速信息话题。

@LChen-99
Copy link
Author

你可能弄混了一点:风速信息是以gazebo内部的topic类型发布的,而非ROS的消息发布,用rostopic是无法找到的。

首先,你可以通过(比如)在QGC中令无人机起飞并旋停,通过观察无人机的旋停姿态来确认当前场景内部有没有风; 其次,你可以通过在命令行中输入gz topic --list来查看发布的风速信息话题。

您好,这是悬停时候的姿态,应该是没有风的。
orientation:
x: -3.9238795157346366e-05
y: -5.5042287043711194e-05
z: 0.7072721693686018
w: 0.7069413510803392
下面是gz topic --list: /gazebo/default/wind只有这个跟风有关,但是这个话题是没有信息的

/gazebo/default/atmosphere
/gazebo/default/cinder_block_wide/link/wrench
/gazebo/default/coke_can/link/wrench
/gazebo/default/diagnostics
/gazebo/default/factory
/gazebo/default/factory/light
/gazebo/default/grey_tote/link/wrench
/gazebo/default/gui
/gazebo/default/gzclient_camera/cmd
/gazebo/default/iris_0/baro
/gazebo/default/iris_0/base_link/wrench
/gazebo/default/iris_0/camera/link/irlock
/gazebo/default/iris_0/gazebo/command/motor_speed
/gazebo/default/iris_0/gps
/gazebo/default/iris_0/groundtruth
/gazebo/default/iris_0/imu
/gazebo/default/iris_0/imu_gazebo/link/imu_sensor/imu
/gazebo/default/iris_0/imu_gazebo/link/wrench
/gazebo/default/iris_0/imu_link/wrench
/gazebo/default/iris_0/joint_cmd
/gazebo/default/iris_0/mag
/gazebo/default/iris_0/px4flow/link/opticalFlow
/gazebo/default/iris_0/rotor_0/wrench
/gazebo/default/iris_0/rotor_1/wrench
/gazebo/default/iris_0/rotor_2/wrench
/gazebo/default/iris_0/rotor_3/wrench
/gazebo/default/iris_0/stereo_camera/link/camera/images
/gazebo/default/iris_0/stereo_camera/link/wrench
/gazebo/default/iris_0/stereo_camera_down/link/camera/images
/gazebo/default/iris_0/stereo_camera_down/link/wrench
/gazebo/default/iris_0/vision_odom
/gazebo/default/iris_0::imu_gazebo::link
/gazebo/default/joint
/gazebo/default/left/cmd
/gazebo/default/light/modify
/gazebo/default/log/control
/gazebo/default/log/status
/gazebo/default/model/info
/gazebo/default/model/modify
/gazebo/default/physics
/gazebo/default/physics/contacts
/gazebo/default/playback_control
/gazebo/default/pose/info
/gazebo/default/pose/local/info
/gazebo/default/pose/modify
/gazebo/default/request
/gazebo/default/response
/gazebo/default/right/cmd
/gazebo/default/roads
/gazebo/default/scene
/gazebo/default/selection
/gazebo/default/sensor
/gazebo/default/skeleton_pose/info
/gazebo/default/sky
/gazebo/default/undo_redo
/gazebo/default/user_camera/joy_pose
/gazebo/default/user_camera/joy_twist
/gazebo/default/user_camera/pose
/gazebo/default/user_cmd
/gazebo/default/user_cmd_stats
/gazebo/default/visual
/gazebo/default/wind
/gazebo/default/world_control
/gazebo/default/world_stats
/gazebo/motor_failure_num
/gazebo/performance_metrics
/gazebo/server/control
/gazebo/world/modify

然后这是我的world文件的前面部分,·我还是没找到哪里出了问题:

<plugin name='wind_plugin' filename='libWindPlugin.so'>
  <frameId>base_link</frameId>
  <robotNamespace/>
  <xyzOffset>0 1 0</xyzOffset>
  <!-- wind -->
  <windDirectionMean>1 1 0</windDirectionMean>
  <windDirectionVariance>0.1 0.1 0</windDirectionVariance>
  <windVelocityMean>5</windVelocityMean>
  <windVelocityMax>8</windVelocityMax>
  <windVelocityVariance>1</windVelocityVariance>
  <!--”wind gust“  optional config-->
  <windGustDuration>1</windGustDuration>
  <windGustStart>1</windGustStart>
  <windGustDirectionMean>0.2 0.2 0</windGustDirectionMean>
  <windGustDirectionVariance>0.2 0.2 0</windGustDirectionVariance>
  <windGustVeloctiyMean>2</windGustVeloctiyMean>
  <windGustVelocityMax>2.5</windGustVelocityMax>
  <windGustVelocityVariance>0.5</windGustVelocityVariance>

  <!--topic-->
  <windPubTopic>world_wind</windPubTopic>
</plugin> 

@andy-zhuo-02
Copy link
Contributor

请问你的PX4用的是什么版本?

@LChen-99
Copy link
Author

您好,是1.11版本的
746b3124ab (HEAD -> xtdrone/dev, tag: v1.11.0-beta1) HEAD@{0}: checkout: moving from master to xtdrone/dev

@andy-zhuo-02
Copy link
Contributor

直接使用windy.world也是没有风的状态吗

@LChen-99
Copy link
Author

直接使用windy.world也是没有风的状态吗

我的电脑上没有找到windy.world这个文件
不知道是怎么回事,这个文件是在哪里

@andy-zhuo-02
Copy link
Contributor

默认环境下,世界文件都应该处于路径 ~/PX4_Firmware/Tools/sitl_gazebo/worlds 下。你在进行launch文件的配置时,应该修改其中的world参数为你所需要的世界

@wangqing-W
Copy link

你可能弄混了一点:风速信息是以gazebo内部的topic类型发布的,而非ROS的消息发布,用rostopic是无法找到的。

首先,你可以通过(比如)在QGC中令无人机起飞并旋停,通过观察无人机的旋停姿态来确认当前场景内部有没有风; 其次,你可以通过在命令行中输入gz topic --list来查看发布的风速信息话题。

你好,我的环境是PX4v1.13.2 ,gazebo9。我是在indoor1.launch中将原来的word换成了windy.world,libgazebo_wind_plugin.so也在。但是rostopic list没有出现教程中的描述的/wind_xtdrone话题,运行gz topic --list有/gazebo/default/wind和/gazebo/default/world_wind这两个话题,但是gz topic好像没有发消息的功能。

@wangqing-W
Copy link

你可能弄混了一点:风速信息是以gazebo内部的topic类型发布的,而非ROS的消息发布,用rostopic是无法找到的。
首先,你可以通过(比如)在QGC中令无人机起飞并旋停,通过观察无人机的旋停姿态来确认当前场景内部有没有风; 其次,你可以通过在命令行中输入gz topic --list来查看发布的风速信息话题。

你好,我的环境是PX4v1.13.2 ,gazebo9。我是在indoor1.launch中将原来的word换成了windy.world,libgazebo_wind_plugin.so也在。但是rostopic list没有出现教程中的描述的/wind_xtdrone话题,运行gz topic --list有/gazebo/default/wind和/gazebo/default/world_wind这两个话题,但是gz topic好像没有发消息的功能。

我更改了windy.world里的参数发现风的插件是在起作用,没有/wind_xtdrone的原因可能是:[Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_wind_plugin_xtdrone.so: libgazebo_ros_wind_plugin_xtdrone.so: cannot open shared object file: No such file or directory
我发现我的整个目录里没有libgazebo_ros_wind_plugin_xtdrone.so这个文件,但是libgazebo_wind_plugin.so是有的。

@wangqing-W
Copy link

你可能弄混了一点:风速信息是以gazebo内部的topic类型发布的,而非ROS的消息发布,用rostopic是无法找到的。
首先,你可以通过(比如)在QGC中令无人机起飞并旋停,通过观察无人机的旋停姿态来确认当前场景内部有没有风; 其次,你可以通过在命令行中输入gz topic --list来查看发布的风速信息话题。

你好,我的环境是PX4v1.13.2 ,gazebo9。我是在indoor1.launch中将原来的word换成了windy.world,libgazebo_wind_plugin.so也在。但是rostopic list没有出现教程中的描述的/wind_xtdrone话题,运行gz topic --list有/gazebo/default/wind和/gazebo/default/world_wind这两个话题,但是gz topic好像没有发消息的功能。

我更改了windy.world里的参数发现风的插件是在起作用,没有/wind_xtdrone的原因可能是:[Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros_wind_plugin_xtdrone.so: libgazebo_ros_wind_plugin_xtdrone.so: cannot open shared object file: No such file or directory 我发现我的整个目录里没有libgazebo_ros_wind_plugin_xtdrone.so这个文件,但是libgazebo_wind_plugin.so是有的。

“# If BUILD_ROS_PLUGINS set to ON, build plugins that have ROS dependencies

Current plugins that can be used with ROS interface: gazebo_motor_failure_plugin, gazebo_ros_wind_plugin_xtdrone

if (BUILD_ROS_PLUGINS)
add_library(gazebo_motor_failure_plugin SHARED src/gazebo_motor_failure_plugin.cpp)
target_link_libraries(gazebo_motor_failure_plugin ${GAZEBO_libraries} ${roscpp_LIBRARIES})
list(APPEND plugins gazebo_motor_failure_plugin)
message(STATUS "adding gazebo_motor_failure_plugin to build")

include_directories(
include
${geometry_msgs_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
)

target_link_libraries(gazebo_motor_failure_plugin
${catkin_LIBRARIES}
${roscpp_LIBRARIES}
${GAZEBO_libraries}
)

# add_library(gazebo_ros_wind_plugin_xtdrone SHARED src/gazebo_ros_wind_plugin_xtdrone.cpp)
# target_link_libraries(gazebo_ros_wind_plugin_xtdrone ${GAZEBO_libraries} ${roscpp_LIBRARIES})
# list(APPEND plugins gazebo_ros_wind_plugin_xtdrone)
# message(STATUS "adding gazebo_ros_wind_plugin_xtdrone to build")

# include_directories(

include

${std_msgs_INCLUDE_DIRS}

${geometry_msgs_INCLUDE_DIRS}

)

target_link_libraries(gazebo_ros_wind_plugin_xtdrone

${catkin_LIBRARIES}

${roscpp_LIBRARIES}

${GAZEBO_libraries}

)

endif()
”CmakeList中的这段代码有一点问题,我的BUILD_ROS_PLUGINS标志位一直是开着的“option(BUILD_ROS_PLUGINS "Enable building ROS dependent plugins" ON)”,但是它貌似没有进入这个if,我把它提到外面就生效了,最后插件放到indoor1.launch可以生效。
08
可以看到rostopic list 有/wind_xtdrone出现,然后就可以用rostopic pub /wind_xtdrone geometry_msgs/Twist "linear:
x: 7.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
发现是有效的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants