24using ::apollo::drivers::canbus::Byte;
33 static const uint32_t PERIOD = 20 * 1000;
38 set_p_pc_accpedreq(data, pc_accpedreq_);
39 set_p_pc_accpedenable(data, pc_accpedenable_);
40 set_p_pc_torqreq(data, pc_torqreq_);
41 set_p_pc_torqenable(data, pc_torqenable_);
42 set_p_pc_gearreq(data, pc_gearreq_);
43 set_p_pc_gearenable(data, pc_gearenable_);
57 pc_accpedreq_ = pc_accpedreq;
65void Pcvcu205::set_p_pc_accpedreq(uint8_t* data,
double pc_accpedreq) {
66 pc_accpedreq = ProtocolData::BoundedValue(0.0, 100.0, pc_accpedreq);
67 int x =
static_cast<int>(pc_accpedreq / 0.050000);
71 Byte to_set0(data + 2);
72 to_set0.set_value(t, 4, 4);
75 t =
static_cast<uint8_t
>(x & 0xFF);
76 Byte to_set1(data + 1);
77 to_set1.set_value(t, 0, 8);
82 pc_accpedenable_ = pc_accpedenable;
91void Pcvcu205::set_p_pc_accpedenable(
93 int x = pc_accpedenable;
95 Byte to_set(data + 0);
96 to_set.set_value(
static_cast<uint8_t
>(x), 6, 1);
100 pc_torqreq_ = pc_torqreq;
108void Pcvcu205::set_p_pc_torqreq(uint8_t* data,
double pc_torqreq) {
109 pc_torqreq = ProtocolData::BoundedValue(-3000.0, 3000.0, pc_torqreq);
110 int x =
static_cast<int>((pc_torqreq - -3000.000000) / 1.500000);
113 t =
static_cast<uint8_t
>(x & 0xFF);
114 Byte to_set0(data + 3);
115 to_set0.set_value(t, 0, 8);
119 Byte to_set1(data + 2);
120 to_set1.set_value(t, 0, 4);
125 pc_torqenable_ = pc_torqenable;
134void Pcvcu205::set_p_pc_torqenable(
136 int x = pc_torqenable;
138 Byte to_set(data + 0);
139 to_set.set_value(
static_cast<uint8_t
>(x), 5, 1);
143 pc_gearreq_ = pc_gearreq;
153void Pcvcu205::set_p_pc_gearreq(uint8_t* data,
157 Byte to_set(data + 0);
158 to_set.set_value(
static_cast<uint8_t
>(x), 0, 3);
163 pc_gearenable_ = pc_gearenable;
172void Pcvcu205::set_p_pc_gearenable(
174 int x = pc_gearenable;
176 Byte to_set(data + 0);
177 to_set.set_value(
static_cast<uint8_t
>(x), 7, 1);
Pcvcu205 * set_pc_gearenable(Pc_vcu_205::Pc_gearenableType pc_gearenable)
uint32_t GetPeriod() const override
Pcvcu205 * set_pc_torqreq(double pc_torqreq)
Pcvcu205 * set_pc_gearreq(Pc_vcu_205::Pc_gearreqType pc_gearreq)
Pcvcu205 * set_pc_accpedenable(Pc_vcu_205::Pc_accpedenableType pc_accpedenable)
Pcvcu205 * set_pc_accpedreq(double pc_accpedreq)
Pcvcu205 * set_pc_torqenable(Pc_vcu_205::Pc_torqenableType pc_torqenable)
void UpdateData(uint8_t *data) override
@ PC_ACCPEDENABLE_DISABLE