25using ::apollo::drivers::canbus::Byte;
34 static const uint32_t PERIOD = 20 * 1000;
39 set_p_brake_torque(data, brake_torque_);
40 set_p_brake_enable_control(data, brake_enable_control_);
50 brake_torque_ = brake_torque;
57void Brakecontrola4::set_p_brake_torque(uint8_t* data,
double brake_torque) {
58 brake_torque = ProtocolData::BoundedValue(0.0, 100.0, brake_torque);
59 int x =
static_cast<int>(brake_torque / 0.050000);
62 t =
static_cast<uint8_t
>(x & 0xFF);
63 Byte to_set0(data + 1);
64 to_set0.set_value(t, 0, 8);
67 t =
static_cast<uint8_t
>(x & 0xFF);
68 Byte to_set1(data + 2);
69 to_set1.set_value(t, 0, 8);
74 brake_enable_control_ = brake_enable_control;
83void Brakecontrola4::set_p_brake_enable_control(
86 int x = brake_enable_control;
88 Byte to_set(data + 0);
89 to_set.set_value(
static_cast<uint8_t
>(x), 0, 8);