Browse Source

Merge branch 'master' of http://110.33.136.149:3000/adc_pilot/modularization

fujiankuan 3 years ago
parent
commit
e78ec082e2

+ 122 - 0
src/ros/catkin/src/opendrive_if/CMakeLists.txt

@@ -0,0 +1,122 @@
+cmake_minimum_required(VERSION 2.8.11)
+project(opendrive_if)
+
+
+message(STATUS  "Enter opendrive_if")
+
+
+SET(QT_PATH  /opt/qt/5.13.2/gcc_64)
+SET(AGX_QT_PATH  /usr/include/aarch64-linux-gnu/qt5)
+
+find_path(QT_EXIST   QtCore   ${QT_PATH}/include/QtCore  ${AGX_QT_PATH}/QtCore)
+
+if(QT_EXIST)
+include_directories(
+  ${QT_PATH}/include
+  ${QT_PATH}/include/QtCore
+  ${AGX_QT_PATH}
+  ${AGX_QT_PATH}/QtCore
+)
+link_directories(
+  ${QT_PATH}/lib
+)
+else()
+  message(FATAL_ERROR "Please set QT_PATH")
+endif()
+
+
+find_path(MODULECOMM_INCLUDE_DIR modulecomm.h  ${CMAKE_SOURCE_DIR}/../../../../include )
+find_library(MODULECOMM_LIBRARAY_DIR  modulecomm  ${CMAKE_SOURCE_DIR}/../../../../bin )
+
+if (MODULECOMM_INCLUDE_DIR  AND  MODULECOMM_LIBRARAY_DIR )
+  message(STATUS  "FIND  modulecomm")
+  include_directories(
+    ${CMAKE_SOURCE_DIR}/../../../../include
+    ${CMAKE_SOURCE_DIR}/../../../../src/include/msgtype
+  )
+  link_directories(
+    ${CMAKE_SOURCE_DIR}/../../../../bin
+)
+  else( )
+    message(FATAL_ERROR "Not Found modulecomm")
+endif ()
+
+
+
+## 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 COMPONENTS
+  roscpp
+  pluginlib
+  sensor_msgs
+)
+find_package(Boost REQUIRED)
+find_package(Protobuf REQUIRED)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTORCC ON)
+
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+    set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")
+    message(STATUS "optional:-fPIC")   
+endif(CMAKE_COMPILER_IS_GNUCXX)
+
+
+## System dependencies are found with CMake's conventions
+# find_package(Boost REQUIRED COMPONENTS system)
+#find_package(Qt5Core  REQUIRED)
+#qt5_wrap_cpp(MOC src/qt_ros_test.h)
+#qt5_wrap_ui(UIC src/qt_ros_test.ui)
+
+## Uncomment this if the package has a setup.py. This macro ensures
+## modules and global scripts declared therein get installed
+## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
+# catkin_python_setup()
+
+
+###################################
+## catkin specific configuration ##
+###################################
+## The catkin_package macro generates cmake config files for your package
+## Declare things to be passed to dependent projects
+## INCLUDE_DIRS: uncomment this if you package contains header files
+## LIBRARIES: libraries you create in this project that dependent projects also need
+## CATKIN_DEPENDS: catkin_packages dependent projects also need
+## DEPENDS: system dependencies of this project that dependent projects also need
+catkin_package(
+##   INCLUDE_DIRS include
+#  LIBRARIES client_plugin
+   CATKIN_DEPENDS 
+    roscpp std_msgs 
+    sensor_msgs pluginlib
+  DEPENDS
+    Boost
+    Protobuf
+#  DEPENDS system_lib
+)
+
+###########
+## Build ##
+###########
+
+
+
+## Specify additional locations of header files
+## Your package locations should be listed before other locations
+include_directories(
+##  INCLUDE_DIRS include
+  ${CMAKE_CURRENT_BINARY_DIR}/..
+ # ${CMAKE_SOURCE_DIR}/../devel/include
+  ${catkin_INCLUDE_DIRS} include
+  ${Boost_INCLUDE_DIR}
+)
+
+
+## Declare a C++ executable
+add_executable(${PROJECT_NAME}_node src/main.cpp  )
+target_link_libraries(${PROJECT_NAME}_node ${catkin_LIBRARIES}  ${OpenCV_LIBRARIES}    ${Protobuf_LIBRARIES}  Qt5Core Qt5Xml modulecomm)
+

+ 60 - 0
src/ros/catkin/src/opendrive_if/package.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<package>
+  <name>opendrive_if</name>
+  <version>0.0.0</version>
+  <description>The opendrive_if package for provide a opendrive inteface for ros</description>
+
+  <!-- One maintainer tag required, multiple allowed, one person per tag --> 
+  <!-- Example:  -->
+  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
+  <maintainer email="hans@todo.todo">hans</maintainer>
+
+
+  <!-- One license tag required, multiple allowed, one license per tag -->
+  <!-- Commonly used license strings: -->
+  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
+  <license>TODO</license>
+
+
+  <!-- Url tags are optional, but mutiple are allowed, one per tag -->
+  <!-- Optional attribute type can be: website, bugtracker, or repository -->
+  <!-- Example: -->
+  <!-- <url type="website">http://wiki.ros.org/client_plugin</url> -->
+
+
+  <!-- Author tags are optional, mutiple are allowed, one per tag -->
+  <!-- Authors do not have to be maintianers, but could be -->
+  <!-- Example: -->
+  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->
+
+
+  <!-- The *_depend tags are used to specify dependencies -->
+  <!-- Dependencies can be catkin packages or system dependencies -->
+  <!-- Examples: -->
+  <!-- Use build_depend for packages you need at compile time: -->
+  <!--   <build_depend>message_generation</build_depend> -->
+  <!-- Use buildtool_depend for build tool packages: -->
+  <!--   <buildtool_depend>catkin</buildtool_depend> -->
+  <!-- Use run_depend for packages you need at runtime: -->
+  <!--   <run_depend>message_runtime</run_depend> -->
+  <!-- Use test_depend for packages you need only for testing: -->
+  <!--   <test_depend>gtest</test_depend> -->
+  <buildtool_depend>catkin</buildtool_depend>
+  <build_depend>roscpp</build_depend>
+  <build_depend>std_msgs</build_depend>
+  <run_depend>roscpp</run_depend>
+  <run_depend>std_msgs</run_depend>
+
+  <build_depend>pluginlib</build_depend>
+  <run_depend>pluginlib</run_depend>
+
+  <build_depend>sensor_msgs</build_depend>
+  <run_depend>sensor_msgs</run_depend>
+
+
+  <!-- The export tag contains other, unspecified, tags -->
+  <export>
+    <!-- Other tools can request additional information be placed here -->
+
+  </export>
+</package>

+ 74 - 0
src/ros/catkin/src/opendrive_if/src/main.cpp

@@ -0,0 +1,74 @@
+#include "ros/ros.h"
+
+#include <visualization_msgs/Marker.h>
+
+#include <memory>
+#include <thread>
+
+#include "modulecomm.h"
+
+ ros::Publisher marker_pub ;
+
+void threadtest()
+{
+    double fx = 0.1;
+    while(1)
+    {
+        visualization_msgs::Marker marker;
+        marker.header.frame_id = "/my_frame";
+        marker.header.stamp = ros::Time::now();
+        marker.ns = "basic_shapes";
+        marker.id = 0;
+        marker.type = visualization_msgs::Marker::LINE_LIST;
+        marker.action = visualization_msgs::Marker::ADD;
+
+      //  marker.pose.position.x = fx;fx = fx + 0.1;
+      //  marker.pose.position.y = 0;
+     //   marker.pose.position.z = 0;
+     //   marker.pose.orientation.x = 0.0;
+     //   marker.pose.orientation.y = 0.0;
+     //   marker.pose.orientation.z = 0.0;
+     //   marker.pose.orientation.w = 1.0;
+         marker.scale.x = 0.01;
+      //   marker.scale.y = 0.3;
+    //     marker.scale.z = 1.0;
+         marker.color.r = 0.0f;
+         marker.color.g = 1.0f;
+         marker.color.b = 0.0f;
+         marker.color.a = 1.0;
+         geometry_msgs::Point p;
+         p.x = 0;
+         p.y = 0;
+         p.z = 0;
+         marker.points.push_back(p);
+         p.x = 1.0;
+         marker.points.push_back(p);
+         marker.points.push_back(p);
+         p.x = 10.0;
+         marker.points.push_back(p);
+         p.x =0.0;
+         p.y = 5.0;
+         marker.points.push_back(p);
+         p.x = 10.0;marker.points.push_back(p);
+         marker.lifetime = ros::Duration();
+         marker_pub.publish(marker);
+
+
+        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+    }
+}
+
+
+int main(int argc, char *argv[])
+{
+	ros::init(argc, argv, "opendrive_if");
+	ros::NodeHandle n;
+	ros::Rate loop_rate(100);
+
+    marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 1);
+
+    std::thread * pt = new std::thread(threadtest);
+   
+   ros::spin();
+
+}