//#include #include #include #include #include "cyber/cyber.h" #include "cyber/time/rate.h" #include "cyber/time/time.h" #include "adchassis.h" #include static Adchassis * gpChassis; static chassisfun gchassisfun; static std::shared_ptr> chassis_writer_; static std::shared_ptr> can0recv_reader_; void RecvCANMsg(const std::shared_ptr &xmsg) { gpChassis->ProcCANMsg(*xmsg); } void ChassisCallBack(iv::chassis * pchassis) { iv::chassis* raw_ptr = new iv::chassis(); raw_ptr->CopyFrom(*pchassis); std::shared_ptr chassis_ptr(raw_ptr); chassis_writer_->Write(chassis_ptr); } int main(int argc, char *argv[]) { // QCoreApplication a(argc, argv); apollo::cyber::Init("apollochassis"); std::unique_ptr pilot_node = apollo::cyber::CreateNode("apollochassis"); gchassisfun = std::bind(&ChassisCallBack,std::placeholders::_1); chassis_writer_ = pilot_node->CreateWriter("/adc/chassis"); can0recv_reader_ = pilot_node->CreateReader( "/adc/canrecv0", [](const std::shared_ptr &xmsg) { RecvCANMsg(xmsg); }); std::string strvehtype = std::string("SHENLAN_CANFD"); gpChassis = new Adchassis(&gchassisfun,strvehtype); apollo::cyber::WaitForShutdown(); delete gpChassis; return 0; }