Apollo 10.0
自动驾驶开放平台
canbus_tester.cc 文件参考
#include <thread>
#include "cyber/common/file.h"
#include "cyber/common/log.h"
#include "cyber/cyber.h"
#include "cyber/time/rate.h"
#include "gflags/gflags.h"
#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
#include "modules/canbus/common/canbus_gflags.h"
#include "modules/common/adapters/adapter_gflags.h"
canbus_tester.cc 的引用(Include)关系图:

浏览源代码.

函数

int main (int32_t argc, char **argv)
 

函数说明

◆ main()

int main ( int32_t  argc,
char **  argv 
)

在文件 canbus_tester.cc 第 34 行定义.

34 {
35 google::InitGoogleLogging(argv[0]);
36 google::ParseCommandLineFlags(&argc, &argv, true);
37 FLAGS_alsologtostderr = true;
38
39 // init cyber framework
40 apollo::cyber::Init("testing_canbus_tester");
41 std::shared_ptr<apollo::cyber::Node> node_(
42 apollo::cyber::CreateNode("canbus_tester"));
43 std::shared_ptr<Writer<ControlCommand>> control_command_writer_ =
44 node_->CreateWriter<ControlCommand>(FLAGS_control_command_topic);
45
46 ControlCommand control_cmd;
47 if (!apollo::cyber::common::GetProtoFromFile(FLAGS_canbus_test_file,
48 &control_cmd)) {
49 AERROR << "failed to load file: " << FLAGS_canbus_test_file;
50 return -1;
51 }
52
53 Rate rate(1.0); // frequency
54
55 while (apollo::cyber::OK()) {
56 // pub.publish(msg);
57 control_command_writer_->Write(control_cmd);
58 rate.Sleep();
59 }
60
61 return 0;
62}
#define AERROR
Definition log.h:44
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
bool Init(const char *binary_name, const std::string &dag_info)
Definition init.cc:98
bool OK()
Definition state.h:44
std::unique_ptr< Node > CreateNode(const std::string &node_name, const std::string &name_space)
Definition cyber.cc:33