Wed, Feb 16, 22, pixhawk gcs simulation series 2 with ros indigo
This is a draft, the content is not complete and of poor quality!

Ubuntu에 ROS Indigo 설치

  1. ROS Indigo란? http://www.slideshare.net/yoonseokpyo/20160406-ros-1-for ROS는 특이하게 버전이 알파벳 형식을 따라가면서 이름이 붙습니다. 현재 가장 최신 버전은 Kinetic이지만 저희는 두 번째 전의 버전인 Indigo를 사용하기로 하였습니다.

ros-kinetc_install

  1. ROS Indigo설치 http://wiki.ros.org/indigo/Installation/Ubuntu 위 사이트는 ros wiki페이지로 ros 설치부터 시작해서 여러가지 튜토리얼도 올라와 있습니다. 또한 어떤 문제들이 있으면 바로 업데이트가 된다는 장점이 있습니다. 아래는 오로카 사이트에서 이 ros wiki page를 참고해서 올린 ros indigo 설치 페이지입니다. 저는 ros wiki 글대로 설치하겠습니다. 아래 명령어들을 따라서 설치하시면 되고 각 step에 대한 설명은 생략하도록 하겠습니다. 자세한 내용은 ros wiki 홈페이지를 참고해주시면 되겠습니다. http://cafe.naver.com/openrt/5413

(1) Setup your sources.list

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

(2) Setup your key

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

(3) Installation https://youtu.be/9pOydoNeV_U

sudo apt-get update

sudo apt-get upgrade

or

sudo apt-get update && sudo apt-get install dpkg

sudo apt-get install ros-indigo-desktop-full

위 명령어로만 설치가 안 될 경우에 다음을 실행해보세요

sudo apt-get install libsdformat1

(4) Initialize rosdep

sudo rosdep init
rosdep update

(5) environment setup

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc

(5) getting rosinstall

sudo apt-get install python-rosinstall

(6) make workspace for ros (오로카)

mkdir -p ~/catkin_ws/src

cd ~/catkin_ws/src

catkin_init_workspace

(7) catkin make test

cd ~/catkin_ws/

catkin_make

[출처] 로봇 운영체제 강좌 : ROS Indigo 설치 (오픈소스 소프트웨어 & 하드웨어: 로봇 기술 공유 카페 (오로카)) |작성자 표윤석

https://hiro-group.ronc.one/ros_kinetic_installation.html 여기서 말하는 것과 같이 터미널 창에서

vim ~/.bashrc 을 실행시켜주시면 어떤 문서파일이 뜰 겁니다. 그 끝에 자신의 IP 등등 필요한 정보들을 입력해줍니다 오로카 홈페이지에서 말하는 것처럼 세가지를 설정해줍니다.

set ROS Indigohttps://hiro-group.ronc.one/ros_kinetic_installation.html

IP는 터미널 창에서 ifconfig를 입력해주면 확인할 수 있습니다.

부분을 첨가해주고 저장해주고 종료해 줍니다.

  1. ROS 개발환경구축 http://cafe.naver.com/openrt/7242 오로카에 나와있는 내용입니다. ros node파일 등등을 edit하고 생성할 때 사용할 수 있는 QtCreator를 설치합니다.

(1) 설치

sudo apt-get install qtcreator

(2) 실행

qtcreator
  1. ROS Indigo 동작테스트 http://cafe.naver.com/openrt/2382 터미널 창을 키고 roscore 실행을 시켜주시기 바랍니다.
roscore

(1) turtlesim 예제 실행 가장 간단한 예제인 turtlesim예제를 실행해보겠습니다. roscore가 돌아가는 터미널 창은 놔두고 새로운 터미널 창을 열어주고 밑의 코드를 입력하시면 됩니다.

rosrun turtlesim turtlesim_node

(2) turtle_teleop_key 실행 또 새로운 터미널 창을 열어줘서 밑의 코드를 실행시키면 위의 turtle을 키보드로 조종할 수 있습니다.

rosrun turtlesim turtle_teleop_key

ROS2 Rox Fitzroy

official

turtle예제가 성공적으로 실행이 된다면 ROS설치가 완료되었습니다.

ros on companion computer

link

Introduction

Implementing a onboard computer on a small UAS can have many benefits such as being able to use ROS onboard the system. This can speed up the development process and enable to use various sensors and actuators that are supported by the ROS community. I have recently written articles on how to use MAVROS to fly a PX4 based quadrotor. However the articles do not cover operating such a system outdoors. Operating outdoors can have many issues as configuring a network or the change of localization performances and the presence of the environment. This article describes my experience on the implementation and operation of a ROS controlled MAV outdoors so that the reader can avoid the mistakes that I have made. Raspberry Pi 2 B+ was used for the onboard computer running ROS.

Results

A simple trajectory generation node was implemented to generate a circular trajectory for the quadrotor to follow. The radius was 6 m at a 15m altitude with the angular rate of 0.4 rad/s.

The video shows the comparison of the real flight with the gazebo SITL simulation. The video shows that the SITL is pretty accurate with the real flight.

Hardware Setup

  • Quadrotor Hardware image

IMG_1039 The quadrotor is a custom built quadrotor based on the PX4 flight stack. The quadrotor has a 8X4.5 inch props with a 1200kv motor running on a 3S Lipo. Pixhawk was used for the flight controller and the quadrotor is capable of flying and basic waypoint based autonomous missions without the existence of the companion computer.

Companion Computer

Raspberry Pi 2 B+ was used for the companion computer with the pixhawk flight controller. It is not specificly a good choice to use the Raspberry Pi as a companion computer. Raspberry Pis are cheap and fun to use but using raspbian may cause build problems in some packages in ROS.

image

pixhawk_raspberryPi

The companion computer is stacked on top of the flight controller. The TX/RX pins are connected to the TELEM2 port on Pixhawk. From the guide Raspberry Pi is getting power from the TELEM2 port but the Raspberry Pi was keep turning off as the 5V bus on the TELEM2 port was not providing enough current. Thus, the power is provided from the 5V bus on the servo rail which is powered by a UBEC from the ESC. Powering Raspberry Pi through GPIO is not recommended as there are no regulator or backward protection. However, As I am powering the Raspberry Pi through a UBEC, it is safer.

A 5.4 wifi dongle was used for network connections.

Software configuration

  • softwareOverview image

PX4 configuration As the Raspberry Pi UART port only supports upto 57600 bps, the baudrate of the SYS_COMPANION parameter should be set accordingly. This is different with using the FTDI. This degrades the performance of the OFFBOARD control capabilities, but as the example on this article covers only setpoint position messages, 57600bps is enough to do the job.

SYS_COMPANION 57600 ROS configuration Ubuntu 14.04 was used for the OS as there were some build issues using Raspbian Jessie. Ubuntu officially supports raspberry Pi, so the image was used on the raspberry Pi. ROS indigo was used in this project. This was a decision made from the fact that ubuntu 14.04 and ROS indigo on raspberry pi was tested in a previous example.

MAVROS configuration

The name of the UART port on Raspberry Pi 2 is ttyAMA0. This should be configured in the launch file.

fcu_ur:=/dev/ttyAMA0:57600

To test run a mavros node without making a launch file you can use:

ronrun mavros mavros_node _fcu_url:="/dev/ttyAMA0:57600"

You can check if the connection with the flight controller is properly done using rostopic tools such as:

rostopic echo /mavros/imu/data

This command echos the imu data from the flight controller and prints it on the screen.

Trajectory Publisher node rqtgraph image

The node is a simple publisher publishing position setpoints to the quadrotor. https://youtu.be/9pOydoNeV_U

#include 
#include 
#include 
#include 
#include 
#include "math.h"

double r;
double theta;
double count=0.0;https://youtu.be/9pOydoNeV_U
mavros_msgs::State current_state;
void state_cb(const mavros_msgs::State::ConstPtr& msg){
    current_state = *msg;
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "offb_node");
    ros::NodeHandle nh;

    ros::Subscriber state_sub = nh.subscribe
            ("mavros/state", 10, state_cb);
    ros::Publisher https://youtu.be/9pOydoNeV_Ulocal_pos_pub = nh.advertise
            ("mavros/setpoint_position/local", 10);

    //the setpoint publishing rate MUST be faster than 2Hz
    ros::Rate rate(20.0);
    

    nh.param("pub_setpoints_traj/wn, 1.0);
    nh.param("pub_setpoints_traj/r 1.0);
    // wait for FCU connection
    while(ros::ok() && current_state.connected){
        ros::spinOnce();
        rate.sleep();
    }

    geometry_msgs::PoseStamped pose;
    pose.pose.position.x = 0;
    pose.pose.position.y = 0;
    pose.pose.position.z = 2;

    //send a few setpoints before starting
    for(int i = 100; ros::ok() && i > 0; --i){
        local_pos_pub.publish(pose);
        ros::spinOnce();
        rate.sleep();
    }

    ros::Time last_request = ros::Time::now();

    while(ros::ok()){
       

    theta = wn*count*0.05;

        pose.pose.position.x = r*sin(theta);
        pose.pose.position.y = r*cos(theta);
        pose.pose.position.z = 15;

    count++;

        local_pos_pub.publish(pose);
        ros::spinOnce();
        rate.sleep();
    }

    return 0;
}

https://youtu.be/9pOydoNeV_U There are two parameters in the launch file which are the radius and the angular rate of the quadrotor. This can be configured from the launch file.

Operatimg the quadrotor

A field box is essential to take all the necessary equipment without forgetting something. The photo below is my go-to toolbox for field tests. IMG_20160804_131026 image

For operating a flight controller and a companion computer outdoors, it is convinient to configure a wifi network on the field. A wifi router is used to build a wifi network around a field which is powered by a 3S battery. A connector was built to connect the battery to the DCIn port to power a Wifi router.

IMG_1034 image

I used putty for the ssh client for the Raspberry Pi. The basic operation procedures in running ROS is as follows.

image

IMG_20160810_153257

First, the laptop should be connected to the same network as the raspberry pi is connected. Then, open a ssh session and run roscore:

roscore

Start a new session and run the launch file that has been configured. In this case:

rosrun modudculab_ros ctrl_traj_test.launch

For longer range applications, a more powerful router or antenna should be used. Using an ordinary wifi router outdoors seems to work well and simplify the operation process to make the system work.

The following wiki, pages and posts are tagged with

TitleTypeExcerpt
gcs and cloud post Mon, Jan 31, 22, sample4 from sass2 product sample4
overview and initial powerup post Mon, Jan 31, 22, sample1.md of sass2 product2_sample files The most advanced hardware and software ecosystem for enterprise drones
smartAP post Mon, Jan 31, 22, sample5 from sass2 product2 sample5
smartAPLink and faq post Mon, Jan 31, 22, sample3 from sass2 product2 sample3
telemetry and advanced software post Mon, Jan 31, 22, sample2.md of sass2 product2 sample2 file
px4 docker image for jvsim simulation post 목, 2월 10, 22, docker image implmentation for docker px4 simuation
qtcreator wiki from drone guide dev-setup post 화, 2월 15, 22, planning phase research for dashboard elements using
offboard control using pixhawk raspi mavros post Wed, Feb 16, 22, hitl setup and configuraiton using pixhawk raspi mavros and px4
setup gazebo for simulation post Wed, Feb 16, 22, pixhawk ros gazebo gcs simulation
setup mavros and px4 post Wed, Feb 16, 22, setup mavros and px4
testing sitl drone post Wed, Feb 16, 22, process to launch sitl drone
ros and px4 architecture and data flow post Wed, Feb 16, 22, examine how data flows for user interface and drone control
setup ros indigo with tutlesim post Wed, Feb 16, 22, pixhawk gcs simulation series 2 with ros indigo
connecting raspi to matek f406 wing post Fri, Feb 18, 22, hardware setup with raspi 4 with matek f406 wing
px4 simulation for gazebo post Fri, Feb 18, 22, simulation instruciton from px4
Let's roll and conquer! post Monday, Third week with jdlab and first week probably for actual work
brainstorming session prior to setting out on gcs development post Mon, Feb 21, 22, pool resources and ideas into one single gcs you can develop
overview of epp and eps for airframes post Tue, Feb 22, 22, research before business call to manufactueres
connecting rpi to gcs with the use of uavmatrix on uavcast pro post Mon, Feb 28, 22, supported raspi board pinout maps and setup guide
creating custom mission points for fixed wings post Fri, Mar 18, 22, p-turn or turnaround insertion to the mission raw data for exit and entry for p-turnaround and side/front-lap coverage creation that willmod...
gStreamer vs qtAv post Wed, Mar 30, 22, qt movie qmovie phonon video player
realtime georeferencing plus imu overlay post Tue, Apr 05, 22, how to add vehicle status sensor data to georeferencing
rtk reach m2 receiver documentation post Wed, Apr 06, 22, rtk reach receiver wifi 5g lte
avionics on airfoil and frames post Thu, Apr 07, 22, airfoil materials, designs and innovations in the avionics
using openTX on radiomaster TX16s post Sun, Apr 10, 22, rc reciever transmitter opentx radiomaster configuration simulation
adding GPS and IMU data to photos post flight post Mon, Apr 11, 22, perform post processing of gps/imu data or develop camera firmware lib to infuse IMU from fc to exif metadata
BMU BMC BMS battery management post Thu, Apr 14, 22, to check the usage and health of batteries at all phases of flight cycle
viewpro custom pwm post Thu, Apr 14, 22, customize viewpro camera and gimball with mavlink
raspberrypi video streaming post Fri, Apr 22, 22, configure and setup raspi to enable streaming on mavlink and to advance to LTE transmission
lx network, airlink, gcs and data transmission on smart radio, rf mesh and quantum encryption post Tue, Apr 26, 22, all about setup and how it operates and managed