소스 검색

change pilot_apollo_bridge for add some cyber message, not complete.

yuchuli 3 달 전
부모
커밋
b91b82f9b8

+ 2 - 0
src/apollo/modules/adc/pilot_apollo_bridge/BUILD

@@ -8,9 +8,11 @@ apollo_cc_binary(
     srcs = ["pilot_apollo_bridge.cc"],
     srcs = ["pilot_apollo_bridge.cc"],
     deps = [
     deps = [
         "//cyber",
         "//cyber",
+        "//modules/common/adapters:adapter_gflags",
         "//modules/adc/pilot_apollo_bridge/proto:gpsimu_proto",
         "//modules/adc/pilot_apollo_bridge/proto:gpsimu_proto",
         "//modules/common_msgs/localization_msgs:gps_proto",
         "//modules/common_msgs/localization_msgs:gps_proto",
         "//modules/common_msgs/sensor_msgs:ins_cc_proto",
         "//modules/common_msgs/sensor_msgs:ins_cc_proto",
+        "//modules/common_msgs/localization_msgs:imu_cc_proto",
         "@qt//:qt_core",
         "@qt//:qt_core",
         "@modulecomm",
         "@modulecomm",
     ],
     ],

+ 8 - 1
src/apollo/modules/adc/pilot_apollo_bridge/pilot_apollo_bridge.cc

@@ -3,8 +3,12 @@
  #include "cyber/time/rate.h"
  #include "cyber/time/rate.h"
  #include "cyber/time/time.h"
  #include "cyber/time/time.h"
  
  
+ #include "modules/common/adapters/adapter_gflags.h"
+ 
  #include "modules/common_msgs/localization_msgs/gps.pb.h"
  #include "modules/common_msgs/localization_msgs/gps.pb.h"
  #include "modules/common_msgs/sensor_msgs/ins.pb.h"
  #include "modules/common_msgs/sensor_msgs/ins.pb.h"
+
+#include "modules/common_msgs/localization_msgs/imu.pb.h"
  
  
  //car数据定义的引用,可以看出其定义来源于一个proto
  //car数据定义的引用,可以看出其定义来源于一个proto
 // using apollo::communication::proto::Car;
 // using apollo::communication::proto::Car;
@@ -214,7 +218,10 @@ void InitIns(){
    (void)paraw;
    (void)paraw;
    
    
    std::shared_ptr<apollo::cyber::Writer<apollo::localization::Gps>>
    std::shared_ptr<apollo::cyber::Writer<apollo::localization::Gps>>
-      gps_writer_ = talker_node->CreateWriter<Gps>("gps");
+   gps_writer_ = talker_node->CreateWriter<Gps>("gps");
+   
+   std::shared_ptr<apollo::cyber::Writer<InsStatus>> insstatus_writer_ = talker_node->CreateWriter<InsStatus>(FLAGS_ins_status_topic);
+   std::shared_ptr<apollo::cyber::Writer<apollo::localization::CorrectedImu>> corrimu_writer_ = talker_node->CreateWriter<apollo::localization::CorrectedImu>(FLAGS_imu_topic);
    // 从节点创建一个Topic,来实现对车速的查看
    // 从节点创建一个Topic,来实现对车速的查看
 //   auto talker = talker_node->CreateWriter<Car>("car_speed");
 //   auto talker = talker_node->CreateWriter<Car>("car_speed");
 //   AINFO << "I'll start telling you the current speed of the car.";
 //   AINFO << "I'll start telling you the current speed of the car.";

+ 5 - 5
src/python/cameradecision/cameradecision.py

@@ -36,17 +36,17 @@ class CameraDecision:
         self.mvehwidth = 2.3  #从车宽
         self.mvehwidth = 2.3  #从车宽
         pass
         pass
 
 
-    def CalcDecision(xobjarray : cameraobjectarray_pb2.cameraobjectarray):
+    def CalcDecision(self,xobjarray : cameraobjectarray_pb2.cameraobjectarray):
 
 
         nobjsize = len(xobjarray.obj)
         nobjsize = len(xobjarray.obj)
         for pobj in xobjarray.obj:
         for pobj in xobjarray.obj:
             print(f"type: {pobj.type} x : {pobj.x} y: {pobj.y}");   #获取摄像头感知结果的方法,其它数据可以查看proto文件用pobj.{名称}获取
             print(f"type: {pobj.type} x : {pobj.x} y: {pobj.y}");   #获取摄像头感知结果的方法,其它数据可以查看proto文件用pobj.{名称}获取
 
 
-        acc = 0.0   #加速度数值,m/s2
+        acc = 0.0   #加速度数值,m/s2  >0 加速  <0 制动
         wheel = 0.0   #方向盘转角,>0 左转  <0 右转 -430----430
         wheel = 0.0   #方向盘转角,>0 左转  <0 右转 -430----430
         speed = 0.0  #车速
         speed = 0.0  #车速
-        leftLamp = False
-        rightLamp = False
+        leftLamp = False   #左转向灯
+        rightLamp = False  #右转向灯
 
 
         ### 在此编写代码给出决策数值
         ### 在此编写代码给出决策数值
         ### 在此编写代码给出决策数值
         ### 在此编写代码给出决策数值
@@ -158,4 +158,4 @@ class CameraDecision:
         #//转换为度 DD
         #//转换为度 DD
         longitude = longitude1 / iPI
         longitude = longitude1 / iPI
         latitude = latitude1 / iPI
         latitude = latitude1 / iPI
-        return longitude,latitude
+        return longitude,latitude