Skip to content

Ofurosuki/serial_GNSS_Gyro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

serial_GNSS_Gyro

serial communication for GNSS and Gyro.

install

Download this repository

git clone https://github.com/Ofurosuki/serial_GNSS_Gyro.git

if you have not installed boost library yet, visit https://boostjp.github.io/howtobuild.html and follow the instrunctions.

build & run

execute

g++ -I /path/to/your/boost/dir/boost_1_84_0/include/ main.cpp -o Main

and then

sudo ./Main

Make sure that you run the program as admin.

usage

set port

in the main function, change port name for your environment.

    // GNSS_0
    port_1.open("/dev/ttyACM0");//here for Windows, type like "COM4"
    port_1.set_option(boost::asio::serial_port_base::baud_rate(115200));
    int count_1 = 0;

    // GNSS_1
    port_2.open("/dev/ttyUSB1");//here 
    port_2.set_option(boost::asio::serial_port_base::baud_rate(115200));


    // Gyro
    port.open("/dev/ttyUSB0");//here
    port.set_option(boost::asio::serial_port_base::baud_rate(115200));

sample

In the function loop, you can see all variables(altitude,latitude,longitude,roll,pitch,yaw) can be used. It prints all variables to terminal every one second.

void loop(double &pitch, double &roll, double &yaw,double *latitude, double *longitude, double *altitude){
    while(true){
        std::cout<<"Pitch: "<<pitch<<" Roll: "<<roll<<" Yaw: "<<yaw<<std::endl;
        std::cout<<"N_0: "<<latitude[0]<<" E_0: "<<longitude[0]<<" geoid_0: "<< altitude[0]<<std::endl;
        std::cout<<"N_1: "<<latitude[1]<<" E_1: "<<longitude[1]<<" geoid_1: "<< altitude[1]<<std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }


}

About

serial communication for GNSS and Gyro.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages