52int main(
int argc,
char** argv) {
59 using std::this_thread::sleep_for;
61 google::ParseCommandLineFlags(&argc, &argv,
true);
63 FLAGS_alsologtostderr =
true;
66 if (!GetProtoFromFile(FLAGS_chassis_test_file, &chassis)) {
67 AERROR <<
"failed to load file: " << FLAGS_chassis_test_file;
71 LocalizationEstimate localization;
72 if (!GetProtoFromFile(FLAGS_localization_test_file, &localization)) {
73 AERROR <<
"failed to load file: " << FLAGS_localization_test_file;
78 if (!GetProtoFromFile(FLAGS_pad_msg_test_file, &pad_msg)) {
79 AERROR <<
"failed to load file: " << FLAGS_pad_msg_test_file;
83 ADCTrajectory trajectory;
84 if (!GetProtoFromFile(FLAGS_planning_test_file, &trajectory)) {
85 AERROR <<
"failed to load file: " << FLAGS_planning_test_file;
89 std::shared_ptr<apollo::cyber::Node> node(
91 auto chassis_writer = node->CreateWriter<Chassis>(FLAGS_chassis_topic);
92 auto localization_writer =
93 node->CreateWriter<LocalizationEstimate>(FLAGS_localization_topic);
94 auto pad_msg_writer = node->CreateWriter<PadMessage>(FLAGS_pad_topic);
95 auto planning_writer =
96 node->CreateWriter<ADCTrajectory>(FLAGS_planning_trajectory_topic);
98 for (
int i = 0; i < FLAGS_num_seconds * FLAGS_feed_frequency; ++i) {
99 chassis_writer->Write(chassis);
100 localization_writer->Write(localization);
101 pad_msg_writer->Write(pad_msg);
102 planning_writer->Write(trajectory);
103 sleep_for(std::chrono::milliseconds(1000 / FLAGS_feed_frequency));
105 AINFO <<
"Successfully fed proto files.";
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,...