#include #include "Protocol.pb.h" #include "../common/comm.h" #include "./include/EgoInterface.h" #include "EgoClient.h" #include "radar_sim.h" CRadarSim::CRadarSim(CEgoClient* radar) :_radar(radar) { } void CRadarSim::Start() { } void CRadarSim::Stop() { } void CRadarSim::OnPeerMessage(int16_t cmd, int16_t length, const void* data) { RemoNet::CCSensor Req; Req.ParseFromArray(data, length); //金川使用角度传感器提供的支腿高度 // 大冶使用的是拉线传感器提供的支腿高度 // 此处注释掉了使用角度传感器的方式 //_radar->OnEncodeData(Req.left_encode(), Req.right_encode()); RemoNet::CCRadarMessage ReqRadar; ReqRadar.ParseFromArray(data, length); _radar->OnRadarData(ReqRadar.radar0(), ReqRadar.radar1(), ReqRadar.radar2(), ReqRadar.radar3(), ReqRadar.radar4(), ReqRadar.radar5(), ReqRadar.radar6(), ReqRadar.radar7(), ReqRadar.radar8()); /* int32_t range[9] = { 0 }; int32_t count = Req.node_size(); for (int32_t i = 0; i < count; i++) { //range[i] = Req.range(i); auto& n = Req.node(i); range[n.id()] = n.range(); } //_radar->OnRadarData(range[0], range[1], range[2], range[3], range[4], range[5],range[6],range[7],range[8]); */ }