본문 바로가기

카테고리 없음

PILS(px4, Gazebo)

ROS, Gazebo, px4, QGroundControl(이하 QGC) 설치

 

 

QGC 셋팅

- Application Settings/General/AutoConnect... -> Pixhawk, UDP에 체크

 

QGC에서 픽스호크 연결 확인 후 HITL모드 셋팅

-Vehicle Setup/Airframe -> SIH QuadcopterX

-Vehicle Setup/Safety/Hardware in the Loop Simulation -> SIH 또는 HITL enabled 선택

 

월드 생성 

-Gazebo에서 월드 에디터를 통해 월드 생성

-또는 ~/Firmware/Tools/sitl_gazebo/worlds 폴더 열어서 원하는 월드 생성

-여기서는 iris_irlock.world를 복사하여 iris.world 로 새로 만들고 파일 연 후

<include>

   <uri>model://iris

</include>

를 추가. 같은 방법으로 다른 모델도 추가 가능

 

추가한 모델의 hils모드 셋팅

~/Firmware/Tools/sitl_gazebo/model/iris/iris.sdf

 

 

 

$ gedit ~/.ignition/fuel/config.yaml

updates server

from https://api.ignitionfuel.org to https://fuel.ignitionrobotics.org

 

 

빌드(내용물 변경 후 Gazebo 실행 전 빌드해주지 않으면 실행이 안됨)

$ cd ~/catkin_ws/src/Firmware 

$ source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default

 

Gazebo로 실행

$ gazebo $(pwd)/Tools/sitl_gazebo/worlds/iris.world

 

또는 ROS 실행

$ roscore

$ cd ~/catkin_ws/src/Firmware

$ roslaunch gazebo_ros empty_world.launch world_name:=$(pwd)/Tools/sitl_gazebo/worlds/iris.world

 

 

 

 

[errors & problems]

 

 

$ pkill gzserver

 

Unable to find uri

$ export GAZEBO_MODEL_PATH=~/catkin_ws/src/Firmware/Tools/sitl_gazebo/models:${GAZEBO_MODEL_PATH}

 

 

 

port permission

find ttyACM or ttyUSB0

$ ls -l /dev/tty*               

 

$ sudo usermod -a -G dialout $USER

$ sudo apt-get remove modemmanager -y sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav

$ gstreamer1.0-gl -y

 

logout and login to change account permission

 

$ sudo chmod 777 /dev/ttyACM0