Pixhawk 2 Cube Orange와 Companion Board(Raspberry Pi 4) 연결하기 1 - Raspberry Pi 4 환경 구성

2022. 7. 27. 20:48UAV/Software


라즈베리파이에 Ubuntu 20.04 설치

 

이 내용은 참고 자료가 너무 많아 자세히는 다루지 않고, 링크 첨부로 대신합니다.

https://linuxhint.com/install-ubuntu-desktop-20-04-lts-on-raspberry-pi-4/

 

Install Ubuntu Desktop 20.04 LTS on Raspberry Pi 4

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of

linuxhint.com

 


ROS Noetic 설치

 

이 내용 역시 참고 자료가 많아서 링크 첨부로 대신합니다. Desktop 버전과 똑같이 링크를 따라하면 됩니다.

http://wiki.ros.org/noetic/Installation/Ubuntu

 

noetic/Installation/Ubuntu - ROS Wiki

If you rely on these packages, please support OSRF. These packages are built and hosted on infrastructure maintained and paid for by the Open Source Robotics Foundation, a 501(c)(3) non-profit organization. If OSRF were to receive one penny for each downlo

wiki.ros.org

 


python3 - catkin - tools 설치

 

다음 커맨드를 이용하여 빌드에 필요한 캣킨 툴을 설치해줍니다.

 

sudo apt update
sudo apt install python3-osrf-pycommon
sudo apt install python3-catkin-tools

 


mavros 설치

 

다음 커맨드를 이용하여 라즈베리파이에 mavros를 설치합니다.

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

#install geographicdatasets
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh

chmod a+x install_geographiclib_datasets.sh

sudo ./install_geographiclib_datasets.sh

 


workspace 생성 및 빌드

 

워낙 잘 알려진 내용으로, ROS를 사용해보신 분들은 익숙하실 것으로 예상됩니다. workspace 구성에 관한 내용은 이전 포스팅에서 다루었으니, 참고해 보셔도 좋을 것 같습니다.

 

2022.07.26 - [Ubuntu/ROS] - Python을 이용한 ROS 개발 환경 구성 및 예제

 

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

cd .. #workspace path로 이동
catkin_make

source devel/setup.bash

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

 


Pixhawk와 Raspberry Pi 연결을 위한 환경 구성

 

라즈베리파이와 픽스호크의 시리얼 통신을 위한 연결 설정을 해줍니다. 아래 명령어를 통해 라즈베리파이 설정창에 진입합니다.

 

sudo raspi-config

 

raspi-config 진입 화면, 5 Interfacing Options로 들어갑니다.

 

5번 탭 진입 결과. P6 Serial 탭으로 들어갑니다.

 

Would you like a login shell to be accessible over serial? 에는  No를,

Would you like the serial port hardware to be enabled? 에는 Yes를 눌러주고, 라즈베리파이를 재부팅 합니다.

 

위 과정들을 통해 MAVROS로 Pixhawk와의 통신을 위한 필수 환경 구성은 끝입니다. 이후 포스팅에서 하드웨어 구성 및 통신 예제 등을 다뤄보도록 하겠습니다.

 


참고 링크

 

https://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html 

 

Communicating with Raspberry Pi via MAVLink — Dev documentation

MAVProxy can be used to send commands to the flight controller from the Pi. It can also be used to route telemetry to other network endpoints. This assumes you have a SSH connection to the Pi. If not, see see the the RPi Documentation. To test the RPi and

ardupilot.org

https://stackoverflow.com/questions/63419256/how-can-i-connecti-raspberry-pi-4-to-pixhawk

 

How can I connecti Raspberry pi 4 to pixhawk?

I want to create a connection between pixhawk and raspberry pi 4 model B. When I connect the Pixhawk to the usb port of raspberry via micro-usb, I can send commands to the pixhawk with the drone-kit

stackoverflow.com