Skip to content
Snippets Groups Projects
MainNode.h 1.31 KiB
Newer Older
#ifndef MAINNODE_H
#define MAINNODE_H

Franz Bethke's avatar
Franz Bethke committed
#include <nodelet/nodelet.h>
#include <ros/ros.h>
#include <logging/MessageOStream.h>
Steven Lange's avatar
Steven Lange committed
#include "boost/thread.hpp"
Franz Bethke's avatar
Franz Bethke committed

Hoop77's avatar
-  
Hoop77 committed
#include "NotifiableThread.h"
#include "NetworkingLib/Networking.h"
Franz Bethke's avatar
Franz Bethke committed

#include "PlatoonProtocolLib/VehicleFacade.h"
Franz Bethke's avatar
Franz Bethke committed
#include "PC2CarLib/CommandReceiver.h"
Franz Bethke's avatar
Franz Bethke committed
#include "PlatoonController.h"
#include "EgoMotion.h"
#include "CruiseController.h"
Franz Bethke's avatar
Franz Bethke committed

Franz Bethke's avatar
Franz Bethke committed
namespace car
{
Hoop77's avatar
-  
Hoop77 committed
class MainNode : public nodelet::Nodelet
{
public:
    MainNode();

    void onInit() override;
Hoop77's avatar
-  
Hoop77 committed

private:
    ros::NodeHandle nh;
    MessageOStream messageOStream;
    networking::Networking c2cNet; // thread  + event queue
    platoonProtocol::VehicleFacade c2c;
    networking::Networking pcNet; // thread  + event queue
    pc2car::CommandReceiver::Ptr pc;
Franz Bethke's avatar
Franz Bethke committed

    EgoMotion egoMotion;
    
Franz Bethke's avatar
Franz Bethke committed
    PlatoonController platoonController;
    NotifiableThread platoonControllerThread;
     
    CruiseController cruiseController;
    NotifiableThread cruiseControllerThread;
Franz Bethke's avatar
Franz Bethke committed
      
    std::function<void()> platoonControllerNotify =
        [this] { platoonControllerThread.notify(); };
    
    std::function<void()> cruiseControllerNotify =
        [this] { cruiseControllerThread.notify(); };
Hoop77's avatar
-  
Hoop77 committed
    platoonProtocol::VehicleId readVehicleId();
    platoonProtocol::Vehicle::VehicleEndpoints readVehicleEndpoints();
Hoop77's avatar
-  
Hoop77 committed
};
Franz Bethke's avatar
Franz Bethke committed
}