19#include "glog/logging.h"
28using ::apollo::drivers::canbus::Byte;
33 Lincoln *chassis_detail)
const {
34 chassis_detail->mutable_vehicle_spd()->set_lat_acc(
35 lateral_acceleration(bytes, length));
36 chassis_detail->mutable_vehicle_spd()->set_long_acc(
37 longitudinal_acceleration(bytes, length));
38 chassis_detail->mutable_vehicle_spd()->set_vert_acc(
39 vertical_acceleration(bytes, length));
42double Accel6b::lateral_acceleration(
const std::uint8_t *bytes,
43 const int32_t length)
const {
45 return parse_two_frames(bytes[0], bytes[1]);
48double Accel6b::longitudinal_acceleration(
const std::uint8_t *bytes,
49 const int32_t length)
const {
51 return parse_two_frames(bytes[2], bytes[3]);
54double Accel6b::vertical_acceleration(
const std::uint8_t *bytes,
55 const int32_t length)
const {
57 return parse_two_frames(bytes[4], bytes[5]);
60double Accel6b::parse_two_frames(
const std::uint8_t low_byte,
61 const std::uint8_t high_byte)
const {
62 Byte high_frame(&high_byte);
63 int32_t high = high_frame.get_byte(0, 8);
64 Byte low_frame(&low_byte);
65 int32_t low = low_frame.get_byte(0, 8);
66 int32_t value = (high << 8) | low;
70 return value * 0.010000;
the class of Accel6b (for lincoln vehicle)
virtual void Parse(const std::uint8_t *bytes, int32_t length, Lincoln *chassis_detail) const