Commit 6dc0cdc7 authored by Philippe Gaussier's avatar Philippe Gaussier
Browse files

Suppress the use of loguru library.

PG.
parent c1ccf9e9
Pipeline #1265 failed with stage
in 3 minutes and 35 seconds
......@@ -16,6 +16,9 @@ project(PixhawkProject CXX)
cmake_minimum_required(VERSION 3.2)
set(VERSION 1.0.0)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
# OUTPUT DIR SETTINGS
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
......@@ -51,13 +54,14 @@ set(MAVLINK_LIB -I/lib/mavlink)
include_directories(./lib/mavlink)
message("- Checking : Loguru")
if(EXISTS ${CMAKE_SOURCE_DIR}/lib/loguru)
message("-> succes " )
else()
message("Fail: You must add loguru log system in lib folder")
endif()
include_directories(./lib/loguru)
#message("- Checking : Loguru")
#if(EXISTS ${CMAKE_SOURCE_DIR}/lib/loguru)
# message("-> succes " )
#else()
# message("Fail: You must add loguru log system in lib folder")
#endif()
#include_directories(./lib/loguru)
message("- Checking : Blc channels")
find_package(blc_channel REQUIRED)
......@@ -116,7 +120,7 @@ add_executable(
src/Data_Drone.cpp
src/Abstract_ThreadClass.cpp
lib/loguru/loguru.cpp
# lib/loguru/loguru.cpp
)
# Test trajectory launch
......
......@@ -17,7 +17,7 @@
#include <memory>
#include <algorithm>
#include <loguru.hpp>
//#include <loguru.hpp>
#define THREAD_STATE_VOID 0 // Thread created and ready to be used
#define THREAD_STATE_READY 1 // Thread created and ready to be used
......
......@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <dirent.h>
#include <loguru.hpp>
//#include <loguru.hpp>
#include <common/mavlink.h>
......
......@@ -21,7 +21,7 @@
#include <panel.h>
#include <sys/ioctl.h>
#include <loguru.hpp>
//#include <loguru.hpp>
#include "Abstract_ThreadClass.h"
......
......@@ -41,7 +41,7 @@
#include <utility>
#include <loguru.hpp>
//#include <loguru.hpp>
#include "Abstract_ThreadClass.h"
#include "Display_Panel.h"
......
......@@ -40,7 +40,7 @@
#include <queue>
#include <utility>
#include <loguru.hpp>
//#include <loguru.hpp>
#include "Constants.h"
......
......@@ -23,7 +23,7 @@
#include <dirent.h>
#include <loguru.hpp>
//#include <loguru.hpp>
#include "blc_channel.h"
#include "blc_program.h"
......
......@@ -15,7 +15,7 @@
#include <mutex>
#include <sys/time.h>
#include <loguru.hpp>
// #include <loguru.hpp>
#include "../include/Engine_mainLoop.h"
......
......@@ -66,6 +66,7 @@ private:
std::shared_ptr<blc_channel> blc_control_motors; //x, y, z, r
std::shared_ptr<blc_channel> blc_control_commands; // 1=on, 0=off
std::shared_ptr<blc_channel> blc_drone_data;
protected:
/**
......
/**
* @author Sylvain Colomer
* @author Sylvain Colomer, P. Gaussier
* @date 18/04/19.
*/
#include <iostream>
#include <string>
using namespace std;
#include <sys/time.h>
#include "../include/Abstract_ThreadClass.h"
......@@ -60,7 +66,7 @@ void Abstract_ThreadClass::init(){
}
void Abstract_ThreadClass::start(){
DLOG_F(INFO, "Start one thread");
cout<< "Start one thread\n";
principalThread= std::thread(&Abstract_ThreadClass::run, this);
state = THREAD_STATE_WORK_SLEEP;
......@@ -68,7 +74,7 @@ void Abstract_ThreadClass::start(){
void Abstract_ThreadClass::stop(){
DLOG_F(INFO, "Stop one thread");
cout<< "Stop one thread\n";
runFlag_mutex.lock();
runFlag = runFlag = false;
......@@ -76,7 +82,7 @@ void Abstract_ThreadClass::stop(){
}
void Abstract_ThreadClass::stop_force(){
DLOG_F(INFO, "Force Stop one thread");
cout<< "Force Stop one thread\n";
runFlag = false;
}
......@@ -87,7 +93,7 @@ void Abstract_ThreadClass::pause(){
}
void Abstract_ThreadClass::join(){
DLOG_F(INFO, "Join one thread");
cout<< "Join one thread\n";
principalThread.join();
}
......
......@@ -3,6 +3,12 @@
* @date 18/04/19.
*/
#include <iostream>
#include <string>
using namespace std;
#include "../include/DataListener_Keyboard.h"
#include "../include/Engine_mainLoop.h"
......@@ -43,7 +49,7 @@ void DataListener_Keyboard::run(){
switch(getch_value) { // the real value
// Refresh IHM
case 'r' :
DLOG_F(INFO, "Command refresh");
//DLOG_F(INFO, "Command refresh");
Bus::getInstanceOf().getMainFrame().get()->add_log("Refresh command", NCURSES_TEXT_GREEN);
Bus::getInstanceOf().getMainFrame().get()->repaint();
//Bus::getInstanceOf().getEngine()->add_event(EVENT_REPAINT);
......@@ -51,7 +57,7 @@ void DataListener_Keyboard::run(){
// Demonstration
case 'd' : //Not protected -> very dangerous during controled fly
DLOG_F(INFO, "Demo");
//DLOG_F(INFO, "Demo");
Bus::getInstanceOf().getMainFrame().get()->add_log("Demo command: warning only for test", NCURSES_TEXT_RED);
Bus::getInstanceOf().getMainFrame().get()->repaint();
......@@ -68,7 +74,7 @@ void DataListener_Keyboard::run(){
// Quit programm
case 'q' : // ECHAP
DLOG_F(INFO, "Command exit");
//DLOG_F(INFO, "Command exit");
Bus::getInstanceOf().getMainFrame().get()->add_log("Exit command", NCURSES_TEXT_RED);
Bus::getInstanceOf().getMainFrame().get()->repaint();
Bus::getInstanceOf().getEngine()->stop();
......
......@@ -6,6 +6,11 @@
* @version 1.0
*/
#include <iostream>
#include <string>
using namespace std;
#include "../include/Display_MainFrame.h"
#include "../include/Constants.h"
......@@ -36,8 +41,9 @@ MainFrame::MainFrame(int task_period, int task_deadline)
init_pair(NCURSES_WINDOW_2, COLOR_BLACK, COLOR_MAGENTA);
}
else{
DLOG_F(WARNING, "Your terminal does not support color");
else
{
cout<<"Your terminal does not support \n";
}
// Init element
......@@ -233,7 +239,6 @@ void MainFrame::refresh_log()
*/
void MainFrame::add_log(std::string text, int color)
{
DLOG_F(INFO, "add_log");
if(log_list.size()>NCURSES_LOG_MAX){
log_list.erase(log_list.begin());
}
......
#include "../include/Engine_mainLoop.h"
#include <iostream>
#include <string>
using namespace std;
Engine::Engine()
{
......@@ -147,7 +153,7 @@ void Engine::main_loop()
if(serial_Port_1.get()->open_serial()==0)
{
DLOG_F(INFO, "Serial port open");
//DLOG_F(INFO, "Serial port open");
MainFrame_1.get()->add_log("-> Serial port open", NCURSES_TEXT_GREEN);
MainFrame_1.get()->add_log("Research a drone", NCURSES_TEXT_BLUE);
MainFrame_1.get()->repaint();
......@@ -155,7 +161,7 @@ void Engine::main_loop()
}else
{
DLOG_F(ERROR, "Serial port wan't be open");
//DLOG_F(ERROR, "Serial port wan't be open");
MainFrame_1.get()->add_log("-> Serial port wan't be open. Retry", NCURSES_TEXT_RED);
MainFrame_1.get()->repaint();
usleep(100000);
......@@ -196,6 +202,7 @@ void Engine::main_loop()
MainFrame_1.get()->add_log("-> Launch serial port Listener", NCURSES_TEXT_GREEN);
MainFrame_1.get()->repaint();
dataListener_SerialPort_1.get()->start();
// cout<<"fin init \n";
state_engine_drones = ENGINE_DRONES_WORK;
}
......@@ -228,7 +235,8 @@ bool Engine::test_communication(){
void Engine::stop()
{
DLOG_F(INFO, "Stop one thread");
// DLOG_F(INFO, "Stop one thread");
cout<<"Stop one thread\n";
runFlag_mutex->lock();
runFlag = runFlag = false;
runFlag_mutex->unlock();
......@@ -236,7 +244,7 @@ void Engine::stop()
void Engine::stop_force()
{
DLOG_F(INFO, "Force Stop one thread");
cout<<"Force Stop one thread\n";
runFlag = false;
}
......
......@@ -16,9 +16,9 @@ int main(int argc, char *argv[]){
//%% INIT %%
//0. Init of object
loguru::init(argc, argv);
/* loguru::init(argc, argv);
loguru::add_file("output/log/debug.log", loguru::Append, loguru::Verbosity_INFO);
loguru::g_stderr_verbosity = -2;
loguru::g_stderr_verbosity = -2;*/
Engine main_engine;
......
/**
* @author Sylvain Colomer, Alexis Constant
* @author Sylvain Colomer, Alexis Constant, P. Gaussier
* @date 19/11/19.
* trash-put /dev/shm/file
*/
#include <iostream>
#include <string>
using namespace std;
#include "../include/Thread_SerialPort.h"
//#define DISPLAY
......@@ -20,6 +26,21 @@ Thread_SerialPort::Thread_SerialPort(int task_period, int task_deadline, std::sh
blc_control_motors = std::shared_ptr<blc_channel>(new blc_channel("/pixhawk.control.motors", BLC_CHANNEL_READ, 'FL32', 'NDEF', 1, 4));
//Channels use to command the drone
blc_control_commands= std::shared_ptr<blc_channel>(new blc_channel("/pixhawk.control.commands", BLC_CHANNEL_READ, 'FL32', 'NDEF', 1, 4)); // 1=on, 0=off
blc_drone_data = std::shared_ptr<blc_channel>(new blc_channel("/pixhawk.control.data", BLC_CHANNEL_WRITE, 'FL32', 'NDEF', 1, 12)); // 1=on, 0=off
//Roll,Pitch,Yaw (3), xAcc, yAcc, zAcc (3), Bat, Heading, Heartbeat (3), Lat, Lon, Alt (3), => 4x3=12
// battery_status.battery_remaining
// altitude.altitude_relative
// attitude.pitch*180/PI
// attitude.roll*180/PI
// attitude.yaw*180/PI
// vfr_hud.heading
// highres_imu.xgyro
// highres_imu.ygyro
// highres_imu.zgyro
//Create or reopen an asynchrone channel "/channel_example" sending data of type int8/char in format undefined format of one dimension (vector) of SIZE.
/* channel.create_or_open("/pixhawks.control.data", BLC_CHANNEL_WRITE, 'UIN8', 'TEXT', 1, SIZE);*/
blc_drone_data.reset(); //Clear the memory
}
......@@ -145,7 +166,7 @@ void Thread_SerialPort::write_messages(){
void Thread_SerialPort::read_messages(){
Bus::getInstanceOf().event_newMessage(message);
DLOG_F(INFO, "LOG "+message.msgid);
cout<< "LOG "<<message.msgid<<"\n";
switch (message.msgid)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment