报错提示:
started roslaunch server http://ubuntu:42099/
SUMMARY
========
PARAMETERS
* /gazebo/enable_ros_network: True
* /rosdistro: melodic
* /rosversion: 1.14.12
* /use_sim_time: True
NODES
/
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
sitl (px4/px4)
vehicle_spawn_ubuntu_9995_6339083240464183785 (gazebo_ros/spawn_model)
auto-starting new master
process[master]: started with pid [10005]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 0022be8a-2298-11ec-9464-7c67a2c3da57
process[rosout-1]: started with pid [10016]
started core service [/rosout]
process[sitl-2]: started with pid [10023]
INFO [px4] Creating symlink /home/horton/PX4_Toolchain/PX4-v11/ROMFS/px4fmu_common -> /home/horton/.ros/etc
______ __ __ ___
| ___ \ \ \ / / / |
| |_/ / \ V / / /| |
| __/ / \ / /_| |
| | / /^\ \ \___ |
\_| \/ \/ |_/
px4 starting.
INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
process[gazebo-3]: started with pid [10037]
INFO [param] selected parameter default file eeprom/parameters_10016
[param] parameter file not found, creating eeprom/parameters_10016
process[gazebo_gui-4]: started with pid [10050]
SYS_AUTOCONFIG: curr: 0 -> new: 1
process[vehicle_spawn_ubuntu_9995_6339083240464183785-5]: started with pid [10063]
* SYS_AUTOSTART: curr: 0 -> new: 10016
BAT_N_CELLS: curr: 0 -> new: 4
CAL_ACC0_ID: curr: 0 -> new: 1311244
CAL_ACC_PRIME: curr: 0 -> new: 1311244
CAL_GYRO0_ID: curr: 0 -> new: 1311244
CAL_GYRO_PRIME: curr: 0 -> new: 1311244
CAL_MAG0_ID: curr: 0 -> new: 197388
CAL_MAG_PRIME: curr: 0 -> new: 197388
CBRK_SUPPLY_CHK: curr: 0 -> new: 894281
COM_RC_IN_MODE: curr: 0 -> new: 1
EKF2_ANGERR_INIT: curr: 0.1000 -> new: 0.0100
EKF2_GBIAS_INIT: curr: 0.1000 -> new: 0.0100
COM_ARM_EKF_AB: curr: 0.0022 -> new: 0.0050
EKF2_REQ_GPS_H: curr: 10.0000 -> new: 0.5000
MC_PITCH_P: curr: 6.5000 -> new: 6.0000
MC_PITCHRATE_P: curr: 0.1500 -> new: 0.2000
MC_ROLL_P: curr: 6.5000 -> new: 6.0000
MC_ROLLRATE_P: curr: 0.1500 -> new: 0.2000
MPC_Z_VEL_P_ACC: curr: 4.0000 -> new: 12.0000
MPC_Z_VEL_I_ACC: curr: 2.0000 -> new: 3.0000
MPC_XY_P: curr: 0.9500 -> new: 0.8000
MPC_XY_VEL_P_ACC: curr: 1.8000 -> new: 4.0000
MPC_XY_VEL_D_ACC: curr: 0.2000 -> new: 0.3200
RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000
SDLOG_MODE: curr: 0 -> new: 1
SDLOG_PROFILE: curr: 1 -> new: 131
SDLOG_DIRS_MAX: curr: 0 -> new: 7
SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
TRIG_INTERFACE: curr: 4 -> new: 3
COM_CPU_MAX: curr: 90.0000 -> new: -1.0000
IMU_INTEG_RATE: curr: 200 -> new: 250
NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000
RTL_DESCEND_ALT: curr: 30.0000 -> new: 10.0000
RTL_LAND_DELAY: curr: -1.0000 -> new: 0.0000
PWM_MAX: curr: 2000 -> new: 1950
PWM_MIN: curr: 1000 -> new: 1075
GPS_UBX_DYNMODEL: curr: 7 -> new: 6
* SYS_AUTOCONFIG: curr: 1 -> new: 0
INFO [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO [simulator] Waiting for simulator to accept connection on TCP port 4560
[ INFO] [1633079678.306839823]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1633079678.308193052]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1633079678.354510137]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1633079678.355860205]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
[INFO] [1633079678.708472, 0.000000]: Loading model XML from file /home/horton/PX4_Toolchain/PX4-v11/Tools/sitl_gazebo/models/iris/iris.sdf
[INFO] [1633079678.714672, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[ INFO] [1633079679.201913424, 0.012000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1633079679.248229797, 0.056000000]: Physics dynamic reconfigure ready.
[INFO] [1633079679.323309, 0.128000]: Calling service /gazebo/spawn_sdf_model
[INFO] [1633079679.460130, 0.172000]: Spawn status: SpawnModel: Successfully spawned entity
[vehicle_spawn_ubuntu_9995_6339083240464183785-5] process has finished cleanly
log file: /home/horton/.ros/log/0022be8a-2298-11ec-9464-7c67a2c3da57/vehicle_spawn_ubuntu_9995_6339083240464183785-5*.log
这里的 parameter file not found应该是正常情况,他会自己解决,问题大概率在环境变量没有写好,需要检查路径
source ~/catkin_ws/devel/setup.bash # (optional)
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
这里的 $(pwd) 应该是firmware的根目录
可以分析一下setup.bash的代码,
if [ "$#" != 2 ]; then
echo -e "usage: source setup_gazebo.bash src_dir build_dir\n"
return 1
fi
SRC_DIR=$1
BUILD_DIR=$2
# setup Gazebo env and update package path
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:${BUILD_DIR}/build_gazebo
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${SRC_DIR}/Tools/sitl_gazebo/models
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_DIR}/build_gazebo
echo -e "GAZEBO_PLUGIN_PATH $GAZEBO_PLUGIN_PATH"
echo -e "GAZEBO_MODEL_PATH $GAZEBO_MODEL_PATH"
echo -e "LD_LIBRARY_PATH $LD_LIBRARY_PATH"
其中$1 和 $2 是bash命令后的两个参数作为变量被写入gazebo的环境变量方便调用,如果没有两个变量的话会返回提示,如果满足会返回完整的环境变量地址