Переглянути джерело

添加decision决策模块

liujingwei 4 роки тому
батько
коміт
8e1a7c4699

+ 26 - 3
src/desision/CMakeLists.txt

@@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 2.8.3)
 project(desision)
 
 ## Compile as C++11, supported in ROS Kinetic and newer
-# add_compile_options(-std=c++11)
+add_compile_options(-std=c++11)
 
 ## Find catkin macros and libraries
 ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
 ## is used, also find other catkin packages
-find_package(catkin REQUIRED)
+find_package(catkin REQUIRED COMPONENTS
+    roscpp message_generation std_msgs rospy
+)
 
 ## System dependencies are found with CMake's conventions
 # find_package(Boost REQUIRED COMPONENTS system)
@@ -113,7 +115,8 @@ catkin_package(
 ## Your package locations should be listed before other locations
 include_directories(
 # include
-# ${catkin_INCLUDE_DIRS}
+ ${catkin_INCLUDE_DIRS}
+    /usr/local/include
 )
 
 ## Declare a C++ library
@@ -200,3 +203,23 @@ include_directories(
 
 ## Add folders to be run by python nosetests
 # catkin_add_nosetests(test)
+
+add_executable(decision
+    ../common/time.h
+    ../common/gloghelper.h
+    ../common/gloghelper.cpp
+    ../common/robotapp.h
+    ../common/robotapp.cpp
+    decision_app.cpp
+    decision.h
+    decision.cpp
+ )
+
+
+target_link_libraries(decision
+    ${catkin_LIBRARIES}
+    glog
+    gflags
+    pcan
+    dl
+    protobuf)

+ 28 - 0
src/decision/decision.cpp

@@ -0,0 +1,28 @@
+#include "decision.h"
+
+
+
+namespace robot {
+namespace decision {
+
+
+
+std::string Decision::Name() const { return "decision"; }
+
+int Decision::Init(){
+    LOG(INFO)<<Name()<<"Decision init...";
+    return 0;
+}
+
+int Decision::Start(){
+    LOG(INFO)<<"Decision start...";
+    return 0;
+}
+void Decision::Stop(){
+    LOG(INFO)<<"Decision stop...";
+    return ;
+}
+
+}
+}
+

+ 59 - 0
src/decision/decision.h

@@ -0,0 +1,59 @@
+
+/******************************************************************************
+ * Copyright 2020 The siasun Transport Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 1.0 (the "License");
+ *****************************************************************************/
+#ifndef ROBOT_ROBOT_DECISION_H
+#define ROBOT_ROBOT_DECISION_H
+
+
+
+#include "../common/robotapp.h"
+#include "ros/ros.h"
+
+
+namespace robot {
+namespace decision {
+
+/**
+* @class Decision
+*
+* @brief decision module main class.
+* 本类是决策类
+* It collect the control data from other model and send decison message to other model.
+*/
+
+class Decision: public robot::common::RobotApp{
+
+public:
+    Decision(){}
+    /**
+    * decision节点名称
+    */
+    std::string Name() const override;
+
+    /**
+    * decision模块初始化
+    * @brief module initialization function
+    * @return initialization status
+    */
+    int Init() override;
+
+    /**
+    * decision模块启动
+    * @brief module start function
+    * @return start status
+    */
+    int Start() override;
+
+    /**
+    * decision模块的停止
+    * @brief module stop function.
+    * @return start status
+    */
+    void Stop() override;
+};
+}
+}
+#endif // ROBOT_ROBOT_DECISION_H

+ 5 - 0
src/decision/decision_app.cpp

@@ -0,0 +1,5 @@
+#include "../common/robotapp.h"
+#include "decision.h"
+
+ROBOT_MAIN(robot::decision::Decision);
+

src/desision/package.xml → src/decision/package.xml


+ 0 - 0
src/desision/decision.cpp


+ 0 - 4
src/desision/decision.h

@@ -1,4 +0,0 @@
-#ifndef DECISION_H
-#define DECISION_H
-
-#endif // DECISION_H

+ 0 - 0
src/desision/decision_app.cpp