본문 바로가기
  • 경제적 자유를 얻는 그날까지
엔지니어링/드론

[PX4 개발자] ROS 설치 및 SITL

by 베니스상인 2019. 7. 11.

지난번 포스팅에 px4_sitl_default을 컴파일해보았다. 이 타겟을 이용하면  하드웨어가 없더라도 펌웨어만으로 SITL(Software In-the Loop)을 구현할 수가 있다.

 

SITL이란 순수 소프트웨어로 하드웨어의 기능을 구현하여 하드웨어 없이 시험이 가능한 기능 검증의 방법이다.

px4의 SITL 환경은 자바 기반의 jVAM과 ROS 기반의 gazebo를 이용하는 방법이 있다. 여기서는 ROS의 gazebo를 이용한 방법으로 SITL을 구축하고자 한다.

 

따라서 gazebo를 사용하기 위해서는 먼저 ROS를 설치해야 한다.

ROS는 우분투의 환경과 매칭되는 버전을 사용해야 하는데 우분투 16.04는 Kinetic 버전과 호환된다. 

따라서 ROS는 Kinetic 버전으로 설치한다.

 

ROS Kineteic에 대한 설명은 아래 사이트를 참고한다.

http://wiki.ros.org/kinetic

 

kinetic - ROS Wiki

ROS Kinetic Kame ROS Kinetic Kame is the tenth ROS distribution release. It was released May 23rd, 2016. Platforms ROS Kinetic Kame is primarily targeted at the Ubuntu 16.04 (Xenial) release, though other Linux systems as well as Mac OS X, Android, and Win

wiki.ros.org

 

1) NTP (Network Time Protocol) 설정

서로 다른 PC간의 통신에서 ROS Time 의 오차를 줄이기 위하여 NTP 설정한다.

chrony를 설치한후  ntpdate 라는 명렁어로 ntp 서버를 지정하면 된다.

서버측과의 현재 컴퓨터 시간 오차를 표시해주며, 서버 시간에 맞추게 된다.

$ sudo apt-get install chrony
$ sudo ntpdate ntp.ubuntu.com

11 Jul 02:19:02 ntpdate[14001]: adjust time server 91.189.91.157 offset 0.007248 sec

 

2) 소스 리스트 추가

- "sources.list"에 ROS 저장소 주소를 추가한다.

- 새로운 터미널 창을 열고 아래와 같이 입력한다. 

 

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'

 

3) 키 설정

: ROS 저장소로부터 패키지를 다운로드 받기위해 공개키를 추가한다.

 

$ wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

--2019-07-11 02:22:32--  https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.228.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1167 (1.1K) [application/octet-stream]
Saving to: ‘STDOUT’

-                   100%[===================>]   1.14K  --.-KB/s    in 0s      

2019-07-11 02:22:33 (68.0 MB/s) - written to stdout [1167/1167]

OK

 

4) 패키지 인덱스 업데이트

소스 리스트에 ROS 저장소 주소를 넣었으니 패키지 리스트를업데이트한다.

설치상에 필수 사항은 아니지만 ROS설치전에 현재 설치된 우분투 관련 모든 패키지를 판올림 하기를 추천한다.

$ sudo apt-get update

$ sudo apt-get upgrade

 

5) ROS Kinetic  설치

데스크탑용은 용량에 제한을 거의 안받기때문에 필요한 패키지들을 포함한 데스크탑 버전을 설치한다.

 

$ sudo apt-get install ros-kinetic-desktop-full

 

6) rosdep 초기화

ros를 사용하기전에 rosdep 를 초기화 해주어야만 한다.다

rosdep 는 ros의 핵심 컴포넌트 들을 사용하거나 컴파일 할때 의존성 패키지를 쉽게 설치하여 사용자 편의성을 높인 기능이다.

필요한 환경 변수들을 적용한다. ROS_ROOT, ROS_PACKAGE_PATH 등의 환경 변수들이 정의되어 있다.

$ sudo rosdep init

$ rosdep update

$ source /opt/ros/kinetic/setup.bash

 

7) rosinstall 설치

ros의 다양한 패키지를 인스톨하는 프로그램

$ sudo apt-get install python-rosinstall

 

8) MAVLink 설치

ROS와 Mavlink를 연동할 수 있는 패키지 설치

$ sudo apt-get install ros-kinetic-mav*

 

9) catkin 작업폴더 생성 및 초기화

$ mkdir -p ~/catkin_ws/src

$ cd ~/catkin_ws/src

~/catkin_ws/src $ catkin_init_workspace

 

10) 환경 설정

gedit로 bashrc파일을 수정한다. 배치파일 실행, 네스워크 설정, 단축명령어 등이 설정되어 있다.

MASTER_URI 에 자신의 아이피를 입력한다.

$ gedit ~/.bashrc

# Set ROS kinetic
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash

 

# Set ROS Network
export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=localhost

 

# set ROS alias command
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'

 

 

11) roscore 실행

아래와 같이 정상적으로 실행이 되는 확인한다.

$ roscore

... logging to /home/swift/.ros/log/09dd2f20-a33b-11e9-ab22-606c6681e719/roslaunch-swift-HP-Pavilion-dv6-Notebook-PC-14368.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://localhost:42961/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

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

setting /run_id to 09dd2f20-a33b-11e9-ab22-606c6681e719
process[rosout-1]: started with pid [14393]
started core service [/rosout]

 

ROS 설치에 대한 상세한 사항은 아래 사이트를 확인하기 바란다. Indigo 버전이지만 접근 방법은 동일하다.

https://cafe.naver.com/openrt/5413

 

 

로봇 운영체제 강좌 : ROS Ind...

Created Date: 2014.06.25 Modified Date: 2015.03.23...

cafe.naver.com

 

 

위 과정이 귀찮다 싶으면 아래와 같이 명령 한줄로 지금까지의 설치를 완료할 수 있으니 참고로 알아둘 것

$ wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/kinetic/ros_install.sh && chmod 755 ./ros_install.sh && bash ./ros_install.sh catkin_ws kinetic

 

ROS 설치가 완료되었으면 gazebo 환경에서 SITL이 동작되는지 확인해보자.

 

12) SITL 타겟 빌드

px4_sitl_default를 gazebo 키워드를 넣어서 빌드한다.

빌드가 성공적으로 끝나면 아래와 같은 메시지와 함께 gazebo가 실행될 것이다.

$ make px4_sitl_default gazebo

[  0%] Built target lockstep_scheduler
[  0%] Built target mixer_gen
[  2%] Built target df_driver_framework
[  2%] Built target uorb_headers
[  2%] Built target mixer_gen_6dof
[  2%] Built target ver_gen
[  2%] Built target drivers_board
[  2%] Built target git_gps_devices
[  3%] Built target git_mavlink_v2
[  4%] Built target git_ecl
Scanning dependencies of target git_gazebo
[  4%] Generating ../../logs
[  4%] git submodule Tools/sitl_gazebo
[  4%] Built target logs_symlink
[  4%] Built target perf
[  4%] Built target tinybson
[  7%] Built target work_queue
[  7%] Built target git_gazebo
[  7%] Built target ecl_airdata
[  8%] Built target ecl_attitude_fw
[ 24%] Built target uorb_msgs
[ 24%] Built target ecl_geo
[ 24%] Built target ecl_geo_lookup
[ 24%] Built target ecl_tecs
[ 24%] Built target ecl_validation
[ 25%] Built target mixer
[ 25%] Built target version
Scanning dependencies of target sitl_gazebo
[ 26%] Built target rc
[ 26%] Built target generate_topic_listener
[ 26%] Creating directories for 'sitl_gazebo'
[ 27%] Built target ecl_l1
[ 27%] Built target parameters
[ 28%] Built target px4_layer
[ 29%] Built target px4_daemon
[ 29%] No download step for 'sitl_gazebo'
[ 30%] Built target modules__uORB
[ 30%] No update step for 'sitl_gazebo'
[ 31%] No patch step for 'sitl_gazebo'
[ 32%] Built target px4_work_queue
[ 32%] No forceconfigure step for 'sitl_gazebo'
[ 32%] Performing configure step for 'sitl_gazebo'
[ 34%] Built target px4_platform
-- install-prefix: /usr/local
[ 35%] Built target systemlib
[ 36%] Built target cdev
-- The C compiler identification is GNU 5.4.0
[ 36%] Built target battery
[ 36%] Built target lib__cdev__test__cdev_test
[ 37%] Built target airspeed
[ 37%] Built target circuit_breaker
[ 37%] Built target CollisionPrevention
[ 39%] Built target controllib
[ 40%] Built target lib__controllib__controllib_test
[ 40%] Built target conversion
[ 41%] Built target drivers__device
[ 42%] Built target drivers_barometer
[ 43%] Built target drivers_magnetometer
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
[ 44%] Built target mathlib
[ 44%] Built target FlightTask
[ 44%] Built target hysteresis
[ 44%] Built target landing_slope
[ 44%] Built target pid
[ 45%] Built target pwm_limit
[ 45%] Built target lib__rc__rc_tests
[ 46%] Built target terrain_estimation
[ 47%] Built target tunes
[ 47%] Built target WeatherVane
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
[ 48%] Built target lib__work_queue__test__wqueue_test
[ 49%] Built target modules__uORB__uORB_tests
[ 50%] Built target drivers__camera_trigger
[ 50%] Built target drivers__pwm_out_sim
[ 51%] Built target drivers__gps
[ 51%] Built target tone_alarm_interface
[ 51%] Built target modules__attitude_estimator_q
[ 51%] Built target modules__camera_feedback
[ 51%] Built target failure_detector
-- Detecting C compiler ABI info - done
[ 52%] Built target modules__commander__commander_tests
-- Detecting C compile features
[ 52%] Built target modules__dataman
[ 54%] Built target modules__events
[ 54%] Built target modules__fw_att_control
[ 55%] Built target launchdetection
[ 55%] Built target runway_takeoff
[ 56%] Built target modules__gnd_att_control
[ 56%] Built target modules__gnd_pos_control
[ 57%] Built target modules__land_detector
[ 57%] Built target modules__landing_target_estimator
[ 58%] Built target modules__load_mon
[ 59%] Built target modules__logger
[ 60%] Built target modules__local_position_estimator
[ 60%] Built target AttitudeControl
[ 61%] Built target modules__mavlink__mavlink_tests
[ 61%] Built target Takeoff
[ 64%] Built target modules__mavlink
[ 65%] Built target modules__replay
[ 65%] Built target modules__sensors
[ 69%] Built target modules__navigator
[ 70%] Built target drivers__vmount
[ 71%] Built target modules__vtol_att_control
[ 71%] Built target modules__wind_estimator
[ 71%] Built target systemcmds__dyn
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
[ 72%] Built target systemcmds__esc_calib
[ 72%] Built target systemcmds__led_control
[ 72%] Built target systemcmds__mixer
[ 73%] Built target systemcmds__motor_ramp
[ 73%] Built target systemcmds__param
[ 73%] Built target systemcmds__perf
[ 73%] Built target systemcmds__pwm
[ 74%] Built target systemcmds__reboot
[ 74%] Built target systemcmds__sd_bench
[ 74%] Built target systemcmds__shutdown
[ 75%] Built target systemcmds__tests__hrt_test
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
[ 81%] Built target systemcmds__tests
[ 81%] Built target systemcmds__top
[ 82%] Built target systemcmds__topic_listener
[ 82%] Built target systemcmds__ver
[ 82%] Built target systemcmds__tune_control
[ 83%] Built target modules__bottle_drop
[ 83%] Built target examples__hello
[ 83%] Built target examples__fixedwing_control
[ 83%] Built target modules__position_estimator_inav
[ 84%] Built target examples__px4_mavlink_debug
[ 84%] Built target examples__px4_simple_app
-- Detecting CXX compiler ABI info - done
[ 84%] Built target examples__rover_steering_control
-- Detecting CXX compile features
[ 85%] Built target examples__segway
[ 85%] Built target drivers_accelerometer
[ 85%] Built target drivers_gyroscope
[ 86%] Built target drivers__led
[ 88%] Built target ecl_EKF
[ 89%] Built target FlightTaskUtility
[ 90%] Built target FlightTaskManual
[ 91%] Built target FlightTaskOffboard
[ 91%] Built target FlightTaskFailsafe
[ 91%] Built target FlightTaskTransition
[ 92%] Built target drivers__tone_alarm
[ 92%] Built target modules__ekf2
[ 94%] Built target modules__commander
[ 94%] Built target modules__fw_pos_control_l1
[ 94%] Built target modules__mc_att_control
[ 94%] Built target drivers__ledsim
[ 95%] Built target FlightTaskAuto
[ 95%] Built target FlightTaskManualAltitude
[ 95%] Built target FlightTaskAutoMapper
[ 96%] Built target modules__simulator
[ 96%] Built target FlightTaskAutoMapper2
[ 96%] Built target FlightTaskManualAltitudeSmooth
[ 97%] Built target FlightTaskManualAltitudeSmoothVel
[ 97%] Built target FlightTaskManualPosition
[ 97%] Built target FlightTaskAutoLine
[ 98%] Built target FlightTaskAutoLineSmoothVel
[ 98%] Built target FlightTaskAutoFollowMe
[ 98%] Built target FlightTaskOrbit
[ 98%] Built target drivers__gpssim
[ 98%] Built target FlightTaskManualPositionSmooth
[ 98%] Built target FlightTaskManualPositionSmoothVel
[100%] Built target FlightTasks
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX17
[100%] Built target modules__mc_pos_control
[100%] Built target px4
-- Performing Test COMPILER_SUPPORTS_CXX17 - Success
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Using C++14 compiler
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
--   chrono
--   date_time
--   atomic
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so  
-- Boost version: 1.58.0
-- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'OGRE'
--   Found OGRE, version 1.9.0
-- Found Ogre Ghadamon (1.9.0)
-- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1") 
-- Found TinyXML: /usr/lib/x86_64-linux-gnu/libtinyxml.so  
-- Checking for module 'OGRE'
--   Found OGRE, version 1.9.0
-- Building klt_feature_tracker without catkin
-- Building OpticalFlow with OpenCV
-- Found MAVLink: /home/swift/catkin_ws/src/Firmware/mavlink/include (found version "2.0") 
-- catkin DISABLED
-- Checking for module 'protobuf'
--   Found protobuf, version 2.6.1
Gazebo version: 7.0

-- Configuring done
-- Generating done
-- Build files have been written to: /home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo
[100%] Performing build step for 'sitl_gazebo'
[  3%] Running C++ protocol buffer compiler on msgs/Int32.proto
[  3%] Running C++ protocol buffer compiler on msgs/MotorSpeed.proto
[  3%] Running C++ protocol buffer compiler on msgs/Wind.proto
[  4%] Running C++ protocol buffer compiler on msgs/Pressure.proto
[  5%] Running C++ protocol buffer compiler on msgs/Imu.proto
[  6%] Running C++ protocol buffer compiler on msgs/CommandMotorSpeed.proto
Scanning dependencies of target physics_msgs
Scanning dependencies of target std_msgs
[  8%] Running C++ protocol buffer compiler on msgs/IRLock.proto
[  9%] Running C++ protocol buffer compiler on msgs/Float.proto
[ 10%] Building CXX object CMakeFiles/physics_msgs.dir/Wind.pb.cc.o
[ 11%] Building CXX object CMakeFiles/std_msgs.dir/Int32.pb.cc.o
Scanning dependencies of target mav_msgs
[ 12%] Running C++ protocol buffer compiler on msgs/Groundtruth.proto
[ 13%] Building CXX object CMakeFiles/mav_msgs.dir/CommandMotorSpeed.pb.cc.o
[ 15%] Running C++ protocol buffer compiler on msgs/Range.proto
[ 16%] Running C++ protocol buffer compiler on msgs/SITLGps.proto
[ 17%] Running C++ protocol buffer compiler on msgs/OpticalFlow.proto
[ 18%] Running C++ protocol buffer compiler on msgs/MagneticField.proto
Scanning dependencies of target sensor_msgs
[ 19%] Building CXX object CMakeFiles/sensor_msgs.dir/Imu.pb.cc.o
[ 20%] Linking CXX shared library libstd_msgs.so
[ 22%] Building CXX object CMakeFiles/mav_msgs.dir/MotorSpeed.pb.cc.o
[ 23%] Linking CXX shared library libphysics_msgs.so
[ 23%] Built target std_msgs
[ 24%] Running C++ protocol buffer compiler on msgs/Odometry.proto
Scanning dependencies of target nav_msgs
[ 25%] Building CXX object CMakeFiles/nav_msgs.dir/Odometry.pb.cc.o
[ 26%] Building CXX object CMakeFiles/sensor_msgs.dir/IRLock.pb.cc.o
[ 26%] Built target physics_msgs
Scanning dependencies of target models_gen
[ 27%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf
[ 29%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/c920/c920.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf
[ 30%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf
[ 31%] Linking CXX shared library libmav_msgs.so
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf
[ 32%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf
[ 33%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf
[ 33%] Built target mav_msgs
Scanning dependencies of target sdf
[ 34%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
[ 36%] Building CXX object CMakeFiles/sensor_msgs.dir/Float.pb.cc.o
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf
[ 37%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf
[ 38%] Linking CXX shared library libnav_msgs.so
[ 39%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf

/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/r200/r200.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf
[ 40%] Generating /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf
/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a.sdf.jinja -> /home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf
[ 40%] Built target models_gen
[ 41%] Building CXX object CMakeFiles/sensor_msgs.dir/Groundtruth.pb.cc.o
[ 41%] Built target nav_msgs
[ 43%] Building CXX object CMakeFiles/sensor_msgs.dir/Range.pb.cc.o
[ 43%] Built target sdf
Scanning dependencies of target klt_feature_tracker
[ 44%] Building CXX object OpticalFlow/klt_feature_tracker/CMakeFiles/klt_feature_tracker.dir/src/trackFeatures.cpp.o
[ 45%] Building CXX object CMakeFiles/sensor_msgs.dir/SITLGps.pb.cc.o
[ 46%] Building CXX object CMakeFiles/sensor_msgs.dir/OpticalFlow.pb.cc.o
[ 47%] Building CXX object CMakeFiles/sensor_msgs.dir/MagneticField.pb.cc.o
[ 48%] Building CXX object CMakeFiles/sensor_msgs.dir/Pressure.pb.cc.o
[ 50%] Linking CXX shared library libsensor_msgs.so
[ 51%] Linking CXX static library libklt_feature_tracker.a
[ 51%] Built target klt_feature_tracker
Scanning dependencies of target OpticalFlow
[ 53%] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/px4flow.cpp.o
[ 53%] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/optical_flow.cpp.o
[ 54%] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/flow_px4.cpp.o
[ 55%] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/flow_opencv.cpp.o
[ 55%] Built target sensor_msgs
Scanning dependencies of target LiftDragPlugin
Scanning dependencies of target gazebo_barometer_plugin
Scanning dependencies of target gazebo_geotagged_images_plugin
[ 56%] Building CXX object CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o
[ 58%] Building CXX object CMakeFiles/gazebo_barometer_plugin.dir/src/gazebo_barometer_plugin.cpp.o
[ 59%] Building CXX object CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o
[ 60%] Linking CXX shared library libOpticalFlow.so
[ 60%] Built target OpticalFlow
Scanning dependencies of target gazebo_magnetometer_plugin
[ 61%] Building CXX object CMakeFiles/gazebo_magnetometer_plugin.dir/src/gazebo_magnetometer_plugin.cpp.o
[ 62%] Linking CXX shared library libLiftDragPlugin.so
[ 63%] Linking CXX shared library libgazebo_barometer_plugin.so
[ 63%] Built target LiftDragPlugin
Scanning dependencies of target gazebo_irlock_plugin
[ 65%] Building CXX object CMakeFiles/gazebo_irlock_plugin.dir/src/gazebo_irlock_plugin.cpp.o
[ 65%] Built target gazebo_barometer_plugin
Scanning dependencies of target gazebo_controller_interface
[ 66%] Building CXX object CMakeFiles/gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o
[ 67%] Building CXX object CMakeFiles/gazebo_magnetometer_plugin.dir/src/geo_mag_declination.cpp.o
[ 68%] Linking CXX shared library libgazebo_magnetometer_plugin.so
[ 69%] Linking CXX shared library libgazebo_controller_interface.so
[ 69%] Built target gazebo_magnetometer_plugin
Scanning dependencies of target gazebo_wind_plugin
[ 70%] Building CXX object CMakeFiles/gazebo_wind_plugin.dir/src/gazebo_wind_plugin.cpp.o
[ 72%] Linking CXX shared library libgazebo_irlock_plugin.so
[ 72%] Built target gazebo_controller_interface
Scanning dependencies of target gazebo_gps_plugin
[ 73%] Building CXX object CMakeFiles/gazebo_gps_plugin.dir/src/gazebo_gps_plugin.cpp.o
[ 73%] Built target gazebo_irlock_plugin
Scanning dependencies of target gazebo_sonar_plugin
[ 74%] Building CXX object CMakeFiles/gazebo_sonar_plugin.dir/src/gazebo_sonar_plugin.cpp.o
[ 75%] Linking CXX shared library libgazebo_wind_plugin.so
[ 76%] Linking CXX shared library libgazebo_sonar_plugin.so
[ 76%] Built target gazebo_wind_plugin
Scanning dependencies of target gazebo_lidar_plugin
[ 77%] Linking CXX shared library libgazebo_gps_plugin.so
[ 79%] Building CXX object CMakeFiles/gazebo_lidar_plugin.dir/src/gazebo_lidar_plugin.cpp.o
[ 79%] Built target gazebo_sonar_plugin
Scanning dependencies of target gazebo_opticalflow_plugin
[ 80%] Building CXX object CMakeFiles/gazebo_opticalflow_plugin.dir/src/gazebo_opticalflow_plugin.cpp.o
[ 80%] Built target gazebo_gps_plugin
Scanning dependencies of target gazebo_mavlink_interface
[ 81%] Building CXX object CMakeFiles/gazebo_mavlink_interface.dir/src/gazebo_mavlink_interface.cpp.o
[ 82%] Linking CXX shared library libgazebo_geotagged_images_plugin.so
[ 82%] Built target gazebo_geotagged_images_plugin
Scanning dependencies of target gazebo_uuv_plugin
[ 83%] Building CXX object CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o
[ 84%] Linking CXX shared library libgazebo_lidar_plugin.so
[ 84%] Built target gazebo_lidar_plugin
Scanning dependencies of target gazebo_vision_plugin
[ 86%] Building CXX object CMakeFiles/gazebo_vision_plugin.dir/src/gazebo_vision_plugin.cpp.o
[ 87%] Linking CXX shared library libgazebo_mavlink_interface.so
[ 87%] Built target gazebo_mavlink_interface
Scanning dependencies of target gazebo_multirotor_base_plugin
[ 88%] Building CXX object CMakeFiles/gazebo_multirotor_base_plugin.dir/src/gazebo_multirotor_base_plugin.cpp.o
[ 89%] Linking CXX shared library libgazebo_uuv_plugin.so
[ 89%] Built target gazebo_uuv_plugin
Scanning dependencies of target gazebo_imu_plugin
[ 90%] Building CXX object CMakeFiles/gazebo_imu_plugin.dir/src/gazebo_imu_plugin.cpp.o
[ 91%] Linking CXX shared library libgazebo_vision_plugin.so
[ 91%] Built target gazebo_vision_plugin
Scanning dependencies of target gazebo_gimbal_controller_plugin
[ 93%] Building CXX object CMakeFiles/gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o
[ 94%] Linking CXX shared library libgazebo_multirotor_base_plugin.so
[ 94%] Built target gazebo_multirotor_base_plugin
Scanning dependencies of target gazebo_motor_model
[ 95%] Building CXX object CMakeFiles/gazebo_motor_model.dir/src/gazebo_motor_model.cpp.o
[ 96%] Linking CXX shared library libgazebo_imu_plugin.so
[ 96%] Built target gazebo_imu_plugin
[ 97%] Linking CXX shared library libgazebo_gimbal_controller_plugin.so
[ 97%] Built target gazebo_gimbal_controller_plugin
[ 98%] Linking CXX shared library libgazebo_motor_model.so
[ 98%] Built target gazebo_motor_model
[100%] Linking CXX shared library libgazebo_opticalflow_plugin.so
[100%] Built target gazebo_opticalflow_plugin
[100%] No install step for 'sitl_gazebo'
[100%] Completed 'sitl_gazebo'
[100%] Built target sitl_gazebo
Scanning dependencies of target gazebo
SITL ARGS
sitl_bin: /home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
src_path: /home/swift/catkin_ws/src/Firmware
build_path: /home/swift/catkin_ws/src/Firmware/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/swift/catkin_ws/src/Firmware/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/swift/catkin_ws/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.219.165
[Wrn] [gazebo_barometer_plugin.cpp:66] [gazebo_barometer_plugin] Using default home altitude of 488 m
[Dbg] [gazebo_mavlink_interface.cpp:135]  not found for channel[0] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135]  not found for channel[1] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135]  not found for channel[2] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135]  not found for channel[3] no joint control will be performed for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::propeller_joint] not found for channel[4] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::flap_left_joint] not found for channel[5] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::flap_right_joint] not found for channel[6] no joint control for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135]  not found for channel[7] no joint control will be performed for this channel.
[Msg] Connecting to PX4 SITL using TCP
[Msg] Lockstep is enabled
[Msg] Speed factor set to: 1
SITL COMMAND: "/home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/bin/px4" "/home/swift/catkin_ws/src/Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/home/swift/catkin_ws/src/Firmware"/test_data
INFO  [px4] Creating symlink /home/swift/catkin_ws/src/Firmware/ROMFS/px4fmu_common -> /home/swift/catkin_ws/src/Firmware/build/px4_sitl_default/tmp/rootfs/etc
0 WARNING: setRealtimeSched failed (not run as root?)

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

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
  SYS_AUTOSTART: curr: 0 -> new: 10016
  BAT_N_CELLS: curr: 0 -> new: 3
  CAL_ACC0_ID: curr: 0 -> new: 1311244
  CAL_ACC_PRIME: curr: 0 -> new: 1311244
  CAL_GYRO0_ID: curr: 0 -> new: 2294028
  CAL_GYRO_PRIME: curr: 0 -> new: 2294028
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CAL_MAG_PRIME: curr: 0 -> new: 197388
  CAL_BARO_PRIME: curr: 0 -> new: 6620172
  COM_DISARM_LAND: curr: -1.0000 -> new: 0.1000
  COM_OBL_ACT: curr: 0 -> new: 2
  COM_OF_LOSS_T: curr: 0.0000 -> new: 5.0000
  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
  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_HOLD_MAX_Z: curr: 0.6000 -> new: 2.0000
  MPC_Z_VEL_I: curr: 0.0200 -> new: 0.1500
  MPC_Z_VEL_P: curr: 0.2000 -> new: 0.6000
  MPC_XY_P: curr: 0.9500 -> new: 0.8000
  MPC_XY_VEL_P: curr: 0.0900 -> new: 0.2000
  MPC_XY_VEL_D: curr: 0.0100 -> new: 0.0160
  MPC_JERK_MIN: curr: 8.0000 -> new: 10.0000
  MPC_ACC_HOR_MAX: curr: 10.0000 -> new: 3.0000
  NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000
  NAV_DLL_ACT: curr: 0 -> new: 2
  RTL_DESCEND_ALT: curr: 30.0000 -> new: 5.0000
  RTL_LAND_DELAY: curr: -1.0000 -> new: 5.0000
  RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000
  SDLOG_MODE: curr: 0 -> new: 1
  SDLOG_PROFILE: curr: 3 -> 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
* RTL_DESCEND_ALT: curr: 5.0000 -> new: 10.0000
* RTL_LAND_DELAY: curr: 5.0000 -> new: 0.0000
  PWM_MAX: curr: 2000 -> new: 1950
  PWM_MIN: curr: 1000 -> new: 1075
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to connect on TCP port 4560
INFO  [simulator] Simulator connected on TCP port 4560.
[Msg] Using MAVLink protocol v2.0
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.219.165
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/iris/motors, deleting message. This warning is printed only once.
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/iris/motor_speed/0, deleting message. This warning is printed only once.
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/iris/motor_speed/1, deleting message. This warning is printed only once.
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/iris/motor_speed/2, deleting message. This warning is printed only once.
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/iris/motor_speed/3, deleting message. This warning is printed only once.
INFO  [px4_work_queue] creating: wq:hp_default, priority: 87, stack: 16384 bytes
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 14570 remote port 14550
INFO  [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO  [logger] logger started (mode=all)
INFO  [logger] Start file log (type: full)
INFO  [logger] Opened full log file: ./log/2019-07-10/18_00_36.ulg
INFO  [mavlink] MAVLink only on localhost (set param MAV_BROADCAST = 1 to enable network)
INFO  [px4] Startup script returned successfully
pxh> INFO  [ekf2] Mag sensor ID changed to 197388
INFO  [ecl/EKF] EKF GPS checks passed (WGS-84 origin set)
INFO  [ecl/EKF] EKF aligned, (pressure height, IMU buf: 22, OBS buf: 14)
INFO  [ecl/EKF] EKF commencing GPS fusion
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.

 

 

gazebo가 실행되면서 3D Robotics 사의 IRIS 모델이 정상적으로 로딩되었다.

하드웨어는 없지만 펌웨어만으로 gazebo라는 가상공간에서 시험을 해볼 수 있는 것이다.

 

 

 

 

간단한 명령인 takeoff를 주면 IRIS가 제자리에서 상공으로 호버링하다가 다시 랜딩하는 것을 볼 수 있다.

pxh> commander takeoff


pxh> INFO  [logger] Start file log (type: full)
INFO  [logger] Opened full log file: ./log/2019-07-10/18_10_26.ulg
INFO  [commander] Takeoff detected
WARN  [commander] Failsafe enabled: no datalink
INFO  [navigator] RTL HOME activated
INFO  [navigator] RTL: climb to 11 m (10 m above home)
INFO  [navigator] RTL: return at 11 m (10 m above home)
INFO  [navigator] RTL: land at home
INFO  [commander] Landing detected
INFO  [logger] closed logfile, bytes written: 1691912

 

 

 

다음 포스팅은 QGroundControl 과 연동하여 자동 미션수행 및 경로비행등을 SITL에서 수행해볼 예정이다.

728x90

댓글