25using ::apollo::drivers::canbus::Byte;
31 static const uint32_t PERIOD = 10 * 1000;
36 set_pedal_p(data, pedal_cmd_);
37 set_boo_cmd_p(data, boo_cmd_);
38 set_enable_p(data, pedal_enable_);
39 set_clear_driver_override_flag_p(data, clear_driver_override_flag_);
40 set_watchdog_counter_p(data, watchdog_counter_);
46 pedal_enable_ =
false;
47 clear_driver_override_flag_ =
false;
48 ignore_driver_override_ =
false;
49 watchdog_counter_ = 0;
54 if (pedal_cmd_ < 1e-3) {
62Brake60 *Brake60::enable_boo_cmd() {
67Brake60 *Brake60::disable_boo_cmd() {
78 pedal_enable_ =
false;
82void Brake60::set_pedal_p(uint8_t *data,
double pedal) {
86 pedal = ProtocolData::BoundedValue(0.0, 1.0, pedal);
87 int32_t x =
static_cast<int32_t
>(pedal / 1.52590218966964e-05);
90 t =
static_cast<uint8_t
>(x & 0xFF);
91 Byte frame_low(data + 0);
92 frame_low.set_value(t, 0, 8);
95 t =
static_cast<uint8_t
>(x & 0xFF);
96 Byte frame_high(data + 1);
97 frame_high.set_value(t, 0, 8);
100void Brake60::set_boo_cmd_p(uint8_t *bytes,
bool boo_cmd) {
101 Byte frame(bytes + 2);
109void Brake60::set_enable_p(uint8_t *bytes,
bool enable) {
110 Byte frame(bytes + 3);
118void Brake60::set_clear_driver_override_flag_p(uint8_t *bytes,
bool clear) {
119 Byte frame(bytes + 3);
127void Brake60::set_watchdog_counter_p(uint8_t *data, int32_t count) {
128 count = ProtocolData::BoundedValue(0, 255, count);
129 Byte frame(data + 7);
130 frame.set_value(
static_cast<uint8_t
>(count), 0, 8);
the class of Brake60 (for lincoln vehicle)
one of the protocol data of lincoln vehicle
Brake60 * set_pedal(double pcmd)
set pedal based on pedal command
uint32_t GetPeriod() const override
get the data period
Brake60 * set_enable()
set pedal_enable_ to true
void Reset() override
reset the private variables
Brake60 * set_disable()
set pedal_enable_ to false
void UpdateData(uint8_t *data) override
update the data