스터디 노트
article thumbnail

최근 글에 재정리한 글이 있으니 해당 글을 참조하시면 될 것 같습니다.

 

이부분은 이제 마무리 하려고 합니다. 저는 nvidia jetson을 가지고 테스트 했는데 이유는 모르겠으나 데스크탑과 달리 문제가 지속해서 생기고 있습니다. 데스크탑도 오류 발생하면 댓글좀 부탁드립니다.

 

그냥 제가 실패한 과정부터 써내려간 것임

 

 

순서 ROS, gazebo(ROS에 기본으로 깔리는 것 이용) -> mavros -> px4(pixhawk firmware를 기반으로 simulation을 하기때문)-> simulation tool 

 

 

ROS와 gazebo는 이미 설치되었다는 가정입니다.

아래 modudculab_ros는 일단 넘어가주세요.

cd ~/catkin_ws/src
git clone https://github.com/Jaeyoung-Lim/modudculab_ros.git
cd ..
catkin_make

 

https://docs.px4.io/master/en/simulation/ros_interface.html

 

ROS with Gazebo Simulation | PX4 User Guide

ROS with Gazebo Simulation ROS (Robot Operating System) can be used with PX4 and the Gazebo simulator. It uses the MAVROS MAVLink node to communicate with PX4. The ROS/Gazebo integration with PX4 follows the pattern in the diagram below (this shows the gen

docs.px4.io

1.개발환경 설치(gazebo 및 필요한 tool chain 설치) 

-->gazebo 우선설치 설치해주지말자 ROS 설치시 기본적으로 설치되어있는것을 활용하자. 대신 tool chain 같은것은 설치해주는것이 좋다.

wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_ros_melodic.sh
bash ubuntu_sim_ros_melodic.sh
gazebo

까지 정상적으로 작동하면 설치완료

 

Error in REST request --> 

sudo find -name .ignition 을통해 나온 경로로 들어가서 

vim fuel/config.yaml

url: https://api.ignitionfuel.org --> url: https://api.ignitionrobotics.org 로 변경후 저장 

 

2.--> mavros 설치 

 

sudo apt-get update
sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras

roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"

 

3.-->PX4 설치

https://docs.px4.io/master/en/dev_setup/building_px4.html

 

Building PX4 Software | PX4 User Guide

Building PX4 Software PX4 can be built on the console or in an IDE, for both simulated and hardware targets. Note Before following these instructions you must first install the Developer Toolchain for your host operating system and target hardware. Downloa

docs.px4.io

git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4~~
make px4_sitl_default gazebo

-->error 
pip3 install --user pyserial empy toml numpy pandas jinja2 pyyaml pyros-genmsg packaging

bash ./Tools/setup/ubuntu.sh (px4 필요한 파일들 설치)
make px4_fmu-v4_default #px펌웨어 컴파일

다시 
make px4_sitl_default gazebo --> 오류버ㅏㄹ생 
sudo apt upgrade libignition-math2 # 후 

이후 다시 make clean 해주고 

재컴파일 # 시간 매우 까먹음 # 이전에 make 실패했기때문에 시도했던 부분 없애줘야함

찾아보니까 px4와 gazebo 사이 mavlink 통신이 안되는것으로 보임. 

tcp연결을 비활성화 해주니까 명령창이 뜨는데. 아직 더 찾아보는중 

 

우성님 블로그를 통해서 대화를 주고받은결과 내가 진행한 과정에서는 문제를 찾을 수 없었는데, 다른것이 나는 gazebo를 새로 설치해준것하고 펌웨어였다. 

나는 기존에 PX4 manual에 존재하는 펌웨어 주소로 받았었는데 이전버전의 펌웨어가 존재하는것 같다 

내가 받은게 PX4/PX4-Autopilot.git 이면 이전버전은 PX4/Firmware.git 임. 

 

결국 전부다 삭제하고 다시 재설치해주면서 gazebo는 ros 기본으로 있는 것 사용하고 이전버전 Firmware 사용하니까 우선 연결은 잘 됐다. 근데 이제는 model각 joint에 연결을 못한다고 난리.  --> make전에 Tools/sitl_gazebo/ optical flow 어쩌고 .cpp 에서 H GYRO TRUE 부분 --> TRUE를 1로 바꿔주면 작동함 

 

px4 shell창은 작동하나 commander 수행시 Arming이 되질 않음 Qgroundcontrol로 센서 check 부분을 비활성화 해주면 작동할 수 도 있음 (모두 Jetson을 통해 진행한 과정이고, 그냥 정신건강을 위해 검증된 환경인 Desktop으로 다시 해볼예정)

 

*distance sensor id error --> 해당 sensor topic처리를 안해줘서 생기는 문제

 

https://docs.px4.io/master/en/simulation/

 

Simulation | PX4 User Guide

Simulation Simulators allow PX4 flight code to control a computer modeled vehicle in a simulated "world". You can interact with this vehicle just as you might with a real vehicle, using QGroundControl, an offboard API, or a radio controller/gamepad. TIP Si

docs.px4.io

https://docs.px4.io/master/en/simulation/failsafes.html

 

Simulate Failsafes | PX4 User Guide

Simulate Failsafes Failsafes define the safe limits/conditions under which you can safely use PX4, and the action that will be performed if a failsafe is triggered (for example, landing, holding position, or returning to a specified point). In SITL some fa

docs.px4.io

https://wsstudynote.tistory.com/16

 

PIXHAWK SIMULATION

sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh sudo chmod +x install_..

wsstudynote.tistory.com

 

 

참고 블로그 

https://kwangpil.tistory.com/100

 

[드론 만들기] Gazebo 사용하기 1/4

이전 글... 드론 만들기     하드웨어 기본부품  비행 제어기(FC) Pixhawk 시리즈      Pixhawk의 GPS  Pixhawk의 텔레메트리(Telemetry)   Pixhawk의 변속기(ESC) QGroundControl에서 변속기(ESC) 교정하..

kwangpil.tistory.com

https://discuss.px4.io/t/pxh-shell-doesnt-launch-when-i-run-with-gazebo/19886/2

 

Pxh shell doesn't launch when I run with gazebo

I had the same issue where launching PX4 SITL gave me the info message that is also present in your log: INFO [simulator] Waiting for simulator to accept connection on TCP port 4560 I changed this so that the simulator would connect by changing it to conne

discuss.px4.io

https://github.com/PX4/PX4-Avoidance/issues/172

 

Problems in connections with Gazebo Simulator · Issue #172 · PX4/PX4-Avoidance

As I follow instruction on this repo. I came to find some problems with connections. Problem with the connection with PX4 SITL with Gazebo Simulation It was very easy to miss the problem that no er...

github.com

https://15051015.tistory.com/210?category=956473 

 

Pixhawk2 Jetson nano Mavros

2020/10/06 - [Project/재난 군집드론] - mavros install ( jetson nano mavros ) mavros install ( jetson nano mavros ) << ros 설치는 되어있는 상태로 시작하였습니다. 1, brisbaneroboticsclub.id.au/install..

15051015.tistory.com

https://discuss.px4.io/t/failsafe-enabled-no-datalink-when-flying-around-using-mavros-services/6816/2

 

"Failsafe enabled: no datalink" when flying around using MAVROS services

Turns out the mavlink shell also works as a valid datalink. I’ve been able to identify the responsible passages and came up with a little “datalink thread”, which solves my issue. It goes like this: import threading from pymavlink import mavutil clas

discuss.px4.io

 

'maengkyun > Pixhawk' 카테고리의 다른 글

정리할 것 list  (0) 2021.08.12
ROS 개인정리  (0) 2021.08.09
[pixhawk] gazebo 환경에서 mavros를 이용해 위치명령주기  (13) 2021.08.09
ROS 노드 작성과 빌드  (0) 2021.08.09
[pixhawk] gazebo simulation 재도전  (0) 2021.08.07
profile

스터디 노트

@myeongkyun

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!