Apollo 10.0
自动驾驶开放平台
neolix_edu_controller.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19#include "modules/common_msgs/basic_msgs/vehicle_signal.pb.h"
20
21#include "cyber/common/log.h"
22#include "cyber/time/time.h"
27
28namespace apollo {
29namespace canbus {
30namespace neolix_edu {
31
32using ::apollo::common::ErrorCode;
33using ::apollo::common::VehicleSignal;
34using ::apollo::control::ControlCommand;
35using ::apollo::drivers::canbus::ProtocolData;
36
37namespace {
38
39const int32_t kMaxFailAttempt = 10;
40const int32_t CHECK_RESPONSE_STEER_UNIT_FLAG = 1;
41const int32_t CHECK_RESPONSE_SPEED_UNIT_FLAG = 2;
42} // namespace
43
45 can_sender_->AddMessage(Adsbrakecommand46::ID, ads_brake_command_46_, false);
46 can_sender_->AddMessage(Adsdiagnosis628::ID, ads_diagnosis_628_, false);
47 can_sender_->AddMessage(Adsdrivecommand50::ID, ads_drive_command_50_, false);
48 can_sender_->AddMessage(Adsepscommand56::ID, ads_eps_command_56_, false);
50 ads_light_horn_command_310_, false);
51}
52
54 const VehicleParameter& params,
55 CanSender<::apollo::canbus::Neolix_edu>* const can_sender,
56 MessageManager<::apollo::canbus::Neolix_edu>* const message_manager) {
57 if (is_initialized_) {
58 AINFO << "Neolix_eduController has already been initiated.";
59 return ErrorCode::CANBUS_ERROR;
60 }
61
62 vehicle_params_.CopyFrom(
63 common::VehicleConfigHelper::Instance()->GetConfig().vehicle_param());
64 params_.CopyFrom(params);
65 if (!params_.has_driving_mode()) {
66 AERROR << "Vehicle conf pb not set driving_mode.";
67 return ErrorCode::CANBUS_ERROR;
68 }
69
70 if (can_sender == nullptr) {
71 return ErrorCode::CANBUS_ERROR;
72 }
73 can_sender_ = can_sender;
74
75 if (message_manager == nullptr) {
76 AERROR << "protocol manager is null.";
77 return ErrorCode::CANBUS_ERROR;
78 }
79 message_manager_ = message_manager;
80
81 // sender part
82 ads_brake_command_46_ = dynamic_cast<Adsbrakecommand46*>(
83 message_manager_->GetMutableProtocolDataById(Adsbrakecommand46::ID));
84 if (ads_brake_command_46_ == nullptr) {
85 AERROR
86 << "Adsbrakecommand46 does not exist in the Neolix_eduMessageManager!";
87 return ErrorCode::CANBUS_ERROR;
88 }
89
90 ads_diagnosis_628_ = dynamic_cast<Adsdiagnosis628*>(
91 message_manager_->GetMutableProtocolDataById(Adsdiagnosis628::ID));
92 if (ads_diagnosis_628_ == nullptr) {
93 AERROR << "Adsdiagnosis628 does not exist in the Neolix_eduMessageManager!";
94 return ErrorCode::CANBUS_ERROR;
95 }
96
97 ads_drive_command_50_ = dynamic_cast<Adsdrivecommand50*>(
98 message_manager_->GetMutableProtocolDataById(Adsdrivecommand50::ID));
99 if (ads_drive_command_50_ == nullptr) {
100 AERROR
101 << "Adsdrivecommand50 does not exist in the Neolix_eduMessageManager!";
102 return ErrorCode::CANBUS_ERROR;
103 }
104
105 ads_eps_command_56_ = dynamic_cast<Adsepscommand56*>(
106 message_manager_->GetMutableProtocolDataById(Adsepscommand56::ID));
107 if (ads_eps_command_56_ == nullptr) {
108 AERROR << "Adsepscommand56 does not exist in the Neolix_eduMessageManager!";
109 return ErrorCode::CANBUS_ERROR;
110 }
111
112 ads_light_horn_command_310_ = dynamic_cast<Adslighthorncommand310*>(
113 message_manager_->GetMutableProtocolDataById(Adslighthorncommand310::ID));
114 if (ads_light_horn_command_310_ == nullptr) {
115 AERROR << "Adslighthorncommand310 does not exist in the "
116 "Neolix_eduMessageManager!";
117 return ErrorCode::CANBUS_ERROR;
118 }
119
121
122 AINFO << "Neolix_eduController is initialized.";
123
124 is_initialized_ = true;
125 return ErrorCode::OK;
126}
127
129
131 if (!is_initialized_) {
132 AERROR << "Neolix_eduController has NOT been initiated.";
133 return false;
134 }
135 const auto& update_func = [this] { SecurityDogThreadFunc(); };
136 thread_.reset(new std::thread(update_func));
137
138 return true;
139}
140
142 if (!is_initialized_) {
143 AERROR << "Neolix_eduController stops or starts improperly!";
144 return;
145 }
146
147 if (thread_ != nullptr && thread_->joinable()) {
148 thread_->join();
149 thread_.reset();
150 AINFO << "Neolix_eduController stopped.";
151 }
152}
153
155 chassis_.Clear();
156
157 Neolix_edu chassis_detail = GetNewRecvChassisDetail();
158
159 // 1, 2
160 // if (driving_mode() == Chassis::EMERGENCY_MODE) {
161 // set_chassis_error_code(Chassis::NO_ERROR);
162 // }
163
164 chassis_.set_driving_mode(driving_mode());
165 chassis_.set_error_code(chassis_error_code());
166
167 // 3
168 chassis_.set_engine_started(true);
169
170 // 3 speed_mps
171 if (chassis_detail.has_aeb_frontwheelspeed_353() &&
172 chassis_detail.has_aeb_rearwheelspeed_354()) {
173 auto wheelspeed = chassis_.mutable_wheel_speed();
174 wheelspeed->set_wheel_spd_fl(
175 chassis_detail.aeb_frontwheelspeed_353().wheelspeed_fl());
176 wheelspeed->set_wheel_spd_fr(
177 chassis_detail.aeb_frontwheelspeed_353().wheelspeed_fr());
178 wheelspeed->set_wheel_spd_rl(
179 chassis_detail.aeb_rearwheelspeed_354().wheelspeed_rl());
180 wheelspeed->set_wheel_spd_rr(
181 chassis_detail.aeb_rearwheelspeed_354().wheelspeed_rr());
182 chassis_.set_speed_mps(
183 (chassis_detail.aeb_frontwheelspeed_353().wheelspeed_fl() +
184 chassis_detail.aeb_frontwheelspeed_353().wheelspeed_fr() +
185 chassis_detail.aeb_rearwheelspeed_354().wheelspeed_rl() +
186 chassis_detail.aeb_rearwheelspeed_354().wheelspeed_rr()) /
187 4 / 3.6);
188 } else {
189 chassis_.set_speed_mps(0);
190 }
191 // 4 SOC
192 if (chassis_detail.has_vcu_vehicle_status_report_101() &&
193 chassis_detail.vcu_vehicle_status_report_101().has_vcu_display_soc()) {
194 chassis_.set_battery_soc_percentage(
196 } else {
197 chassis_.set_battery_soc_percentage(0);
198 }
199 // 5 steering
200 if (chassis_detail.has_vcu_eps_report_57() &&
201 chassis_detail.vcu_eps_report_57().has_vcu_real_angle()) {
202 chassis_.set_steering_percentage(static_cast<float>(
203 chassis_detail.vcu_eps_report_57().vcu_real_angle() * 100 /
204 vehicle_params_.max_steer_angle() * M_PI / 180));
205 } else {
206 chassis_.set_steering_percentage(0);
207 }
208
209 // 6 throttle
210 if (chassis_detail.has_vcu_drive_report_52() &&
211 chassis_detail.vcu_drive_report_52().has_vcu_real_torque()) {
212 chassis_.set_throttle_percentage(
213 chassis_detail.vcu_drive_report_52().vcu_real_torque() * 2);
214 } else {
215 chassis_.set_throttle_percentage(0);
216 }
217
218 // 7 brake
219 if (chassis_detail.has_vcu_brake_report_47() &&
220 chassis_detail.vcu_brake_report_47().has_vcu_real_brake()) {
221 chassis_.set_brake_percentage(
222 chassis_detail.vcu_brake_report_47().vcu_real_brake());
223 } else {
224 chassis_.set_brake_percentage(0);
225 }
226 // 8 gear
227 if (chassis_detail.has_vcu_drive_report_52() &&
228 chassis_detail.vcu_drive_report_52().has_vcu_real_shift()) {
229 chassis_.set_gear_location((apollo::canbus::Chassis_GearPosition)
230 chassis_detail.vcu_drive_report_52()
231 .vcu_real_shift());
232 }
233 // 9 epb
234 if (chassis_detail.has_vcu_brake_report_47() &&
235 chassis_detail.vcu_brake_report_47().has_vcu_real_parking_status()) {
236 if (chassis_detail.vcu_brake_report_47().vcu_real_parking_status() == 1) {
237 chassis_.set_parking_brake(true);
238 } else {
239 chassis_.set_parking_brake(false);
240 }
241 } else {
242 chassis_.set_parking_brake(false);
243 }
244
245 if (chassis_error_mask_) {
246 chassis_.set_chassis_error_mask(chassis_error_mask_);
247 }
248
249 // 10 give engage_advice based on error_code and canbus feedback
250 if (!chassis_error_mask_ && !chassis_.parking_brake() &&
251 (chassis_.throttle_percentage() == 0.0)) {
252 chassis_.mutable_engage_advice()->set_advice(
254 } else {
255 chassis_.mutable_engage_advice()->set_advice(
257 }
258
259 // 11 bumper event
260 if (chassis_detail.has_vcu_brake_report_47() &&
261 chassis_detail.vcu_brake_report_47().has_vcu_ehb_brake_state()) {
262 if (chassis_detail.vcu_brake_report_47().vcu_ehb_brake_state() ==
264 chassis_.set_front_bumper_event(Chassis::BUMPER_PRESSED);
265 chassis_.set_back_bumper_event(Chassis::BUMPER_PRESSED);
266 } else {
267 chassis_.set_front_bumper_event(Chassis::BUMPER_NORMAL);
268 chassis_.set_back_bumper_event(Chassis::BUMPER_NORMAL);
269 }
270 } else {
271 chassis_.set_front_bumper_event(Chassis::BUMPER_INVALID);
272 chassis_.set_back_bumper_event(Chassis::BUMPER_INVALID);
273 }
274
275 // 12 add checkresponse signal
276 if (chassis_detail.has_vcu_brake_report_47() &&
277 chassis_detail.vcu_brake_report_47().has_brake_enable_resp()) {
278 chassis_.mutable_check_response()->set_is_esp_online(
279 chassis_detail.vcu_brake_report_47().brake_enable_resp() == 1);
280 }
281 if (chassis_detail.has_vcu_drive_report_52() &&
282 chassis_detail.vcu_drive_report_52().has_drive_enable_resp()) {
283 chassis_.mutable_check_response()->set_is_vcu_online(
284 chassis_detail.vcu_drive_report_52().drive_enable_resp() == 1);
285 }
286 if (chassis_detail.has_vcu_eps_report_57() &&
287 chassis_detail.vcu_eps_report_57().has_drive_enable_resp()) {
288 chassis_.mutable_check_response()->set_is_eps_online(
289 chassis_detail.vcu_eps_report_57().drive_enable_resp() == 1);
290 }
291
292 if (CheckChassisError()) {
293 chassis_.mutable_engage_advice()->set_advice(
295 chassis_.mutable_engage_advice()->set_reason(
296 "Chassis has some fault, please check the chassis_detail.");
297 }
298
299 // check the chassis detail lost
301 chassis_.mutable_engage_advice()->set_advice(
303 chassis_.mutable_engage_advice()->set_reason(
304 "neolix chassis detail is lost! Please check the communication error.");
305 set_chassis_error_code(Chassis::CHASSIS_CAN_LOST);
307 }
308
309 return chassis_;
310}
311
312bool Neolix_eduController::VerifyID() { return true; }
313
314void Neolix_eduController::Emergency() {
316 ResetProtocol();
317}
318
319ErrorCode Neolix_eduController::EnableAutoMode() {
321 AINFO << "already in COMPLETE_AUTO_DRIVE mode";
322 return ErrorCode::OK;
323 }
324 // set enable
325 ads_brake_command_46_->set_drive_enable(true);
326 ads_drive_command_50_->set_drive_enable(true);
327 ads_eps_command_56_->set_drive_enable(true);
328
329 can_sender_->Update();
330 const int32_t flag =
331 CHECK_RESPONSE_STEER_UNIT_FLAG | CHECK_RESPONSE_SPEED_UNIT_FLAG;
332 if (!CheckResponse(flag, true)) {
333 AERROR << "Failed to switch to COMPLETE_AUTO_DRIVE mode. Please check the "
334 "emergency button or chassis.";
335 Emergency();
336 set_chassis_error_code(Chassis::CHASSIS_ERROR);
337 return ErrorCode::CANBUS_ERROR;
338 }
340 AINFO << "Switch to COMPLETE_AUTO_DRIVE mode ok.";
341 return ErrorCode::OK;
342}
343
344ErrorCode Neolix_eduController::DisableAutoMode() {
345 ResetProtocol();
346 can_sender_->Update();
348 set_chassis_error_code(Chassis::NO_ERROR);
349 AINFO << "Switch to COMPLETE_MANUAL ok.";
350 return ErrorCode::OK;
351}
352
353ErrorCode Neolix_eduController::EnableSteeringOnlyMode() {
357 AINFO << "Already in AUTO_STEER_ONLY mode.";
358 return ErrorCode::OK;
359 }
360 AFATAL << "SpeedOnlyMode is not supported in Neolix_edu!";
361 return ErrorCode::OK;
362}
363
364ErrorCode Neolix_eduController::EnableSpeedOnlyMode() {
368 AINFO << "Already in AUTO_SPEED_ONLY mode";
369 return ErrorCode::OK;
370 }
371 AFATAL << "SpeedOnlyMode is not supported in Neolix_edu!";
372 return ErrorCode::OK;
373}
374
375// NEUTRAL, REVERSE, DRIVE
376void Neolix_eduController::Gear(Chassis::GearPosition gear_position) {
379 AINFO << "This drive mode no need to set gear.";
380 return;
381 }
382 switch (gear_position) {
384 ads_drive_command_50_->set_auto_shift_command(
386 ads_brake_command_46_->set_auto_parking_command(false);
387 break;
388 }
390 ads_drive_command_50_->set_auto_shift_command(
392 break;
393 }
394 case Chassis::GEAR_DRIVE: {
395 ads_drive_command_50_->set_auto_shift_command(
397 break;
398 }
400 ads_brake_command_46_->set_auto_parking_command(true);
401 break;
402 }
403 default:
404 break;
405 }
406}
407
408// brake with pedal
409// pedal:0.00~99.99, unit:
410void Neolix_eduController::Brake(double pedal) {
411 // TODO(All) : Update brake value based on mode
414 AINFO << "The current drive mode does not need to set brake pedal.";
415 return;
416 }
417 ads_brake_command_46_->set_auto_brake_command(pedal);
418}
419
420// drive with old acceleration
421// gas:0.00~99.99 unit:
422void Neolix_eduController::Throttle(double pedal) {
425 AINFO << "The current drive mode does not need to set throttle pedal.";
426 return;
427 }
428 ads_drive_command_50_->set_auto_drive_torque(pedal / 2);
429}
430
431// confirm the car is driven by acceleration command or throttle/brake pedal
432// drive with acceleration/deceleration
433// acc:-7.0 ~ 5.0, unit:m/s^2
434void Neolix_eduController::Acceleration(double acc) {
435 // None
436}
437
438// neolix_edu default, -380 ~ 380, left:+, right:-
439// need to be compatible with control module, so reverse
440// steering with old angle speed
441// angle:-99.99~0.00~99.99, unit:, left:-, right:+
442void Neolix_eduController::Steer(double angle) {
445 AINFO << "The current driving mode does not need to set steer.";
446 return;
447 }
448 const double real_angle =
449 vehicle_params_.max_steer_angle() / M_PI * 180 * angle / 100.0;
450 ads_eps_command_56_->set_auto_target_angle(real_angle);
451}
452
453// steering with new angle speed
454// angle:-99.99~0.00~99.99, unit:, left:-, right:+
455// angle_spd:0.00~99.99, unit:deg/s
456void Neolix_eduController::Steer(double angle, double angle_spd) {
459 AINFO << "The current driving mode does not need to set steer.";
460 return;
461 }
462 const double real_angle =
463 vehicle_params_.max_steer_angle() / M_PI * 180 * angle / 100.0;
464 ads_eps_command_56_->set_auto_target_angle(real_angle);
465}
466
467void Neolix_eduController::SetEpbBreak(const ControlCommand& command) {
468 if (command.parking_brake()) {
469 ads_brake_command_46_->set_auto_parking_command(true);
470 } else {
471 ads_brake_command_46_->set_auto_parking_command(false);
472 }
473}
474
475ErrorCode Neolix_eduController::HandleCustomOperation(
476 const external_command::ChassisCommand& command) {
477 return ErrorCode::OK;
478}
479
480void Neolix_eduController::SetBeam(const VehicleSignal& vehicle_signal) {
481 if (vehicle_signal.high_beam()) {
482 // None
483 } else if (vehicle_signal.low_beam()) {
484 // None
485 } else {
486 // None
487 }
488}
489
490void Neolix_eduController::SetHorn(const VehicleSignal& vehicle_signal) {
491 if (vehicle_signal.horn()) {
492 // None
493 } else {
494 // None
495 }
496}
497
498void Neolix_eduController::SetTurningSignal(
499 const VehicleSignal& vehicle_signal) {
500 // None
501}
502
503void Neolix_eduController::ResetProtocol() {
504 message_manager_->ResetSendMessages();
505}
506
507bool Neolix_eduController::CheckChassisError() {
509 AERROR_EVERY(100) << "ChassisDetail has no neolix vehicle info.";
510 }
511 /* ADD YOUR OWN CAR CHASSIS OPERATION
512 */
513 return false;
514}
515
516void Neolix_eduController::SecurityDogThreadFunc() {
517 int32_t vertical_ctrl_fail = 0;
518 int32_t horizontal_ctrl_fail = 0;
519
520 if (can_sender_ == nullptr) {
521 AERROR << "Failed to run SecurityDogThreadFunc() because can_sender_ is "
522 "nullptr.";
523 return;
524 }
525 while (!can_sender_->IsRunning()) {
526 std::this_thread::yield();
527 }
528
529 std::chrono::duration<double, std::micro> default_period{50000};
530 int64_t start = 0;
531 int64_t end = 0;
532 while (can_sender_->IsRunning()) {
534 const Chassis::DrivingMode mode = driving_mode();
535 bool emergency_mode = false;
536
537 // 1. horizontal control check
538 if ((mode == Chassis::COMPLETE_AUTO_DRIVE ||
539 mode == Chassis::AUTO_STEER_ONLY) &&
540 CheckResponse(CHECK_RESPONSE_STEER_UNIT_FLAG, false) == false) {
541 ++horizontal_ctrl_fail;
542 if (horizontal_ctrl_fail >= kMaxFailAttempt) {
543 emergency_mode = true;
544 AERROR << "Driving_mode is into emergency by steer manual intervention";
545 set_chassis_error_code(Chassis::MANUAL_INTERVENTION);
546 }
547 } else {
548 horizontal_ctrl_fail = 0;
549 }
550
551 // 2. vertical control check
552 if ((mode == Chassis::COMPLETE_AUTO_DRIVE ||
553 mode == Chassis::AUTO_SPEED_ONLY) &&
554 !CheckResponse(CHECK_RESPONSE_SPEED_UNIT_FLAG, false)) {
555 ++vertical_ctrl_fail;
556 if (vertical_ctrl_fail >= kMaxFailAttempt) {
557 emergency_mode = true;
558 AERROR << "Driving_mode is into emergency by speed manual intervention";
559 set_chassis_error_code(Chassis::MANUAL_INTERVENTION);
560 }
561 } else {
562 vertical_ctrl_fail = 0;
563 }
564
565 // 3. chassis fault check
566 if (CheckChassisError()) {
567 set_chassis_error_code(Chassis::CHASSIS_ERROR);
568 emergency_mode = true;
569 }
570
571 // chassis error process
572 if (emergency_mode && mode != Chassis::EMERGENCY_MODE) {
574 message_manager_->ResetSendMessages();
575 can_sender_->Update();
576 }
577
578 // recove error code
579 if (!emergency_mode && !is_chassis_communication_error_ &&
580 mode == Chassis::EMERGENCY_MODE) {
581 set_chassis_error_code(Chassis::NO_ERROR);
582 }
583
585 std::chrono::duration<double, std::micro> elapsed{end - start};
586 if (elapsed < default_period) {
587 std::this_thread::sleep_for(default_period - elapsed);
588 } else {
589 AERROR << "Too much time consumption in Neolix_eduController looping "
590 "process:"
591 << elapsed.count();
592 }
593 }
594}
595
596bool Neolix_eduController::CheckResponse(const int32_t flags, bool need_wait) {
597 int32_t retry_num = 20;
598 Neolix_edu chassis_detail;
599 bool is_eps_online = false;
600 bool is_vcu_online = false;
601 bool is_esp_online = false;
602
603 do {
604 bool check_ok = true;
605 if (flags & CHECK_RESPONSE_STEER_UNIT_FLAG) {
606 is_eps_online = chassis_.has_check_response() &&
607 chassis_.check_response().has_is_eps_online() &&
608 chassis_.check_response().is_eps_online();
609 check_ok = check_ok && is_eps_online;
610 }
611
612 if (flags & CHECK_RESPONSE_SPEED_UNIT_FLAG) {
613 is_vcu_online = chassis_.has_check_response() &&
614 chassis_.check_response().has_is_vcu_online() &&
615 chassis_.check_response().is_vcu_online();
616 is_esp_online = chassis_.has_check_response() &&
617 chassis_.check_response().has_is_esp_online() &&
618 chassis_.check_response().is_esp_online();
619 check_ok = check_ok && is_vcu_online && is_esp_online;
620 }
621 if (check_ok) {
622 return true;
623 } else {
624 AINFO << "Need to check response again.";
625 }
626 if (need_wait) {
627 --retry_num;
628 std::this_thread::sleep_for(
629 std::chrono::duration<double, std::milli>(20));
630 }
631 } while (need_wait && retry_num);
632
633 if (flags & CHECK_RESPONSE_STEER_UNIT_FLAG) {
634 AERROR << "steer check_response fail: is_eps_online:" << is_eps_online;
635 }
636
637 if (flags & CHECK_RESPONSE_SPEED_UNIT_FLAG) {
638 AERROR << "speed check_response fail: " << "is_vcu_online:" << is_vcu_online
639 << ", is_esp_online:" << is_esp_online;
640 }
641
642 return false;
643}
644
645void Neolix_eduController::set_chassis_error_mask(const int32_t mask) {
646 std::lock_guard<std::mutex> lock(chassis_mask_mutex_);
647 chassis_error_mask_ = mask;
648}
649
650int32_t Neolix_eduController::chassis_error_mask() {
651 std::lock_guard<std::mutex> lock(chassis_mask_mutex_);
652 return chassis_error_mask_;
653}
654
655Chassis::ErrorCode Neolix_eduController::chassis_error_code() {
656 std::lock_guard<std::mutex> lock(chassis_error_code_mutex_);
657 return chassis_error_code_;
658}
659
660void Neolix_eduController::set_chassis_error_code(
661 const Chassis::ErrorCode& error_code) {
662 std::lock_guard<std::mutex> lock(chassis_error_code_mutex_);
663 chassis_error_code_ = error_code;
664}
665
666} // namespace neolix_edu
667} // namespace canbus
668} // namespace apollo
Defines SenderMessage class and CanSender class.
virtual void set_driving_mode(const Chassis::DrivingMode &driving_mode)
MessageManager< ::apollo::canbus::Neolix_edu > * message_manager_
Adsbrakecommand46 * set_auto_brake_command(int auto_brake_command)
Adsbrakecommand46 * set_drive_enable(bool drive_enable)
Adsbrakecommand46 * set_auto_parking_command(bool auto_parking_command)
Adsdrivecommand50 * set_auto_drive_torque(double auto_drive_torque)
Adsdrivecommand50 * set_auto_shift_command(Ads_drive_command_50::Auto_shift_commandType auto_shift_command)
Adsdrivecommand50 * set_drive_enable(bool drive_enable)
Adsepscommand56 * set_drive_enable(bool drive_enable)
Adsepscommand56 * set_auto_target_angle(double auto_target_angle)
void Stop() override
stop the vehicle controller.
void AddSendMessage() override
add the sender message.
Chassis chassis() override
calculate and return the chassis.
bool Start() override
start the vehicle controller.
::apollo::common::ErrorCode Init(const VehicleParameter &params, CanSender<::apollo::canbus::Neolix_edu > *const can_sender, MessageManager<::apollo::canbus::Neolix_edu > *const message_manager) override
uint64_t ToMicrosecond() const
convert time to microsecond (us).
Definition time.cc:85
static Time Now()
get the current time.
Definition time.cc:57
#define AERROR
Definition log.h:44
#define AERROR_EVERY(freq)
Definition log.h:86
#define AFATAL
Definition log.h:45
#define AINFO
Definition log.h:42
class register implement
Definition arena_queue.h:37
The class of ProtocolData
optional CheckResponse check_response
optional bool parking_brake
Definition chassis.proto:94
optional float throttle_percentage
Definition chassis.proto:79
optional Vcu_drive_report_52 vcu_drive_report_52
optional Vcu_eps_report_57 vcu_eps_report_57
optional Aeb_frontwheelspeed_353 aeb_frontwheelspeed_353
optional Aeb_rearwheelspeed_354 aeb_rearwheelspeed_354
optional Vcu_vehicle_status_report_101 vcu_vehicle_status_report_101
optional Vcu_brake_report_47 vcu_brake_report_47
optional Vcu_ehb_brakeType vcu_ehb_brake_state
optional Vcu_real_shiftType vcu_real_shift
The class of VehicleController