repo_id
stringlengths 19
138
| file_path
stringlengths 32
200
| content
stringlengths 1
12.9M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_motioncontrollimits1_12_test.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/adc_motioncontrollimits1_12.h"
#include "gtest/gtest.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class Motioncontrollimits1_12_test : public ::testing::Test {
public:
virtual void SetUp() {}
protected:
Adcmotioncontrollimits112 controllimits_;
};
TEST_F(Motioncontrollimits1_12_test, General) {
uint8_t data[8] = {0x8f, 0x9e, 0xad, 0xbc, 0xcb, 0xda, 0xe9, 0xf8};
const double adc_cmd_throttlecommandlimit = 64.00;
const double adc_cmd_steeringrate = 3071.15;
const double adc_cmd_steerwheelanglelimit = 640.0;
const uint8_t equivalent_throttlecommandlimit = 0x80;
const uint8_t equivalent_steeringrate1 = 0xef;
const uint8_t equivalent_steeringrate2 = 0xef;
const uint8_t equivalent_steerwheelanglelimit = 0x80;
controllimits_.set_p_adc_cmd_throttlecommandlimit(
data, adc_cmd_throttlecommandlimit);
controllimits_.set_p_adc_cmd_steeringrate(data, adc_cmd_steeringrate);
controllimits_.set_p_adc_cmd_steerwheelanglelimit(
data, adc_cmd_steerwheelanglelimit);
EXPECT_EQ(data[3], equivalent_throttlecommandlimit);
EXPECT_EQ(data[0], equivalent_steeringrate1);
EXPECT_EQ(data[1], equivalent_steeringrate2);
EXPECT_EQ(data[2], equivalent_steerwheelanglelimit);
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_auxiliarycontrol_110_test.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/adc_auxiliarycontrol_110.h"
#include "gtest/gtest.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class Auxiliarycontrol_110_test : public ::testing::Test {
public:
virtual void SetUp() {}
protected:
Adcauxiliarycontrol110 control_;
};
TEST_F(Auxiliarycontrol_110_test, General) {
uint8_t data[8] = {0x8f, 0x9e, 0xad, 0xbc, 0xcb, 0xda, 0xe9, 0xf8};
const int adc_auxcontrol_counter = 2;
const int adc_auxcontrol_checksum = 127;
const bool adc_cmd_inverter_controlenable = 0;
const bool adc_cmd_inverter = 0;
const int adc_cmd_wiper = 5;
const bool adc_cmd_pdu_controlenable = 0;
const bool adc_cmd_pdu_ch8 = 0;
const bool adc_cmd_pdu_ch7 = 0;
const bool adc_cmd_pdu_ch6 = 0;
const bool adc_cmd_pdu_ch5 = 0;
const bool adc_cmd_pdu_ch4 = 0;
const bool adc_cmd_pdu_ch3 = 0;
const bool adc_cmd_pdu_ch2 = 0;
const bool adc_cmd_pdu_ch1 = 0;
const bool adc_cmd_hazardlights = 0;
const bool adc_cmd_highbeam = 0;
const bool adc_cmd_lowbeam = 0;
const bool adc_cmd_horn = 0;
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal =
Adc_auxiliarycontrol_110::ADC_CMD_TURNSIGNAL_RIGHT;
const uint8_t equivalent_6 = 0xa9;
const uint8_t equivalent_7 = 0x7f;
const uint8_t equivalent_0 = 0xb0;
const uint8_t equivalent_1 = 0x00;
const uint8_t equivalent_3 = 0xa2;
control_.set_p_adc_auxcontrol_counter(data, adc_auxcontrol_counter);
control_.set_p_adc_auxcontrol_checksum(data, adc_auxcontrol_checksum);
control_.set_p_adc_cmd_inverter_controlenable(data,
adc_cmd_inverter_controlenable);
control_.set_p_adc_cmd_inverter(data, adc_cmd_inverter);
control_.set_p_adc_cmd_wiper(data, adc_cmd_wiper);
control_.set_p_adc_cmd_pdu_controlenable(data, adc_cmd_pdu_controlenable);
control_.set_p_adc_cmd_pdu_ch8(data, adc_cmd_pdu_ch8);
control_.set_p_adc_cmd_pdu_ch7(data, adc_cmd_pdu_ch7);
control_.set_p_adc_cmd_pdu_ch6(data, adc_cmd_pdu_ch6);
control_.set_p_adc_cmd_pdu_ch5(data, adc_cmd_pdu_ch5);
control_.set_p_adc_cmd_pdu_ch4(data, adc_cmd_pdu_ch4);
control_.set_p_adc_cmd_pdu_ch3(data, adc_cmd_pdu_ch3);
control_.set_p_adc_cmd_pdu_ch2(data, adc_cmd_pdu_ch2);
control_.set_p_adc_cmd_pdu_ch1(data, adc_cmd_pdu_ch1);
control_.set_p_adc_cmd_hazardlights(data, adc_cmd_hazardlights);
control_.set_p_adc_cmd_highbeam(data, adc_cmd_highbeam);
control_.set_p_adc_cmd_lowbeam(data, adc_cmd_lowbeam);
control_.set_p_adc_cmd_horn(data, adc_cmd_horn);
control_.set_p_adc_cmd_turnsignal(data, adc_cmd_turnsignal);
EXPECT_EQ(data[6], equivalent_6);
EXPECT_EQ(data[7], equivalent_7);
EXPECT_EQ(data[0], equivalent_0);
EXPECT_EQ(data[1], equivalent_1);
EXPECT_EQ(data[3], equivalent_3);
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_auxiliarycontrol_110.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/adc_auxiliarycontrol_110.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
const int32_t Adcauxiliarycontrol110::ID = 0x110;
// public
Adcauxiliarycontrol110::Adcauxiliarycontrol110() { Reset(); }
uint32_t Adcauxiliarycontrol110::GetPeriod() const {
// TODO(All) : modify every protocol's period manually
static const uint32_t PERIOD = 10 * 1000;
return PERIOD;
}
void Adcauxiliarycontrol110::UpdateData(uint8_t* data) {
set_p_adc_auxcontrol_counter(data, adc_auxcontrol_counter_);
set_p_adc_auxcontrol_checksum(data, adc_auxcontrol_checksum_);
set_p_adc_cmd_inverter_controlenable(data, adc_cmd_inverter_controlenable_);
set_p_adc_cmd_inverter(data, adc_cmd_inverter_);
set_p_adc_cmd_wiper(data, adc_cmd_wiper_);
set_p_adc_cmd_pdu_controlenable(data, adc_cmd_pdu_controlenable_);
set_p_adc_cmd_pdu_ch8(data, adc_cmd_pdu_ch8_);
set_p_adc_cmd_pdu_ch7(data, adc_cmd_pdu_ch7_);
set_p_adc_cmd_pdu_ch6(data, adc_cmd_pdu_ch6_);
set_p_adc_cmd_pdu_ch5(data, adc_cmd_pdu_ch5_);
set_p_adc_cmd_pdu_ch4(data, adc_cmd_pdu_ch4_);
set_p_adc_cmd_pdu_ch3(data, adc_cmd_pdu_ch3_);
set_p_adc_cmd_pdu_ch2(data, adc_cmd_pdu_ch2_);
set_p_adc_cmd_pdu_ch1(data, adc_cmd_pdu_ch1_);
set_p_adc_cmd_hazardlights(data, adc_cmd_hazardlights_);
set_p_adc_cmd_highbeam(data, adc_cmd_highbeam_);
set_p_adc_cmd_lowbeam(data, adc_cmd_lowbeam_);
set_p_adc_cmd_horn(data, adc_cmd_horn_);
set_p_adc_cmd_turnsignal(data, adc_cmd_turnsignal_);
}
void Adcauxiliarycontrol110::Reset() {
// TODO(All) : you should check this manually
adc_auxcontrol_counter_ = 0;
adc_auxcontrol_checksum_ = 0;
adc_cmd_inverter_controlenable_ = false;
adc_cmd_inverter_ = false;
adc_cmd_wiper_ = 0;
adc_cmd_pdu_controlenable_ = false;
adc_cmd_pdu_ch8_ = false;
adc_cmd_pdu_ch7_ = false;
adc_cmd_pdu_ch6_ = false;
adc_cmd_pdu_ch5_ = false;
adc_cmd_pdu_ch4_ = false;
adc_cmd_pdu_ch3_ = false;
adc_cmd_pdu_ch2_ = false;
adc_cmd_pdu_ch1_ = false;
adc_cmd_hazardlights_ = false;
adc_cmd_highbeam_ = false;
adc_cmd_lowbeam_ = false;
adc_cmd_horn_ = false;
adc_cmd_turnsignal_ = Adc_auxiliarycontrol_110::ADC_CMD_TURNSIGNAL_NONE;
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_auxcontrol_counter(
int adc_auxcontrol_counter) {
adc_auxcontrol_counter_ = adc_auxcontrol_counter;
return this;
}
// config detail: {'description': 'Aux control heartbeat counter', 'offset':
// 0.0, 'precision': 1.0, 'len': 2, 'name': 'ADC_AuxControl_Counter',
// 'is_signed_var': False, 'physical_range': '[0|3]', 'bit': 54, 'type': 'int',
// 'order': 'intel', 'physical_unit': ''}
void Adcauxiliarycontrol110::set_p_adc_auxcontrol_counter(
uint8_t* data, int adc_auxcontrol_counter) {
adc_auxcontrol_counter =
ProtocolData::BoundedValue(0, 3, adc_auxcontrol_counter);
uint8_t x = static_cast<uint8_t>(adc_auxcontrol_counter);
Byte to_set(data + 6);
to_set.set_value(x, 6, 2);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_auxcontrol_checksum(
int adc_auxcontrol_checksum) {
adc_auxcontrol_checksum_ = adc_auxcontrol_checksum;
return this;
}
// config detail: {'description': 'Aux control checksum', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'name': 'ADC_AuxControl_Checksum',
// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
void Adcauxiliarycontrol110::set_p_adc_auxcontrol_checksum(
uint8_t* data, int adc_auxcontrol_checksum) {
adc_auxcontrol_checksum =
ProtocolData::BoundedValue(0, 255, adc_auxcontrol_checksum);
uint8_t x = static_cast<uint8_t>(adc_auxcontrol_checksum);
Byte to_set(data + 7);
to_set.set_value(x, 0, 8);
}
Adcauxiliarycontrol110*
Adcauxiliarycontrol110::set_adc_cmd_inverter_controlenable(
bool adc_cmd_inverter_controlenable) {
adc_cmd_inverter_controlenable_ = adc_cmd_inverter_controlenable;
return this;
}
// config detail: {'description': 'Control inverter override (default ON if not
// overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_Inverter_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_inverter_controlenable(
uint8_t* data, bool adc_cmd_inverter_controlenable) {
uint8_t x = adc_cmd_inverter_controlenable;
Byte to_set(data + 0);
to_set.set_value(x, 1, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_inverter(
bool adc_cmd_inverter) {
adc_cmd_inverter_ = adc_cmd_inverter;
return this;
}
// config detail: {'description': 'Control inverter', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Inverter', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'intel',
// 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_inverter(uint8_t* data,
bool adc_cmd_inverter) {
uint8_t x = adc_cmd_inverter;
Byte to_set(data + 0);
to_set.set_value(x, 2, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_wiper(
int adc_cmd_wiper) {
adc_cmd_wiper_ = adc_cmd_wiper;
return this;
}
// config detail: {'description': '(Reserved) Control wiper', 'offset': 0.0,
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_Wiper', 'is_signed_var': False,
// 'physical_range': '[0|3]', 'bit': 4, 'type': 'int', 'order': 'intel',
// 'physical_unit': ''}
void Adcauxiliarycontrol110::set_p_adc_cmd_wiper(uint8_t* data,
int adc_cmd_wiper) {
adc_cmd_wiper = ProtocolData::BoundedValue(0, 3, adc_cmd_wiper);
uint8_t x = static_cast<uint8_t>(adc_cmd_wiper);
Byte to_set(data + 0);
to_set.set_value(x, 4, 2);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_controlenable(
bool adc_cmd_pdu_controlenable) {
adc_cmd_pdu_controlenable_ = adc_cmd_pdu_controlenable;
return this;
}
// config detail: {'description': 'PDU Control Override (all channels default ON
// if not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_PDU_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_controlenable(
uint8_t* data, bool adc_cmd_pdu_controlenable) {
uint8_t x = adc_cmd_pdu_controlenable;
Byte to_set(data + 0);
to_set.set_value(x, 0, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch8(
bool adc_cmd_pdu_ch8) {
adc_cmd_pdu_ch8_ = adc_cmd_pdu_ch8;
return this;
}
// config detail: {'description': 'Control PDU Ch 8 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch8',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch8(uint8_t* data,
bool adc_cmd_pdu_ch8) {
uint8_t x = adc_cmd_pdu_ch8;
Byte to_set(data + 1);
to_set.set_value(x, 7, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch7(
bool adc_cmd_pdu_ch7) {
adc_cmd_pdu_ch7_ = adc_cmd_pdu_ch7;
return this;
}
// config detail: {'description': 'Control PDU Ch 7 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch7',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 14, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch7(uint8_t* data,
bool adc_cmd_pdu_ch7) {
uint8_t x = adc_cmd_pdu_ch7;
Byte to_set(data + 1);
to_set.set_value(x, 6, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch6(
bool adc_cmd_pdu_ch6) {
adc_cmd_pdu_ch6_ = adc_cmd_pdu_ch6;
return this;
}
// config detail: {'description': 'Control PDU Ch 6 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch6',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 13, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch6(uint8_t* data,
bool adc_cmd_pdu_ch6) {
uint8_t x = adc_cmd_pdu_ch6;
Byte to_set(data + 1);
to_set.set_value(x, 5, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch5(
bool adc_cmd_pdu_ch5) {
adc_cmd_pdu_ch5_ = adc_cmd_pdu_ch5;
return this;
}
// config detail: {'description': 'Control PDU Ch 5 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch5',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 12, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch5(uint8_t* data,
bool adc_cmd_pdu_ch5) {
uint8_t x = adc_cmd_pdu_ch5;
Byte to_set(data + 1);
to_set.set_value(x, 4, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch4(
bool adc_cmd_pdu_ch4) {
adc_cmd_pdu_ch4_ = adc_cmd_pdu_ch4;
return this;
}
// config detail: {'description': 'Control PDU Ch 4 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch4',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 11, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch4(uint8_t* data,
bool adc_cmd_pdu_ch4) {
uint8_t x = adc_cmd_pdu_ch4;
Byte to_set(data + 1);
to_set.set_value(x, 3, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch3(
bool adc_cmd_pdu_ch3) {
adc_cmd_pdu_ch3_ = adc_cmd_pdu_ch3;
return this;
}
// config detail: {'description': 'Control PDU Ch 3 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch3',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 10, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch3(uint8_t* data,
bool adc_cmd_pdu_ch3) {
uint8_t x = adc_cmd_pdu_ch3;
Byte to_set(data + 1);
to_set.set_value(x, 2, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch2(
bool adc_cmd_pdu_ch2) {
adc_cmd_pdu_ch2_ = adc_cmd_pdu_ch2;
return this;
}
// config detail: {'description': 'Control PDU Ch 2 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch2',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 9, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch2(uint8_t* data,
bool adc_cmd_pdu_ch2) {
uint8_t x = adc_cmd_pdu_ch2;
Byte to_set(data + 1);
to_set.set_value(x, 1, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_pdu_ch1(
bool adc_cmd_pdu_ch1) {
adc_cmd_pdu_ch1_ = adc_cmd_pdu_ch1;
return this;
}
// config detail: {'description': 'Control PDU Ch 1 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch1',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch1(uint8_t* data,
bool adc_cmd_pdu_ch1) {
uint8_t x = adc_cmd_pdu_ch1;
Byte to_set(data + 1);
to_set.set_value(x, 0, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_hazardlights(
bool adc_cmd_hazardlights) {
adc_cmd_hazardlights_ = adc_cmd_hazardlights;
return this;
}
// config detail: {'description': 'Control hazard lights', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HazardLights', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 28, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_hazardlights(
uint8_t* data, bool adc_cmd_hazardlights) {
uint8_t x = adc_cmd_hazardlights;
Byte to_set(data + 3);
to_set.set_value(x, 4, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_highbeam(
bool adc_cmd_highbeam) {
adc_cmd_highbeam_ = adc_cmd_highbeam;
return this;
}
// config detail: {'description': 'Control high beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HighBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 27, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_highbeam(uint8_t* data,
bool adc_cmd_highbeam) {
uint8_t x = adc_cmd_highbeam;
Byte to_set(data + 3);
to_set.set_value(x, 3, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_lowbeam(
bool adc_cmd_lowbeam) {
adc_cmd_lowbeam_ = adc_cmd_lowbeam;
return this;
}
// config detail: {'description': 'Control low beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_LowBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 26, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_lowbeam(uint8_t* data,
bool adc_cmd_lowbeam) {
uint8_t x = adc_cmd_lowbeam;
Byte to_set(data + 3);
to_set.set_value(x, 2, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_horn(
bool adc_cmd_horn) {
adc_cmd_horn_ = adc_cmd_horn;
return this;
}
// config detail: {'description': 'Control horn', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Horn', 'is_signed_var': False,
// 'physical_range': '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'intel',
// 'physical_unit': 'T/F'}
void Adcauxiliarycontrol110::set_p_adc_cmd_horn(uint8_t* data,
bool adc_cmd_horn) {
uint8_t x = adc_cmd_horn;
Byte to_set(data + 0);
to_set.set_value(x, 3, 1);
}
Adcauxiliarycontrol110* Adcauxiliarycontrol110::set_adc_cmd_turnsignal(
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal) {
adc_cmd_turnsignal_ = adc_cmd_turnsignal;
return this;
}
// config detail: {'description': 'Requested turn signals', 'enum': {0:
// 'ADC_CMD_TURNSIGNAL_NONE', 1: 'ADC_CMD_TURNSIGNAL_LEFT', 2:
// 'ADC_CMD_TURNSIGNAL_RIGHT', 3: 'ADC_CMD_TURNSIGNAL_RESERVE'},
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_TurnSignal', 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 24, 'type': 'enum',
// 'order': 'intel', 'physical_unit': ''}
void Adcauxiliarycontrol110::set_p_adc_cmd_turnsignal(
uint8_t* data,
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal) {
uint8_t x = adc_cmd_turnsignal;
Byte to_set(data + 3);
to_set.set_value(x, 0, 2);
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_diag_steeringcontrol_722.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace transit {
class Llcdiagsteeringcontrol722
: public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Llcdiagsteeringcontrol722();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 0.0002, 'len': 16, 'name':
// 'LLC_DBG_SteeringSensorPosition', 'is_signed_var': True, 'physical_range':
// '[-6.5536|6.5534]', 'bit': 40, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'rev'}
Llcdiagsteeringcontrol722* set_llc_dbg_steeringsensorposition(
double llc_dbg_steeringsensorposition);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 1.0, 'len': 16, 'name':
// 'LLC_DBG_SteeringRackInputTorque', 'is_signed_var': True, 'physical_range':
// '[-32768|32767]', 'bit': 24, 'type': 'int', 'order': 'intel',
// 'physical_unit': 'counts'}
Llcdiagsteeringcontrol722* set_llc_dbg_steeringrackinputtorque(
int llc_dbg_steeringrackinputtorque);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 1e-05, 'len': 24, 'name':
// 'LLC_DBG_SteeringMotorPosition', 'is_signed_var': True, 'physical_range':
// '[-83.88608|83.88607]', 'bit': 0, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'rev'}
Llcdiagsteeringcontrol722* set_llc_dbg_steeringmotorposition(
double llc_dbg_steeringmotorposition);
private:
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 0.0002, 'len': 16, 'name':
// 'LLC_DBG_SteeringSensorPosition', 'is_signed_var': True, 'physical_range':
// '[-6.5536|6.5534]', 'bit': 40, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'rev'}
void set_p_llc_dbg_steeringsensorposition(
uint8_t* data, double llc_dbg_steeringsensorposition);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 1.0, 'len': 16, 'name':
// 'LLC_DBG_SteeringRackInputTorque', 'is_signed_var': True, 'physical_range':
// '[-32768|32767]', 'bit': 24, 'type': 'int', 'order': 'intel',
// 'physical_unit': 'counts'}
void set_p_llc_dbg_steeringrackinputtorque(
uint8_t* data, int llc_dbg_steeringrackinputtorque);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 1e-05, 'len': 24, 'name':
// 'LLC_DBG_SteeringMotorPosition', 'is_signed_var': True, 'physical_range':
// '[-83.88608|83.88607]', 'bit': 0, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'rev'}
void set_p_llc_dbg_steeringmotorposition(
uint8_t* data, double llc_dbg_steeringmotorposition);
private:
double llc_dbg_steeringsensorposition_;
int llc_dbg_steeringrackinputtorque_;
double llc_dbg_steeringmotorposition_;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_motioncommandfeedback1_22.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "gtest/gtest_prod.h"
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace transit {
class Llcmotioncommandfeedback122
: public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Llcmotioncommandfeedback122();
void Parse(const std::uint8_t* bytes, int32_t length,
Transit* chassis) const override;
FRIEND_TEST(Motioncommandfeedback1_22_test, General);
private:
// config detail: {'description': 'Steering angle setpoint (after limits)',
// 'offset': 0.0, 'precision': 0.05, 'len': 16, 'name':
// 'LLC_FBK_SteeringAngleSetpoint', 'is_signed_var': True, 'physical_range':
// '[-1638.4|1638.35]', 'bit': 21, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'deg'}
double llc_fbk_steeringanglesetpoint(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'description': 'Current throttle setpoint (after limits)',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_FBK_ThrottleSetpoint', 'is_signed_var': False, 'physical_range':
// '[0|102.3]', 'bit': 11, 'type': 'double', 'order': 'intel',
// 'physical_unit': '%'}
double llc_fbk_throttlesetpoint(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'description': 'Front brake pressure setpoint (after
// limits)', 'offset': 0.0, 'precision': 0.0556, 'len': 11, 'name':
// 'LLC_FBK_BrakePercentSetpoint', 'is_signed_var': False, 'physical_range':
// '[0|113.8132]', 'bit': 0, 'type': 'double', 'order': 'intel',
// 'physical_unit': '%'}
double llc_fbk_brakepercentsetpoint(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'description': 'Motion command feedback 2 heartbeat
// counter', 'offset': 0.0, 'precision': 1.0, 'len': 2, 'name':
// 'LLC_MotionCommandFeedback1_Count', 'is_signed_var': False,
// 'physical_range': '[0|3]', 'bit': 54, 'type': 'int', 'order': 'intel',
// 'physical_unit': ''}
int llc_motioncommandfeedback1_count(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'description': 'Motion command feedback 1 checksum',
// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
// 'LLC_MotionCommandFeedback1_Check', 'is_signed_var': False,
// 'physical_range': '[0|255]', 'bit': 56, 'type': 'int', 'order': 'intel',
// 'physical_unit': ''}
int llc_motioncommandfeedback1_check(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_vehiclelimits_24_test.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/llc_vehiclelimits_24.h"
#include "gtest/gtest.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class Vehiclelimits_24_test : public ::testing::Test {
public:
virtual void SetUp() {}
protected:
Llcvehiclelimits24 vehiclelimits_;
};
TEST_F(Vehiclelimits_24_test, General) {
const uint8_t bytes[8] = {0x8f, 0x9e, 0xad, 0xbc, 0xcb, 0xda, 0xe9, 0xf8};
const int32_t length_maxsteeringangle = 12;
const int32_t length_maxbrakepercent = 12;
const int equivalent_maxsteeringangle = 0xad9;
const int equivalent_maxbrakepercent = 0xe8f;
EXPECT_EQ(
vehiclelimits_.llc_fbk_maxsteeringangle(bytes, length_maxsteeringangle),
equivalent_maxsteeringangle);
EXPECT_EQ(
vehiclelimits_.llc_fbk_maxbrakepercent(bytes, length_maxbrakepercent),
equivalent_maxbrakepercent);
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_motionfeedback1_20_test.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/llc_motionfeedback1_20.h"
#include "gtest/gtest.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class Motionfeedback1_20_test : public ::testing::Test {
public:
virtual void SetUp() {}
protected:
Llcmotionfeedback120 feedback_;
};
TEST_F(Motionfeedback1_20_test, General) {
const uint8_t bytes[8] = {0x8f, 0x9e, 0xad, 0xbc, 0xcb, 0xda, 0xe9, 0xf8};
const int32_t length_Gear = 3;
const int32_t length_Parkingbrake = 1;
const int32_t length_Throttleposition = 10;
const int32_t length_Brakepercentrear = 11;
const int32_t length_Brakepercentfront = 11;
const int32_t length_Steeringcontrolmode = 2;
const int32_t length_Motionfeedback1_counter = 2;
const int32_t length_Motionfeedback1_checksum = 8;
const int32_t length_Commandaligned = 1;
const int32_t length_Estoppressed = 1;
const int32_t length_Adcrequestautonomy = 1;
const int32_t length_Allowautonomy = 1;
const int32_t length_Longitudinalcontrolmode = 2;
const int32_t length_State = 4;
const int32_t equivalent_Gear = 2;
const double equivalent_Throttleposition = 87.50;
const double equivalent_Brakepercentrear = 20.85;
const double equivalent_Brakepercentfront = 66.5532;
const int32_t equivalent_Steeringcontrolmode = 2;
const int32_t equivalent_Motionfeedback1_counter = 3;
const int32_t equivalent_Motionfeedback1_checksum = 248;
const int32_t equivalent_Longitudinalcontrolmode = 0;
const int32_t equivalent_State = 15;
EXPECT_EQ(
feedback_.llc_fbk_gear(bytes, length_Gear),
static_cast<Llc_motionfeedback1_20 ::Llc_fbk_gearType>(equivalent_Gear));
EXPECT_TRUE(feedback_.llc_fbk_parkingbrake(bytes, length_Parkingbrake));
EXPECT_DOUBLE_EQ(
feedback_.llc_fbk_throttleposition(bytes, length_Throttleposition),
equivalent_Throttleposition);
EXPECT_DOUBLE_EQ(
feedback_.llc_fbk_brakepercentrear(bytes, length_Brakepercentrear),
equivalent_Brakepercentrear);
EXPECT_DOUBLE_EQ(
feedback_.llc_fbk_brakepercentfront(bytes, length_Brakepercentfront),
equivalent_Brakepercentfront);
EXPECT_EQ(
feedback_.llc_fbk_steeringcontrolmode(bytes, length_Steeringcontrolmode),
static_cast<Llc_motionfeedback1_20 ::Llc_fbk_steeringcontrolmodeType>(
equivalent_Steeringcontrolmode));
EXPECT_EQ(feedback_.llc_motionfeedback1_counter(
bytes, length_Motionfeedback1_counter),
equivalent_Motionfeedback1_counter);
EXPECT_EQ(feedback_.llc_motionfeedback1_checksum(
bytes, length_Motionfeedback1_checksum),
equivalent_Motionfeedback1_checksum);
EXPECT_TRUE(
feedback_.llc_motionfeedback1_checksum(bytes, length_Commandaligned));
EXPECT_TRUE(feedback_.llc_fbk_estoppressed(bytes, length_Estoppressed));
EXPECT_TRUE(
feedback_.llc_fbk_adcrequestautonomy(bytes, length_Adcrequestautonomy));
EXPECT_FALSE(feedback_.llc_fbk_allowautonomy(bytes, length_Allowautonomy));
EXPECT_EQ(
feedback_.llc_fbk_longitudinalcontrolmode(bytes,
length_Longitudinalcontrolmode),
static_cast<Llc_motionfeedback1_20 ::Llc_fbk_longitudinalcontrolmodeType>(
equivalent_Longitudinalcontrolmode));
EXPECT_EQ(feedback_.llc_fbk_state(bytes, length_State),
static_cast<Llc_motionfeedback1_20 ::Llc_fbk_stateType>(
equivalent_State));
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_auxiliarycontrol_110.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "gtest/gtest_prod.h"
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace transit {
class Adcauxiliarycontrol110 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Adcauxiliarycontrol110();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
FRIEND_TEST(Auxiliarycontrol_110_test, General);
// config detail: {'description': 'Aux control heartbeat counter', 'offset':
// 0.0, 'precision': 1.0, 'len': 2, 'name': 'ADC_AuxControl_Counter',
// 'is_signed_var': False, 'physical_range': '[0|3]', 'bit': 54, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
Adcauxiliarycontrol110* set_adc_auxcontrol_counter(
int adc_auxcontrol_counter);
// config detail: {'description': 'Aux control checksum', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'name': 'ADC_AuxControl_Checksum',
// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
Adcauxiliarycontrol110* set_adc_auxcontrol_checksum(
int adc_auxcontrol_checksum);
// config detail: {'description': 'Control inverter override (default ON if
// not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_Inverter_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'intel', 'physical_unit':
// 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_inverter_controlenable(
bool adc_cmd_inverter_controlenable);
// config detail: {'description': 'Control inverter', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Inverter', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 2, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_inverter(bool adc_cmd_inverter);
// config detail: {'description': '(Reserved) Control wiper', 'offset': 0.0,
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_Wiper', 'is_signed_var':
// False, 'physical_range': '[0|3]', 'bit': 4, 'type': 'int', 'order':
// 'intel', 'physical_unit': ''}
Adcauxiliarycontrol110* set_adc_cmd_wiper(int adc_cmd_wiper);
// config detail: {'description': 'PDU Control Override (all channels default
// ON if not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_PDU_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'intel', 'physical_unit':
// 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_controlenable(
bool adc_cmd_pdu_controlenable);
// config detail: {'description': 'Control PDU Ch 8 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch8',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch8(bool adc_cmd_pdu_ch8);
// config detail: {'description': 'Control PDU Ch 7 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch7',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 14, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch7(bool adc_cmd_pdu_ch7);
// config detail: {'description': 'Control PDU Ch 6 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch6',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 13, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch6(bool adc_cmd_pdu_ch6);
// config detail: {'description': 'Control PDU Ch 5 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch5',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 12, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch5(bool adc_cmd_pdu_ch5);
// config detail: {'description': 'Control PDU Ch 4 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch4',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 11, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch4(bool adc_cmd_pdu_ch4);
// config detail: {'description': 'Control PDU Ch 3 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch3',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 10, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch3(bool adc_cmd_pdu_ch3);
// config detail: {'description': 'Control PDU Ch 2 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch2',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 9, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch2(bool adc_cmd_pdu_ch2);
// config detail: {'description': 'Control PDU Ch 1 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch1',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_pdu_ch1(bool adc_cmd_pdu_ch1);
// config detail: {'description': 'Control hazard lights', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HazardLights',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 28, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_hazardlights(bool adc_cmd_hazardlights);
// config detail: {'description': 'Control high beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HighBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 27, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_highbeam(bool adc_cmd_highbeam);
// config detail: {'description': 'Control low beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_LowBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 26, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_lowbeam(bool adc_cmd_lowbeam);
// config detail: {'description': 'Control horn', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Horn', 'is_signed_var': False,
// 'physical_range': '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'intel',
// 'physical_unit': 'T/F'}
Adcauxiliarycontrol110* set_adc_cmd_horn(bool adc_cmd_horn);
// config detail: {'description': 'Requested turn signals', 'enum': {0:
// 'ADC_CMD_TURNSIGNAL_NONE', 1: 'ADC_CMD_TURNSIGNAL_LEFT', 2:
// 'ADC_CMD_TURNSIGNAL_RIGHT', 3: 'ADC_CMD_TURNSIGNAL_RESERVE'},
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_TurnSignal', 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 24, 'type': 'enum',
// 'order': 'intel', 'physical_unit': ''}
Adcauxiliarycontrol110* set_adc_cmd_turnsignal(
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal);
private:
// config detail: {'description': 'Aux control heartbeat counter', 'offset':
// 0.0, 'precision': 1.0, 'len': 2, 'name': 'ADC_AuxControl_Counter',
// 'is_signed_var': False, 'physical_range': '[0|3]', 'bit': 54, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
void set_p_adc_auxcontrol_counter(uint8_t* data, int adc_auxcontrol_counter);
// config detail: {'description': 'Aux control checksum', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'name': 'ADC_AuxControl_Checksum',
// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
void set_p_adc_auxcontrol_checksum(uint8_t* data,
int adc_auxcontrol_checksum);
// config detail: {'description': 'Control inverter override (default ON if
// not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_Inverter_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'intel', 'physical_unit':
// 'T/F'}
void set_p_adc_cmd_inverter_controlenable(
uint8_t* data, bool adc_cmd_inverter_controlenable);
// config detail: {'description': 'Control inverter', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Inverter', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 2, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_inverter(uint8_t* data, bool adc_cmd_inverter);
// config detail: {'description': '(Reserved) Control wiper', 'offset': 0.0,
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_Wiper', 'is_signed_var':
// False, 'physical_range': '[0|3]', 'bit': 4, 'type': 'int', 'order':
// 'intel', 'physical_unit': ''}
void set_p_adc_cmd_wiper(uint8_t* data, int adc_cmd_wiper);
// config detail: {'description': 'PDU Control Override (all channels default
// ON if not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
// 'ADC_CMD_PDU_ControlEnable', 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'intel', 'physical_unit':
// 'T/F'}
void set_p_adc_cmd_pdu_controlenable(uint8_t* data,
bool adc_cmd_pdu_controlenable);
// config detail: {'description': 'Control PDU Ch 8 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch8',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch8(uint8_t* data, bool adc_cmd_pdu_ch8);
// config detail: {'description': 'Control PDU Ch 7 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch7',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 14, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch7(uint8_t* data, bool adc_cmd_pdu_ch7);
// config detail: {'description': 'Control PDU Ch 6 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch6',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 13, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch6(uint8_t* data, bool adc_cmd_pdu_ch6);
// config detail: {'description': 'Control PDU Ch 5 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch5',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 12, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch5(uint8_t* data, bool adc_cmd_pdu_ch5);
// config detail: {'description': 'Control PDU Ch 4 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch4',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 11, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch4(uint8_t* data, bool adc_cmd_pdu_ch4);
// config detail: {'description': 'Control PDU Ch 3 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch3',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 10, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch3(uint8_t* data, bool adc_cmd_pdu_ch3);
// config detail: {'description': 'Control PDU Ch 2 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch2',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 9, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch2(uint8_t* data, bool adc_cmd_pdu_ch2);
// config detail: {'description': 'Control PDU Ch 1 (when override enabled)',
// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch1',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_pdu_ch1(uint8_t* data, bool adc_cmd_pdu_ch1);
// config detail: {'description': 'Control hazard lights', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HazardLights',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 28, 'type':
// 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_hazardlights(uint8_t* data, bool adc_cmd_hazardlights);
// config detail: {'description': 'Control high beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HighBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 27, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_highbeam(uint8_t* data, bool adc_cmd_highbeam);
// config detail: {'description': 'Control low beam', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_LowBeam', 'is_signed_var':
// False, 'physical_range': '[0|1]', 'bit': 26, 'type': 'bool', 'order':
// 'intel', 'physical_unit': 'T/F'}
void set_p_adc_cmd_lowbeam(uint8_t* data, bool adc_cmd_lowbeam);
// config detail: {'description': 'Control horn', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Horn', 'is_signed_var': False,
// 'physical_range': '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'intel',
// 'physical_unit': 'T/F'}
void set_p_adc_cmd_horn(uint8_t* data, bool adc_cmd_horn);
// config detail: {'description': 'Requested turn signals', 'enum': {0:
// 'ADC_CMD_TURNSIGNAL_NONE', 1: 'ADC_CMD_TURNSIGNAL_LEFT', 2:
// 'ADC_CMD_TURNSIGNAL_RIGHT', 3: 'ADC_CMD_TURNSIGNAL_RESERVE'},
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_TurnSignal', 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 24, 'type': 'enum',
// 'order': 'intel', 'physical_unit': ''}
void set_p_adc_cmd_turnsignal(
uint8_t* data,
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal);
private:
int adc_auxcontrol_counter_;
int adc_auxcontrol_checksum_;
bool adc_cmd_inverter_controlenable_;
bool adc_cmd_inverter_;
int adc_cmd_wiper_;
bool adc_cmd_pdu_controlenable_;
bool adc_cmd_pdu_ch8_;
bool adc_cmd_pdu_ch7_;
bool adc_cmd_pdu_ch6_;
bool adc_cmd_pdu_ch5_;
bool adc_cmd_pdu_ch4_;
bool adc_cmd_pdu_ch3_;
bool adc_cmd_pdu_ch2_;
bool adc_cmd_pdu_ch1_;
bool adc_cmd_hazardlights_;
bool adc_cmd_highbeam_;
bool adc_cmd_lowbeam_;
bool adc_cmd_horn_;
Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal_;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_vehiclelimits_24.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/llc_vehiclelimits_24.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
Llcvehiclelimits24::Llcvehiclelimits24() {}
const int32_t Llcvehiclelimits24::ID = 0x24;
void Llcvehiclelimits24::Parse(const std::uint8_t* bytes, int32_t length,
Transit* chassis) const {
chassis->mutable_llc_vehiclelimits_24()->set_llc_fbk_maxsteeringangle(
llc_fbk_maxsteeringangle(bytes, length));
chassis->mutable_llc_vehiclelimits_24()->set_llc_fbk_maxbrakepercent(
llc_fbk_maxbrakepercent(bytes, length));
}
// config detail: {'description': 'Steering angle feedback', 'offset': 0.0,
// 'precision': 1.0, 'len': 12, 'name': 'llc_fbk_maxsteeringangle',
// 'is_signed_var': False, 'physical_range': '[0|4095]', 'bit': 12, 'type':
// 'int', 'order': 'intel', 'physical_unit': 'deg'}
int Llcvehiclelimits24::llc_fbk_maxsteeringangle(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(4, 4);
x <<= 4;
x |= t;
int ret = x;
return ret;
}
// config detail: {'description': 'Front brake pressure feedback', 'offset':
// 0.0, 'precision': 1.0, 'len': 12, 'name': 'llc_fbk_maxbrakepercent',
// 'is_signed_var': False, 'physical_range': '[0|113.8132]', 'bit': 0, 'type':
// 'double', 'order': 'intel', 'physical_unit': '%'}
double Llcvehiclelimits24::llc_fbk_maxbrakepercent(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 4);
Byte t1(bytes + 0);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x;
return ret;
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/BUILD
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
CANBUS_COPTS = ["-DMODULE_NAME=\\\"canbus\\\""]
cc_library(
name = "canbus_transit_protocol",
deps = [
":adc_auxiliarycontrol_110",
":adc_motioncontrol1_10",
":adc_motioncontrollimits1_12",
":llc_auxiliaryfeedback_120",
":llc_diag_brakecontrol_721",
":llc_diag_fault_620",
":llc_diag_steeringcontrol_722",
":llc_motioncommandfeedback1_22",
":llc_motionfeedback1_20",
":llc_motionfeedback2_21",
":llc_vehiclelimits_24",
":llc_vehiclestatus_25",
],
)
cc_library(
name = "adc_auxiliarycontrol_110",
srcs = ["adc_auxiliarycontrol_110.cc"],
hdrs = ["adc_auxiliarycontrol_110.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Auxiliarycontrol_110_test",
size = "small",
srcs = ["adc_auxiliarycontrol_110_test.cc"],
deps = [
":adc_auxiliarycontrol_110",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "adc_motioncontrol1_10",
srcs = ["adc_motioncontrol1_10.cc"],
hdrs = ["adc_motioncontrol1_10.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "adc_motioncontrol1_10_test",
size = "small",
srcs = ["adc_motioncontrol1_10_test.cc"],
deps = [
":adc_motioncontrol1_10",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "adc_motioncontrollimits1_12",
srcs = ["adc_motioncontrollimits1_12.cc"],
hdrs = ["adc_motioncontrollimits1_12.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Motioncontrollimits1_12",
size = "small",
srcs = ["adc_motioncontrollimits1_12_test.cc"],
deps = [
":adc_motioncontrollimits1_12",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "llc_auxiliaryfeedback_120",
srcs = ["llc_auxiliaryfeedback_120.cc"],
hdrs = ["llc_auxiliaryfeedback_120.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "llc_auxiliaryfeedback_120_test",
size = "small",
srcs = ["llc_auxiliaryfeedback_120_test.cc"],
deps = [
":llc_auxiliaryfeedback_120",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "llc_diag_brakecontrol_721",
srcs = ["llc_diag_brakecontrol_721.cc"],
hdrs = ["llc_diag_brakecontrol_721.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "llc_diag_brakecontrol_721_test",
size = "small",
srcs = ["llc_diag_brakecontrol_721_test.cc"],
deps = [
":llc_diag_brakecontrol_721",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "llc_diag_fault_620",
srcs = ["llc_diag_fault_620.cc"],
hdrs = ["llc_diag_fault_620.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Diag_fault_620_test",
size = "small",
srcs = ["llc_diag_fault_620_test.cc"],
deps = [
":llc_diag_fault_620",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "llc_diag_steeringcontrol_722",
srcs = ["llc_diag_steeringcontrol_722.cc"],
hdrs = ["llc_diag_steeringcontrol_722.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "llc_diag_steeringcontrol_722_test",
size = "small",
srcs = ["llc_diag_steeringcontrol_722_test.cc"],
deps = [
":llc_diag_steeringcontrol_722",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "llc_motioncommandfeedback1_22",
srcs = ["llc_motioncommandfeedback1_22.cc"],
hdrs = ["llc_motioncommandfeedback1_22.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Motioncommandfeedback1_22_test",
size = "small",
srcs = ["llc_motioncommandfeedback1_22_test.cc"],
deps = [
":llc_motioncommandfeedback1_22",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "llc_motionfeedback1_20",
srcs = ["llc_motionfeedback1_20.cc"],
hdrs = ["llc_motionfeedback1_20.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Motionfeedback1_20_test",
size = "small",
srcs = ["llc_motionfeedback1_20_test.cc"],
deps = [
":llc_motionfeedback1_20",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "llc_motionfeedback2_21",
srcs = ["llc_motionfeedback2_21.cc"],
hdrs = ["llc_motionfeedback2_21.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "llc_motionfeedback2_21_test",
size = "small",
srcs = ["llc_motionfeedback2_21_test.cc"],
deps = [
":llc_motionfeedback2_21",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cc_library(
name = "llc_vehiclelimits_24",
srcs = ["llc_vehiclelimits_24.cc"],
hdrs = ["llc_vehiclelimits_24.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "Vehiclelimits_24_test",
size = "small",
srcs = ["llc_vehiclelimits_24_test.cc"],
deps = [
":llc_vehiclelimits_24",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "llc_vehiclestatus_25",
srcs = ["llc_vehiclestatus_25.cc"],
hdrs = ["llc_vehiclestatus_25.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/transit/proto:transit_cc_proto",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
"@com_google_googletest//:gtest",
],
)
cc_test(
name = "llc_vehiclestatus_25_test",
size = "small",
srcs = ["llc_vehiclestatus_25_test.cc"],
deps = [
":llc_vehiclestatus_25",
"//modules/canbus_vehicle/transit/protocol:canbus_transit_protocol",
"@com_google_googletest//:gtest_main",
],
linkstatic = True,
)
cpplint()
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_auxiliaryfeedback_120_test.cc
|
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/llc_auxiliaryfeedback_120.h"
#include "gtest/gtest.h"
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class llc_auxiliaryfeedback_120Test : public ::testing ::Test {
public:
virtual void SetUp() {}
protected:
Llcauxiliaryfeedback120 Llcauxiliary_feedback120_;
};
TEST_F(llc_auxiliaryfeedback_120Test, General) {
const uint8_t kData[4] = {0xFB, 0xFF, 0xFF, 0xFF};
int32_t length = 1;
int32_t turnsignal_len = 2;
EXPECT_FALSE(Llcauxiliary_feedback120_.llc_fbk_inverter(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch8(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch7(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch6(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch5(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch4(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch3(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch2(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch1(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_hazardlights(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_ledgreenon(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_horn(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_buzzeron(kData, length));
EXPECT_EQ(Llcauxiliary_feedback120_.llc_fbk_turnsignal(kData, turnsignal_len),
3);
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_lowbeam(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_highbeam(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_ledredon(kData, length));
EXPECT_TRUE(
Llcauxiliary_feedback120_.llc_fbk_autonomybuttonpressed(kData, length));
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_motioncontrollimits1_12.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "gtest/gtest.h"
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace transit {
class Adcmotioncontrollimits112
: public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Adcmotioncontrollimits112();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
FRIEND_TEST(Motioncontrollimits1_12_test, General);
// config detail: {'description': 'Set limit for throttle position', 'offset':
// 0.0, 'precision': 0.5, 'len': 8, 'name': 'ADC_CMD_ThrottleCommandLimit',
// 'is_signed_var': False, 'physical_range': '[0|100]', 'bit': 24, 'type':
// 'double', 'order': 'intel', 'physical_unit': '%'}
Adcmotioncontrollimits112* set_adc_cmd_throttlecommandlimit(
double adc_cmd_throttlecommandlimit);
// config detail: {'description': 'Set steering rate', 'offset': 0.0,
// 'precision': 0.05, 'len': 16, 'name': 'ADC_CMD_SteeringRate',
// 'is_signed_var': False, 'physical_range': '[0|3276.75]', 'bit': 0, 'type':
// 'double', 'order': 'intel', 'physical_unit': 'deg/s'}
Adcmotioncontrollimits112* set_adc_cmd_steeringrate(
double adc_cmd_steeringrate);
// config detail: {'description': 'Set limit for steering wheel angle. Applies
// in both positive and negative', 'offset': 0.0, 'precision': 5.0, 'len': 8,
// 'name': 'ADC_CMD_SteerWheelAngleLimit', 'is_signed_var': False,
// 'physical_range': '[0|1275]', 'bit': 16, 'type': 'double', 'order':
// 'intel', 'physical_unit': 'deg'}
Adcmotioncontrollimits112* set_adc_cmd_steerwheelanglelimit(
double adc_cmd_steerwheelanglelimit);
private:
// config detail: {'description': 'Set limit for throttle position', 'offset':
// 0.0, 'precision': 0.5, 'len': 8, 'name': 'ADC_CMD_ThrottleCommandLimit',
// 'is_signed_var': False, 'physical_range': '[0|100]', 'bit': 24, 'type':
// 'double', 'order': 'intel', 'physical_unit': '%'}
void set_p_adc_cmd_throttlecommandlimit(uint8_t* data,
double adc_cmd_throttlecommandlimit);
// config detail: {'description': 'Set steering rate', 'offset': 0.0,
// 'precision': 0.05, 'len': 16, 'name': 'ADC_CMD_SteeringRate',
// 'is_signed_var': False, 'physical_range': '[0|3276.75]', 'bit': 0, 'type':
// 'double', 'order': 'intel', 'physical_unit': 'deg/s'}
void set_p_adc_cmd_steeringrate(uint8_t* data, double adc_cmd_steeringrate);
// config detail: {'description': 'Set limit for steering wheel angle. Applies
// in both positive and negative', 'offset': 0.0, 'precision': 5.0, 'len': 8,
// 'name': 'ADC_CMD_SteerWheelAngleLimit', 'is_signed_var': False,
// 'physical_range': '[0|1275]', 'bit': 16, 'type': 'double', 'order':
// 'intel', 'physical_unit': 'deg'}
void set_p_adc_cmd_steerwheelanglelimit(uint8_t* data,
double adc_cmd_steerwheelanglelimit);
private:
double adc_cmd_throttlecommandlimit_;
double adc_cmd_steeringrate_;
double adc_cmd_steerwheelanglelimit_;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_diag_fault_620.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/llc_diag_fault_620.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
Llcdiagfault620::Llcdiagfault620() {}
const int32_t Llcdiagfault620::ID = 0x620;
void Llcdiagfault620::Parse(const std::uint8_t* bytes, int32_t length,
Transit* chassis) const {
chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_brake(
llc_disengagecounter_brake(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_steer(
llc_disengagecounter_steer(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_throttle(
llc_disengagecounter_throttle(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_fbk_faultcounter(
llc_fbk_faultcounter(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_button(
llc_disengagecounter_button(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_year(
llc_fbk_version_year(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_month(
llc_fbk_version_month(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_day(
llc_fbk_version_day(bytes, length));
chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_hour(
llc_fbk_version_hour(bytes, length));
}
// config detail: {'description': 'Counts the number of times that the driver
// has disengaged autonomy by applying the brakes since system reset..',
// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
// 'llc_disengagecounter_brake', 'is_signed_var': False, 'physical_range':
// '[0|255]', 'bit': 32, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
int Llcdiagfault620::llc_disengagecounter_brake(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'description': 'Counts the number of times that the driver
// has disengaged autonomy by moving the steering wheel since system reset.',
// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
// 'llc_disengagecounter_steer', 'is_signed_var': False, 'physical_range':
// '[0|255]', 'bit': 16, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
int Llcdiagfault620::llc_disengagecounter_steer(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'description': 'Counts the number of times that the driver
// has disengaged autonomy by applying throttle since system reset.', 'offset':
// 0.0, 'precision': 1.0, 'len': 8, 'name': 'llc_disengagecounter_throttle',
// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 24, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
int Llcdiagfault620::llc_disengagecounter_throttle(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'description': 'Counts the number of faults that have
// occurred since system reset.', 'offset': 0.0, 'precision': 1.0, 'len': 8,
// 'name': 'llc_fbk_faultcounter', 'is_signed_var': False, 'physical_range':
// '[0|255]', 'bit': 0, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
int Llcdiagfault620::llc_fbk_faultcounter(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'description': 'Counts the number of times that the driver
// has disengaged autonomy by applying the brakes since system reset..',
// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
// 'llc_disengagecounter_button', 'is_signed_var': False, 'physical_range':
// '[0|255]', 'bit': 8, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
int Llcdiagfault620::llc_disengagecounter_button(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'description': 'Firmware version', 'offset': 2017.0,
// 'precision': 1.0, 'len': 7, 'name': 'llc_fbk_version_year', 'is_signed_var':
// False, 'physical_range': '[2017|2144]', 'bit': 40, 'type': 'int', 'order':
// 'intel', 'physical_unit': 'g'}
int Llcdiagfault620::llc_fbk_version_year(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 5);
int32_t x = t0.get_byte(0, 7);
int ret = static_cast<int>(x + 2017.000000);
return ret;
}
// config detail: {'description': 'Firmware version', 'offset': 0.0,
// 'precision': 1.0, 'len': 4, 'name': 'llc_fbk_version_month', 'is_signed_var':
// False, 'physical_range': '[0|15]', 'bit': 47, 'type': 'int', 'order':
// 'intel', 'physical_unit': 'Month'}
int Llcdiagfault620::llc_fbk_version_month(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 6);
int32_t x = t0.get_byte(0, 3);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(7, 1);
x <<= 1;
x |= t;
int ret = x;
return ret;
}
// config detail: {'description': 'Firmware version', 'offset': 0.0,
// 'precision': 1.0, 'len': 5, 'name': 'llc_fbk_version_day', 'is_signed_var':
// False, 'physical_range': '[0|31]', 'bit': 51, 'type': 'int', 'order':
// 'intel', 'physical_unit': 'Day'}
int Llcdiagfault620::llc_fbk_version_day(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 6);
int32_t x = t0.get_byte(3, 5);
int ret = x;
return ret;
}
// config detail: {'description': 'Firmware version', 'offset': 0.0,
// 'precision': 1.0, 'len': 5, 'name': 'llc_fbk_version_hour', 'is_signed_var':
// False, 'physical_range': '[0|31]', 'bit': 56, 'type': 'int', 'order':
// 'intel', 'physical_unit': 'Hour'}
int Llcdiagfault620::llc_fbk_version_hour(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(0, 5);
int ret = x;
return ret;
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_vehiclestatus_25.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
#include "gtest/gtest_prod.h"
namespace apollo {
namespace canbus {
namespace transit {
class Llcvehiclestatus25 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Llcvehiclestatus25();
void Parse(const std::uint8_t* bytes, int32_t length,
Transit* chassis) const override;
FRIEND_TEST(llc_vehiclestatus_25Test, 12voltage);
private:
// config detail: {'description': 'Vehicle 12V voltage feedback', 'offset':
// 0.0, 'precision': 0.1, 'len': 8, 'name': 'LLC_FBK_12Voltage',
// 'is_signed_var': False, 'physical_range': '[0|25.5]', 'bit': 0, 'type':
// 'double', 'order': 'intel', 'physical_unit': 'Volt'}
double llc_fbk_12voltage(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/adc_motioncontrol1_10.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/transit/protocol/adc_motioncontrol1_10.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
const int32_t Adcmotioncontrol110::ID = 0x10;
// public
Adcmotioncontrol110::Adcmotioncontrol110() { Reset(); }
uint32_t Adcmotioncontrol110::GetPeriod() const {
// TODO(All) : modify every protocol's period manually
static const uint32_t PERIOD = 10 * 1000;
return PERIOD;
}
void Adcmotioncontrol110::UpdateData(uint8_t* data) {
set_p_adc_cmd_steerwheelangle(data, adc_cmd_steerwheelangle_);
set_p_adc_cmd_steeringcontrolmode(data, adc_cmd_steeringcontrolmode_);
set_p_adc_cmd_parkingbrake(data, adc_cmd_parkingbrake_);
set_p_adc_cmd_gear(data, adc_cmd_gear_);
set_p_adc_motioncontrol1_checksum(data, adc_motioncontrol1_checksum_);
set_p_adc_cmd_brakepercentage(data, adc_cmd_brakepercentage_);
set_p_adc_cmd_throttleposition(data, adc_cmd_throttleposition_);
set_p_adc_motioncontrol1_counter(data, adc_motioncontrol1_counter_);
set_p_adc_cmd_autonomyrequest(data, adc_cmd_autonomyrequest_);
set_p_adc_cmd_longitudinalcontrolmode(data, adc_cmd_longitudinalcontrolmode_);
}
void Adcmotioncontrol110::Reset() {
// TODO(All) : you should check this manually
adc_cmd_steerwheelangle_ = 0.0;
adc_cmd_steeringcontrolmode_ =
Adc_motioncontrol1_10::ADC_CMD_STEERINGCONTROLMODE_NONE;
adc_cmd_parkingbrake_ = false;
adc_cmd_gear_ = Adc_motioncontrol1_10::ADC_CMD_GEAR_P_PARK;
adc_motioncontrol1_checksum_ = 0;
adc_cmd_brakepercentage_ = 0.0;
adc_cmd_throttleposition_ = 0.0;
adc_motioncontrol1_counter_ = 0;
adc_cmd_autonomyrequest_ =
Adc_motioncontrol1_10::ADC_CMD_AUTONOMYREQUEST_AUTONOMY_NOT_REQUESTED;
adc_cmd_longitudinalcontrolmode_ =
Adc_motioncontrol1_10::ADC_CMD_LONGITUDINALCONTROLMODE_NONE;
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_steerwheelangle(
double adc_cmd_steerwheelangle) {
adc_cmd_steerwheelangle_ = adc_cmd_steerwheelangle;
return this;
}
// config detail: {'description': 'Setpoint for steering wheel angle. Positive
// for CW', 'offset': 0.0, 'precision': -0.05, 'len': 16, 'name':
// 'ADC_CMD_SteerWheelAngle', 'is_signed_var': True, 'physical_range':
// '[-1638.4|1638.35]', 'bit': 27, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'deg'}
void Adcmotioncontrol110::set_p_adc_cmd_steerwheelangle(
uint8_t* data, double adc_cmd_steerwheelangle) {
adc_cmd_steerwheelangle =
ProtocolData::BoundedValue(-1638.4, 1638.35, adc_cmd_steerwheelangle);
int x = static_cast<int>(adc_cmd_steerwheelangle / -0.050000);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0x1F);
Byte to_set0(data + 3);
to_set0.set_value(t, 3, 5);
x >>= 5;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set1(data + 4);
to_set1.set_value(t, 0, 8);
x >>= 8;
t = static_cast<uint8_t>(x & 0x7);
Byte to_set2(data + 5);
to_set2.set_value(t, 0, 3);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_steeringcontrolmode(
Adc_motioncontrol1_10::Adc_cmd_steeringcontrolmodeType
adc_cmd_steeringcontrolmode) {
adc_cmd_steeringcontrolmode_ = adc_cmd_steeringcontrolmode;
return this;
}
// config detail: {'description': 'Select steering control mode', 'enum': {0:
// 'ADC_CMD_STEERINGCONTROLMODE_NONE', 1: 'ADC_CMD_STEERINGCONTROLMODE_ANGLE',
// 2: 'ADC_CMD_STEERINGCONTROLMODE_RESERVED_CURVATURE', 3:
// 'ADC_CMD_STEERINGCONTROLMODE_RESERVED'}, 'precision': 1.0, 'len': 2, 'name':
// 'ADC_CMD_SteeringControlMode', 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|3]', 'bit': 4, 'type': 'enum', 'order': 'intel',
// 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_cmd_steeringcontrolmode(
uint8_t* data, Adc_motioncontrol1_10::Adc_cmd_steeringcontrolmodeType
adc_cmd_steeringcontrolmode) {
int x = adc_cmd_steeringcontrolmode;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 4, 2);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_parkingbrake(
bool adc_cmd_parkingbrake) {
adc_cmd_parkingbrake_ = adc_cmd_parkingbrake;
return this;
}
// config detail: {'description': '(Reserved) Control parking brake', 'offset':
// 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_ParkingBrake',
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 53, 'type': 'bool',
// 'order': 'intel', 'physical_unit': 'T/F'}
void Adcmotioncontrol110::set_p_adc_cmd_parkingbrake(
uint8_t* data, bool adc_cmd_parkingbrake) {
int x = adc_cmd_parkingbrake;
Byte to_set(data + 6);
to_set.set_value(static_cast<uint8_t>(x), 5, 1);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_gear(
Adc_motioncontrol1_10::Adc_cmd_gearType adc_cmd_gear) {
adc_cmd_gear_ = adc_cmd_gear;
return this;
}
// config detail: {'description': 'Transmission control - only used in direct
// longitudinal control', 'enum': {0: 'ADC_CMD_GEAR_P_PARK', 1:
// 'ADC_CMD_GEAR_D_DRIVE', 2: 'ADC_CMD_GEAR_N_NEUTRAL', 3:
// 'ADC_CMD_GEAR_R_REVERSE'}, 'precision': 1.0, 'len': 3, 'name':
// 'ADC_CMD_Gear', 'is_signed_var': False, 'offset': 0.0, 'physical_range':
// '[0|7]', 'bit': 50, 'type': 'enum', 'order': 'intel', 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_cmd_gear(
uint8_t* data, Adc_motioncontrol1_10::Adc_cmd_gearType adc_cmd_gear) {
int x = adc_cmd_gear;
Byte to_set(data + 6);
to_set.set_value(static_cast<uint8_t>(x), 2, 3);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_motioncontrol1_checksum(
int adc_motioncontrol1_checksum) {
adc_motioncontrol1_checksum_ = adc_motioncontrol1_checksum;
return this;
}
// config detail: {'description': 'Motion Control 1 checksum', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'name': 'ADC_MotionControl1_Checksum',
// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
// 'int', 'order': 'intel', 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_motioncontrol1_checksum(
uint8_t* data, int adc_motioncontrol1_checksum) {
adc_motioncontrol1_checksum =
ProtocolData::BoundedValue(0, 255, adc_motioncontrol1_checksum);
int x = adc_motioncontrol1_checksum;
Byte to_set(data + 7);
to_set.set_value(static_cast<uint8_t>(x), 0, 8);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_brakepercentage(
double adc_cmd_brakepercentage) {
adc_cmd_brakepercentage_ = adc_cmd_brakepercentage;
return this;
}
// config detail: {'description': 'Brake pressure for direct longitudinal
// control', 'offset': 0.0, 'precision': 0.0556, 'len': 11, 'name':
// 'ADC_CMD_BrakePercentage', 'is_signed_var': False, 'physical_range':
// '[0|113.8132]', 'bit': 6, 'type': 'double', 'order': 'intel',
// 'physical_unit': '%'}
void Adcmotioncontrol110::set_p_adc_cmd_brakepercentage(
uint8_t* data, double adc_cmd_brakepercentage) {
adc_cmd_brakepercentage =
ProtocolData::BoundedValue(0.0, 113.8132, adc_cmd_brakepercentage);
int x = static_cast<int>(adc_cmd_brakepercentage / 0.055600);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0x3);
Byte to_set0(data + 0);
to_set0.set_value(t, 6, 2);
x >>= 2;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set1(data + 1);
to_set1.set_value(t, 0, 8);
x >>= 8;
t = static_cast<uint8_t>(x & 0x1);
Byte to_set2(data + 2);
to_set2.set_value(t, 0, 1);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_throttleposition(
double adc_cmd_throttleposition) {
adc_cmd_throttleposition_ = adc_cmd_throttleposition;
return this;
}
// config detail: {'description': 'Throttle pedal position percentage for direct
// longitudinal control', 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'ADC_CMD_ThrottlePosition', 'is_signed_var': False, 'physical_range':
// '[0|100]', 'bit': 17, 'type': 'double', 'order': 'intel', 'physical_unit':
// '%'}
void Adcmotioncontrol110::set_p_adc_cmd_throttleposition(
uint8_t* data, double adc_cmd_throttleposition) {
adc_cmd_throttleposition =
ProtocolData::BoundedValue(0.0, 100.0, adc_cmd_throttleposition);
int x = static_cast<int>(adc_cmd_throttleposition / 0.100000);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0x7F);
Byte to_set0(data + 2);
to_set0.set_value(t, 1, 7);
x >>= 7;
t = static_cast<uint8_t>(x & 0x7);
Byte to_set1(data + 3);
to_set1.set_value(t, 0, 3);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_motioncontrol1_counter(
int adc_motioncontrol1_counter) {
adc_motioncontrol1_counter_ = adc_motioncontrol1_counter;
return this;
}
// config detail: {'description': 'Motion control 1 Heartbeat counter',
// 'offset': 0.0, 'precision': 1.0, 'len': 2, 'name':
// 'ADC_MotionControl1_Counter', 'is_signed_var': False, 'physical_range':
// '[0|3]', 'bit': 54, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_motioncontrol1_counter(
uint8_t* data, int adc_motioncontrol1_counter) {
adc_motioncontrol1_counter =
ProtocolData::BoundedValue(0, 3, adc_motioncontrol1_counter);
int x = adc_motioncontrol1_counter;
Byte to_set(data + 6);
to_set.set_value(static_cast<uint8_t>(x), 6, 2);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_autonomyrequest(
Adc_motioncontrol1_10::Adc_cmd_autonomyrequestType
adc_cmd_autonomyrequest) {
adc_cmd_autonomyrequest_ = adc_cmd_autonomyrequest;
return this;
}
// config detail: {'description': 'Request from ADC to LLC for autonomy',
// 'enum': {0: 'ADC_CMD_AUTONOMYREQUEST_AUTONOMY_NOT_REQUESTED', 1:
// 'ADC_CMD_AUTONOMYREQUEST_AUTONOMY_REQUESTED', 2:
// 'ADC_CMD_AUTONOMYREQUEST_RESERVED0', 3: 'ADC_CMD_AUTONOMYREQUEST_RESERVED1'},
// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_AutonomyRequest',
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 0,
// 'type': 'enum', 'order': 'intel', 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_cmd_autonomyrequest(
uint8_t* data, Adc_motioncontrol1_10::Adc_cmd_autonomyrequestType
adc_cmd_autonomyrequest) {
int x = adc_cmd_autonomyrequest;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 2);
}
Adcmotioncontrol110* Adcmotioncontrol110::set_adc_cmd_longitudinalcontrolmode(
Adc_motioncontrol1_10::Adc_cmd_longitudinalcontrolmodeType
adc_cmd_longitudinalcontrolmode) {
adc_cmd_longitudinalcontrolmode_ = adc_cmd_longitudinalcontrolmode;
return this;
}
// config detail: {'description': 'Select longitudinal control mode', 'enum':
// {0: 'ADC_CMD_LONGITUDINALCONTROLMODE_NONE', 1:
// 'ADC_CMD_LONGITUDINALCONTROLMODE_RESERVED_VELOCITY_AND_ACCELERATION', 2:
// 'ADC_CMD_LONGITUDINALCONTROLMODE_RESERVED_FORCE', 3:
// 'ADC_CMD_LONGITUDINALCONTROLMODE_DIRECT_THROTTLE_BRAKE'}, 'precision': 1.0,
// 'len': 2, 'name': 'ADC_CMD_LongitudinalControlMode', 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 2, 'type': 'enum', 'order':
// 'intel', 'physical_unit': ''}
void Adcmotioncontrol110::set_p_adc_cmd_longitudinalcontrolmode(
uint8_t* data, Adc_motioncontrol1_10::Adc_cmd_longitudinalcontrolmodeType
adc_cmd_longitudinalcontrolmode) {
int x = adc_cmd_longitudinalcontrolmode;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 2);
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit
|
apollo_public_repos/apollo/modules/canbus_vehicle/transit/protocol/llc_diag_brakecontrol_721.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/transit/proto/transit.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
#include "gtest/gtest_prod.h"
namespace apollo {
namespace canbus {
namespace transit {
class Llcdiagbrakecontrol721 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Transit> {
public:
static const int32_t ID;
Llcdiagbrakecontrol721();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'description': 'Brake control loop P contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_P', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 34, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
Llcdiagbrakecontrol721* set_llc_dbg_brakepidcontribution_p(
double llc_dbg_brakepidcontribution_p);
// config detail: {'description': 'Brake control loop I contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_I', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 44, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
Llcdiagbrakecontrol721* set_llc_dbg_brakepidcontribution_i(
double llc_dbg_brakepidcontribution_i);
// config detail: {'description': 'Brake control loop D contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_D', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 54, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
Llcdiagbrakecontrol721* set_llc_dbg_brakepidcontribution_d(
double llc_dbg_brakepidcontribution_d);
// config detail: {'description': 'Brake control loop output', 'offset': 0.0,
// 'precision': 0.1, 'len': 10, 'name': 'LLC_DBG_BrakePID_Output',
// 'is_signed_var': True, 'physical_range': '[-51.2|51.1]', 'bit': 12, 'type':
// 'double', 'order': 'intel', 'physical_unit': 'mrev'}
Llcdiagbrakecontrol721* set_llc_dbg_brakepid_output(
double llc_dbg_brakepid_output);
// config detail: {'description': 'Brake control loop error', 'offset': 0.0,
// 'precision': 1.0, 'len': 12, 'name': 'LLC_DBG_BrakePID_Error',
// 'is_signed_var': True, 'physical_range': '[-2048|2047]', 'bit': 0, 'type':
// 'int', 'order': 'intel', 'physical_unit': 'psi'}
Llcdiagbrakecontrol721* set_llc_dbg_brakepid_error(
int llc_dbg_brakepid_error);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 0.5, 'len': 12, 'name':
// 'LLC_DBG_BrakeFeedforward', 'is_signed_var': True, 'physical_range':
// '[-1024|1023.5]', 'bit': 22, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
Llcdiagbrakecontrol721* set_llc_dbg_brakefeedforward(
double llc_dbg_brakefeedforward);
FRIEND_TEST(llc_diag_brakecontrol_721Test, part1);
FRIEND_TEST(llc_diag_brakecontrol_721Test, part2);
private:
// config detail: {'description': 'Brake control loop P contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_P', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 34, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
void set_p_llc_dbg_brakepidcontribution_p(
uint8_t* data, double llc_dbg_brakepidcontribution_p);
// config detail: {'description': 'Brake control loop I contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_I', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 44, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
void set_p_llc_dbg_brakepidcontribution_i(
uint8_t* data, double llc_dbg_brakepidcontribution_i);
// config detail: {'description': 'Brake control loop D contribution',
// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
// 'LLC_DBG_BrakePidContribution_D', 'is_signed_var': True, 'physical_range':
// '[-51.2|51.1]', 'bit': 54, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
void set_p_llc_dbg_brakepidcontribution_d(
uint8_t* data, double llc_dbg_brakepidcontribution_d);
// config detail: {'description': 'Brake control loop output', 'offset': 0.0,
// 'precision': 0.1, 'len': 10, 'name': 'LLC_DBG_BrakePID_Output',
// 'is_signed_var': True, 'physical_range': '[-51.2|51.1]', 'bit': 12, 'type':
// 'double', 'order': 'intel', 'physical_unit': 'mrev'}
void set_p_llc_dbg_brakepid_output(uint8_t* data,
double llc_dbg_brakepid_output);
// config detail: {'description': 'Brake control loop error', 'offset': 0.0,
// 'precision': 1.0, 'len': 12, 'name': 'LLC_DBG_BrakePID_Error',
// 'is_signed_var': True, 'physical_range': '[-2048|2047]', 'bit': 0, 'type':
// 'int', 'order': 'intel', 'physical_unit': 'psi'}
void set_p_llc_dbg_brakepid_error(uint8_t* data, int llc_dbg_brakepid_error);
// config detail: {'description': 'Brake control feedforward contribution',
// 'offset': 0.0, 'precision': 0.5, 'len': 12, 'name':
// 'LLC_DBG_BrakeFeedforward', 'is_signed_var': True, 'physical_range':
// '[-1024|1023.5]', 'bit': 22, 'type': 'double', 'order': 'intel',
// 'physical_unit': 'mrev'}
void set_p_llc_dbg_brakefeedforward(uint8_t* data,
double llc_dbg_brakefeedforward);
private:
double llc_dbg_brakepidcontribution_p_;
double llc_dbg_brakepidcontribution_i_;
double llc_dbg_brakepidcontribution_d_;
double llc_dbg_brakepid_output_;
int llc_dbg_brakepid_error_;
double llc_dbg_brakefeedforward_;
};
} // namespace transit
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_vehicle_factory_test.cc
|
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/lexus_vehicle_factory.h"
#include "gtest/gtest.h"
#include "modules/canbus/proto/canbus_conf.pb.h"
#include "modules/canbus/proto/vehicle_parameter.pb.h"
#include "cyber/common/file.h"
namespace apollo {
namespace canbus {
class LexusVehicleFactoryTest : public ::testing::Test {
public:
virtual void SetUp() {
std::string canbus_conf_file =
"modules/canbus/testdata/conf/lexus_canbus_conf_test.pb.txt";
cyber::common::GetProtoFromFile(canbus_conf_file, &canbus_conf_);
params_ = canbus_conf_.vehicle_parameter();
params_.set_brand(apollo::common::LEXUS);
lexus_factory_.SetVehicleParameter(params_);
}
virtual void TearDown() {}
protected:
LexusVehicleFactory lexus_factory_;
CanbusConf canbus_conf_;
VehicleParameter params_;
};
TEST_F(LexusVehicleFactoryTest, Init) {
apollo::cyber::Init("vehicle_factory_test");
EXPECT_EQ(lexus_factory_.Init(&canbus_conf_), true);
}
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_message_manager.cc
|
/* Copyright 2018 The Apollo Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "modules/canbus_vehicle/lexus/lexus_message_manager.h"
#include "modules/canbus_vehicle/lexus/protocol/accel_cmd_100.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_cmd_104.h"
#include "modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_cmd_108.h"
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_right_rpt_210.h"
#include "modules/canbus_vehicle/lexus/protocol/hazard_lights_cmd_114.h"
#include "modules/canbus_vehicle/lexus/protocol/headlight_cmd_118.h"
#include "modules/canbus_vehicle/lexus/protocol/horn_cmd_11c.h"
#include "modules/canbus_vehicle/lexus/protocol/parking_brake_cmd_124.h"
#include "modules/canbus_vehicle/lexus/protocol/shift_cmd_128.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_cmd_12c.h"
#include "modules/canbus_vehicle/lexus/protocol/turn_cmd_130.h"
#include "modules/canbus_vehicle/lexus/protocol/wiper_cmd_134.h"
#include "modules/canbus_vehicle/lexus/protocol/accel_aux_rpt_300.h"
#include "modules/canbus_vehicle/lexus/protocol/accel_rpt_200.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_aux_rpt_304.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_1_401.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_2_402.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_3_403.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_rpt_204.h"
#include "modules/canbus_vehicle/lexus/protocol/component_rpt_20.h"
#include "modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_rpt_208.h"
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_left_cmd_10c.h"
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_left_rpt_20c.h"
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_right_cmd_110.h"
#include "modules/canbus_vehicle/lexus/protocol/date_time_rpt_40f.h"
#include "modules/canbus_vehicle/lexus/protocol/detected_object_rpt_411.h"
#include "modules/canbus_vehicle/lexus/protocol/door_rpt_417.h"
#include "modules/canbus_vehicle/lexus/protocol/global_rpt_10.h"
#include "modules/canbus_vehicle/lexus/protocol/hazard_lights_rpt_214.h"
#include "modules/canbus_vehicle/lexus/protocol/headlight_aux_rpt_318.h"
#include "modules/canbus_vehicle/lexus/protocol/headlight_rpt_218.h"
#include "modules/canbus_vehicle/lexus/protocol/horn_rpt_21c.h"
#include "modules/canbus_vehicle/lexus/protocol/interior_lights_rpt_416.h"
#include "modules/canbus_vehicle/lexus/protocol/lat_lon_heading_rpt_40e.h"
#include "modules/canbus_vehicle/lexus/protocol/media_controls_cmd_120.h"
#include "modules/canbus_vehicle/lexus/protocol/media_controls_rpt_220.h"
#include "modules/canbus_vehicle/lexus/protocol/occupancy_rpt_415.h"
#include "modules/canbus_vehicle/lexus/protocol/parking_brake_rpt_224.h"
#include "modules/canbus_vehicle/lexus/protocol/rear_lights_rpt_418.h"
#include "modules/canbus_vehicle/lexus/protocol/shift_aux_rpt_328.h"
#include "modules/canbus_vehicle/lexus/protocol/shift_rpt_228.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_aux_rpt_32c.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_1_404.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_2_405.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_3_406.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_rpt_22c.h"
#include "modules/canbus_vehicle/lexus/protocol/turn_aux_rpt_330.h"
#include "modules/canbus_vehicle/lexus/protocol/turn_rpt_230.h"
#include "modules/canbus_vehicle/lexus/protocol/veh_dynamics_rpt_413.h"
#include "modules/canbus_vehicle/lexus/protocol/veh_specific_rpt_1_412.h"
#include "modules/canbus_vehicle/lexus/protocol/vehicle_speed_rpt_400.h"
#include "modules/canbus_vehicle/lexus/protocol/vin_rpt_414.h"
#include "modules/canbus_vehicle/lexus/protocol/wheel_speed_rpt_407.h"
#include "modules/canbus_vehicle/lexus/protocol/wiper_aux_rpt_334.h"
#include "modules/canbus_vehicle/lexus/protocol/wiper_rpt_234.h"
#include "modules/canbus_vehicle/lexus/protocol/yaw_rate_rpt_40d.h"
namespace apollo {
namespace canbus {
namespace lexus {
LexusMessageManager::LexusMessageManager() {
// Control Messages
AddSendProtocolData<Accelcmd100, true>();
AddSendProtocolData<Brakecmd104, true>();
AddSendProtocolData<Cruisecontrolbuttonscmd108, true>();
AddSendProtocolData<Dashcontrolsrightrpt210, true>();
AddSendProtocolData<Hazardlightscmd114, true>();
AddSendProtocolData<Headlightcmd118, true>();
AddSendProtocolData<Horncmd11c, true>();
AddSendProtocolData<Parkingbrakecmd124, true>();
AddSendProtocolData<Shiftcmd128, true>();
AddSendProtocolData<Steeringcmd12c, true>();
AddSendProtocolData<Turncmd130, true>();
AddSendProtocolData<Wipercmd134, true>();
// Report Messages
AddRecvProtocolData<Accelauxrpt300, true>();
AddRecvProtocolData<Accelrpt200, true>();
AddRecvProtocolData<Brakeauxrpt304, true>();
AddRecvProtocolData<Brakemotorrpt1401, true>();
AddRecvProtocolData<Brakemotorrpt2402, true>();
AddRecvProtocolData<Brakemotorrpt3403, true>();
AddRecvProtocolData<Brakerpt204, true>();
AddRecvProtocolData<Componentrpt20, true>();
AddRecvProtocolData<Cruisecontrolbuttonsrpt208, true>();
AddRecvProtocolData<Dashcontrolsleftcmd10c, true>();
AddRecvProtocolData<Dashcontrolsleftrpt20c, true>();
AddRecvProtocolData<Dashcontrolsrightcmd110, true>();
AddRecvProtocolData<Datetimerpt40f, true>();
AddRecvProtocolData<Detectedobjectrpt411, true>();
AddRecvProtocolData<Doorrpt417, true>();
AddRecvProtocolData<Globalrpt10, true>();
AddRecvProtocolData<Hazardlightsrpt214, true>();
AddRecvProtocolData<Headlightauxrpt318, true>();
AddRecvProtocolData<Headlightrpt218, true>();
AddRecvProtocolData<Hornrpt21c, true>();
AddRecvProtocolData<Interiorlightsrpt416, true>();
AddRecvProtocolData<Latlonheadingrpt40e, true>();
AddRecvProtocolData<Mediacontrolscmd120, true>();
AddRecvProtocolData<Mediacontrolsrpt220, true>();
AddRecvProtocolData<Occupancyrpt415, true>();
AddRecvProtocolData<Parkingbrakerpt224, true>();
AddRecvProtocolData<Rearlightsrpt418, true>();
AddRecvProtocolData<Shiftauxrpt328, true>();
AddRecvProtocolData<Shiftrpt228, true>();
AddRecvProtocolData<Steeringauxrpt32c, true>();
AddRecvProtocolData<Steeringmotorrpt1404, true>();
AddRecvProtocolData<Steeringmotorrpt2405, true>();
AddRecvProtocolData<Steeringmotorrpt3406, true>();
AddRecvProtocolData<Steeringrpt22c, true>();
AddRecvProtocolData<Turnauxrpt330, true>();
AddRecvProtocolData<Turnrpt230, true>();
AddRecvProtocolData<Vehdynamicsrpt413, true>();
AddRecvProtocolData<Vehiclespeedrpt400, true>();
AddRecvProtocolData<Vehspecificrpt1412, true>();
AddRecvProtocolData<Vinrpt414, true>();
AddRecvProtocolData<Wheelspeedrpt407, true>();
AddRecvProtocolData<Wiperauxrpt334, true>();
AddRecvProtocolData<Wiperrpt234, true>();
AddRecvProtocolData<Yawraterpt40d, true>();
}
LexusMessageManager::~LexusMessageManager() {}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_controller.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/lexus_controller.h"
#include "modules/common_msgs/basic_msgs/vehicle_signal.pb.h"
#include "cyber/common/log.h"
#include "cyber/time/time.h"
#include "modules/canbus_vehicle/lexus/lexus_message_manager.h"
#include "modules/canbus/vehicle/vehicle_controller.h"
#include "modules/drivers/canbus/can_comm/can_sender.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::common::ErrorCode;
using ::apollo::control::ControlCommand;
using ::apollo::drivers::canbus::ProtocolData;
namespace {
const int32_t kMaxFailAttempt = 10;
const int32_t CHECK_RESPONSE_STEER_UNIT_FLAG = 1;
const int32_t CHECK_RESPONSE_SPEED_UNIT_FLAG = 2;
} // namespace
ErrorCode LexusController::Init(
const VehicleParameter& params,
CanSender<::apollo::canbus::Lexus>* const can_sender,
MessageManager<::apollo::canbus::Lexus>* const message_manager) {
if (is_initialized_) {
AINFO << "LexusController has already been initiated.";
return ErrorCode::CANBUS_ERROR;
}
vehicle_params_.CopyFrom(
common::VehicleConfigHelper::Instance()->GetConfig().vehicle_param());
params_.CopyFrom(params);
if (!params_.has_driving_mode()) {
AERROR << "Vehicle conf pb not set driving_mode.";
return ErrorCode::CANBUS_ERROR;
}
if (can_sender == nullptr) {
AERROR << "Canbus sender is null.";
return ErrorCode::CANBUS_ERROR;
}
can_sender_ = can_sender;
if (message_manager == nullptr) {
AERROR << "Protocol manager is null.";
return ErrorCode::CANBUS_ERROR;
}
message_manager_ = message_manager;
// Sender part
accel_cmd_100_ = dynamic_cast<Accelcmd100*>(
message_manager_->GetMutableProtocolDataById(Accelcmd100::ID));
if (accel_cmd_100_ == nullptr) {
AERROR << "Accelcmd100 does not exist in the LexusMessalexusanager!";
return ErrorCode::CANBUS_ERROR;
}
brake_cmd_104_ = dynamic_cast<Brakecmd104*>(
message_manager_->GetMutableProtocolDataById(Brakecmd104::ID));
if (brake_cmd_104_ == nullptr) {
AERROR << "Brakecmd104 does not exist in the LexusMessalexusanager!";
return ErrorCode::CANBUS_ERROR;
}
shift_cmd_128_ = dynamic_cast<Shiftcmd128*>(
message_manager_->GetMutableProtocolDataById(Shiftcmd128::ID));
if (shift_cmd_128_ == nullptr) {
AERROR << "Shiftcmd128 does not exist in the LexusMessalexusanager!";
return ErrorCode::CANBUS_ERROR;
}
turn_cmd_130_ = dynamic_cast<Turncmd130*>(
message_manager_->GetMutableProtocolDataById(Turncmd130::ID));
if (turn_cmd_130_ == nullptr) {
AERROR << "Turncmd130 does not exist in the LexusMessageManager!";
return ErrorCode::CANBUS_ERROR;
}
steering_cmd_12c_ = dynamic_cast<Steeringcmd12c*>(
message_manager_->GetMutableProtocolDataById(Steeringcmd12c::ID));
if (steering_cmd_12c_ == nullptr) {
AERROR << "Steeringcmd12c does not exist in the LexusMessageManager!";
return ErrorCode::CANBUS_ERROR;
}
can_sender_->AddMessage(Accelcmd100::ID, accel_cmd_100_, false);
can_sender_->AddMessage(Brakecmd104::ID, brake_cmd_104_, false);
can_sender_->AddMessage(Shiftcmd128::ID, shift_cmd_128_, false);
can_sender_->AddMessage(Steeringcmd12c::ID, steering_cmd_12c_, false);
can_sender_->AddMessage(Turncmd130::ID, turn_cmd_130_, false);
// Need to sleep to ensure all messages were received
AINFO << "LexusController is initialized.";
is_initialized_ = true;
return ErrorCode::OK;
}
LexusController::~LexusController() {}
bool LexusController::Start() {
if (!is_initialized_) {
AERROR << "LexusController has NOT been initiated.";
return false;
}
const auto& update_func = [this] { SecurityDogThreadFunc(); };
thread_.reset(new std::thread(update_func));
return true;
}
void LexusController::Stop() {
if (!is_initialized_) {
AERROR << "LexusController stops or starts improperly!";
return;
}
if (thread_ != nullptr && thread_->joinable()) {
thread_->join();
thread_.reset();
AINFO << "LexusController stopped.";
}
}
Chassis LexusController::chassis() {
chassis_.Clear();
Lexus chassis_detail;
message_manager_->GetSensorData(&chassis_detail);
// 21, 22, previously 1, 2
if (driving_mode() == Chassis::EMERGENCY_MODE) {
set_chassis_error_code(Chassis::NO_ERROR);
}
chassis_.set_driving_mode(driving_mode());
chassis_.set_error_code(chassis_error_code());
// 3
chassis_.set_engine_started(true);
// 5
if (chassis_detail.has_vehicle_speed_rpt_400() &&
chassis_detail.vehicle_speed_rpt_400().has_vehicle_speed()) {
chassis_.set_speed_mps(static_cast<float>(
chassis_detail.vehicle_speed_rpt_400().vehicle_speed()));
} else {
chassis_.set_speed_mps(0);
}
if (chassis_detail.has_wheel_speed_rpt_407()) {
// TODO(QiL) : No wheel speed valid bit in lexus, so default valid
chassis_.mutable_wheel_speed()->set_is_wheel_spd_rr_valid(true);
// chassis_.mutable_wheel_speed()->set_wheel_direction_rr(true);
chassis_.mutable_wheel_speed()->set_wheel_spd_rr(
chassis_detail.wheel_speed_rpt_407().wheel_spd_rear_right());
chassis_.mutable_wheel_speed()->set_is_wheel_spd_rl_valid(true);
/*
chassis_.mutable_wheel_speed()->set_wheel_direction_rl(
chassis_detail.vehicle_spd().wheel_direction_rl());
*/
chassis_.mutable_wheel_speed()->set_wheel_spd_rl(
chassis_detail.wheel_speed_rpt_407().wheel_spd_rear_left());
chassis_.mutable_wheel_speed()->set_is_wheel_spd_fr_valid(true);
/*
chassis_.mutable_wheel_speed()->set_wheel_direction_fr(
chassis_detail.vehicle_spd().wheel_direction_fr());
*/
chassis_.mutable_wheel_speed()->set_wheel_spd_fr(
chassis_detail.wheel_speed_rpt_407().wheel_spd_front_right());
chassis_.mutable_wheel_speed()->set_is_wheel_spd_fl_valid(true);
/*
chassis_.mutable_wheel_speed()->set_wheel_direction_fl(
chassis_detail.vehicle_spd().wheel_direction_fl());
*/
chassis_.mutable_wheel_speed()->set_wheel_spd_fl(
chassis_detail.wheel_speed_rpt_407().wheel_spd_front_left());
}
// 7
chassis_.set_fuel_range_m(0);
// 8
if (chassis_detail.has_accel_rpt_200() &&
chassis_detail.accel_rpt_200().has_output_value()) {
// TODO(snehagn): Temp fix until AS to fix the scaling
chassis_.set_throttle_percentage(static_cast<float>(
chassis_detail.accel_rpt_200().output_value() * 100));
} else {
chassis_.set_throttle_percentage(0);
}
// 9
if (chassis_detail.has_brake_rpt_204() &&
chassis_detail.brake_rpt_204().has_output_value()) {
// TODO(snehagn): Temp fix until AS to fix the scaling
chassis_.set_brake_percentage(static_cast<float>(
chassis_detail.brake_rpt_204().output_value() * 100));
} else {
chassis_.set_brake_percentage(0);
}
// 23, previously 10
if (chassis_detail.has_shift_rpt_228() &&
chassis_detail.shift_rpt_228().has_output_value()) {
AINFO << "Start reading shift values";
Chassis::GearPosition gear_pos = Chassis::GEAR_INVALID;
if (chassis_detail.shift_rpt_228().output_value() ==
Shift_rpt_228::OUTPUT_VALUE_PARK) {
gear_pos = Chassis::GEAR_PARKING;
}
if (chassis_detail.shift_rpt_228().output_value() ==
Shift_rpt_228::OUTPUT_VALUE_NEUTRAL) {
gear_pos = Chassis::GEAR_NEUTRAL;
}
if (chassis_detail.shift_rpt_228().output_value() ==
Shift_rpt_228::OUTPUT_VALUE_REVERSE) {
gear_pos = Chassis::GEAR_REVERSE;
}
if (chassis_detail.shift_rpt_228().output_value() ==
Shift_rpt_228::OUTPUT_VALUE_FORWARD_HIGH) {
gear_pos = Chassis::GEAR_DRIVE;
}
chassis_.set_gear_location(gear_pos);
} else {
chassis_.set_gear_location(Chassis::GEAR_NONE);
}
// 11
// TODO(QiL) : verify the unit here.
if (chassis_detail.has_steering_rpt_22c() &&
chassis_detail.steering_rpt_22c().has_output_value()) {
chassis_.set_steering_percentage(
static_cast<float>(chassis_detail.steering_rpt_22c().output_value() *
100.0 / vehicle_params_.max_steer_angle()));
} else {
chassis_.set_steering_percentage(0);
}
// 16, 17
if (chassis_detail.has_turn_rpt_230() &&
chassis_detail.turn_rpt_230().has_output_value() &&
chassis_detail.turn_rpt_230().output_value() !=
Turn_rpt_230::OUTPUT_VALUE_NONE) {
if (chassis_detail.turn_rpt_230().output_value() ==
Turn_rpt_230::OUTPUT_VALUE_LEFT) {
chassis_.mutable_signal()->set_turn_signal(
common::VehicleSignal::TURN_LEFT);
} else if (chassis_detail.turn_rpt_230().output_value() ==
Turn_rpt_230::OUTPUT_VALUE_RIGHT) {
chassis_.mutable_signal()->set_turn_signal(
common::VehicleSignal::TURN_RIGHT);
} else {
chassis_.mutable_signal()->set_turn_signal(
common::VehicleSignal::TURN_NONE);
}
} else {
chassis_.mutable_signal()->set_turn_signal(
common::VehicleSignal::TURN_NONE);
}
// TODO(all): implement the rest here/
// 26
if (chassis_error_mask_) {
chassis_.set_chassis_error_mask(chassis_error_mask_);
}
// give engage_advice based on error_code and canbus feedback
if (!chassis_error_mask_ && !chassis_.parking_brake()) {
chassis_.mutable_engage_advice()->set_advice(
apollo::common::EngageAdvice::READY_TO_ENGAGE);
} else {
chassis_.mutable_engage_advice()->set_advice(
apollo::common::EngageAdvice::DISALLOW_ENGAGE);
chassis_.mutable_engage_advice()->set_reason(
"CANBUS not ready, firmware error or emergency button pressed!");
}
return chassis_;
}
bool LexusController::VerifyID() { return true; }
void LexusController::Emergency() {
set_driving_mode(Chassis::EMERGENCY_MODE);
ResetProtocol();
}
ErrorCode LexusController::EnableAutoMode() {
if (driving_mode() == Chassis::COMPLETE_AUTO_DRIVE) {
AINFO << "Already in COMPLETE_AUTO_DRIVE mode";
return ErrorCode::OK;
}
accel_cmd_100_->set_enable(true);
accel_cmd_100_->set_clear_override(true);
brake_cmd_104_->set_enable(true);
brake_cmd_104_->set_clear_override(true);
steering_cmd_12c_->set_enable(true);
steering_cmd_12c_->set_clear_override(true);
shift_cmd_128_->set_enable(true);
shift_cmd_128_->set_clear_override(true);
can_sender_->Update();
const int32_t flag =
CHECK_RESPONSE_STEER_UNIT_FLAG | CHECK_RESPONSE_SPEED_UNIT_FLAG;
if (!CheckResponse(flag, true)) {
AERROR << "Failed to switch to COMPLETE_AUTO_DRIVE mode.";
Emergency();
set_chassis_error_code(Chassis::CHASSIS_ERROR);
return ErrorCode::CANBUS_ERROR;
}
set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
AINFO << "Switch to COMPLETE_AUTO_DRIVE mode ok.";
return ErrorCode::OK;
}
ErrorCode LexusController::DisableAutoMode() {
ResetProtocol();
can_sender_->Update();
set_driving_mode(Chassis::COMPLETE_MANUAL);
set_chassis_error_code(Chassis::NO_ERROR);
AINFO << "Switch to COMPLETE_MANUAL ok.";
return ErrorCode::OK;
}
ErrorCode LexusController::EnableSteeringOnlyMode() {
if (driving_mode() == Chassis::COMPLETE_AUTO_DRIVE ||
driving_mode() == Chassis::AUTO_STEER_ONLY) {
set_driving_mode(Chassis::AUTO_STEER_ONLY);
AINFO << "Already in AUTO_STEER_ONLY mode";
return ErrorCode::OK;
}
accel_cmd_100_->set_enable(false);
brake_cmd_104_->set_enable(false);
steering_cmd_12c_->set_enable(false);
shift_cmd_128_->set_enable(false);
can_sender_->Update();
if (!CheckResponse(CHECK_RESPONSE_STEER_UNIT_FLAG, true)) {
AERROR << "Failed to switch to AUTO_STEER_ONLY mode.";
Emergency();
set_chassis_error_code(Chassis::CHASSIS_ERROR);
return ErrorCode::CANBUS_ERROR;
}
set_driving_mode(Chassis::AUTO_STEER_ONLY);
AINFO << "Switch to AUTO_STEER_ONLY mode ok.";
return ErrorCode::OK;
}
ErrorCode LexusController::EnableSpeedOnlyMode() {
if (driving_mode() == Chassis::COMPLETE_AUTO_DRIVE ||
driving_mode() == Chassis::AUTO_SPEED_ONLY) {
set_driving_mode(Chassis::AUTO_SPEED_ONLY);
AINFO << "Already in AUTO_SPEED_ONLY mode.";
return ErrorCode::OK;
}
accel_cmd_100_->set_enable(false);
brake_cmd_104_->set_enable(false);
steering_cmd_12c_->set_enable(false);
shift_cmd_128_->set_enable(false);
can_sender_->Update();
if (!CheckResponse(CHECK_RESPONSE_SPEED_UNIT_FLAG, true)) {
AERROR << "Failed to switch to AUTO_SPEED_ONLY mode.";
Emergency();
set_chassis_error_code(Chassis::CHASSIS_ERROR);
return ErrorCode::CANBUS_ERROR;
}
set_driving_mode(Chassis::AUTO_SPEED_ONLY);
AINFO << "Switch to AUTO_SPEED_ONLY mode ok.";
return ErrorCode::OK;
}
// NEUTRAL, REVERSE, DRIVE
void LexusController::Gear(Chassis::GearPosition gear_position) {
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_SPEED_ONLY) {
AINFO << "This drive mode no need to set gear.";
return;
}
switch (gear_position) {
case Chassis::GEAR_NEUTRAL: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_NEUTRAL);
break;
}
case Chassis::GEAR_REVERSE: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_REVERSE);
break;
}
case Chassis::GEAR_DRIVE: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_FORWARD_HIGH);
break;
}
case Chassis::GEAR_PARKING: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_PARK);
break;
}
case Chassis::GEAR_LOW: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_LOW);
break;
}
case Chassis::GEAR_NONE: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_NONE);
break;
}
case Chassis::GEAR_INVALID: {
AERROR << "Gear command is invalid!";
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_NONE);
break;
}
default: {
shift_cmd_128_->set_shift_cmd(Shift_cmd_128::SHIFT_CMD_NONE);
break;
}
}
}
// brake with new acceleration
// acceleration:0.00~99.99, unit:
// acceleration:0.0 ~ 7.0, unit:m/s^2
// acceleration_spd:60 ~ 100, suggest: 90
// -> pedal
void LexusController::Brake(double pedal) {
// double real_value = params_.max_acc() * acceleration / 100;
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_SPEED_ONLY) {
AINFO << "The current drive mode does not need to set acceleration.";
return;
}
brake_cmd_104_->set_brake_cmd(pedal);
}
// drive with old acceleration
// gas:0.00~99.99 unit:
void LexusController::Throttle(double pedal) {
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_SPEED_ONLY) {
AINFO << "The current drive mode does not need to set acceleration.";
return;
}
accel_cmd_100_->set_accel_cmd(pedal);
}
// drive with acceleration/deceleration
// acc:-7.0 ~ 5.0, unit:m/s^2
void LexusController::Acceleration(double acc) {
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_SPEED_ONLY) {
AINFO << "The current drive mode does not need to set acceleration.";
return;
}
// None
}
// TODO(Yu/QiL): double check the physical range, unit and direction for Lexus
// lexus default -32.768 ~ 32.767, unit: rad, left:-, right:+ in canbus protocol
// need to be compatible with control module, so reverse steering
// angle:-99.99~0.00~99.99, unit: %, left:+, right:- in control module
void LexusController::Steer(double angle) {
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_STEER_ONLY) {
AINFO << "The current driving mode does not need to set steer.";
return;
}
const double real_angle = vehicle_params_.max_steer_angle() * angle / 100.0;
// TODO(Yu/QiL): double checck to decide if reverse sign needed
steering_cmd_12c_->set_position(real_angle);
// TODO(QiL) : double check this rate
steering_cmd_12c_->set_rotation_rate(40);
}
// TODO(Yu/QiL): double check the physical range, unit and direction for Lexus
// lexus default -32.768 ~ 32.767, unit: rad, left:-, right:+ in canbus protocol
// lexus default 0 ~ 65.535, unit: rad/sec, in canbus protocol
// steering with new angle speed
// angle:-99.99~0.00~99.99, unit:%, left:+, right:- in control module
// angle_spd:0.00~99.99, unit:%
void LexusController::Steer(double angle, double angle_spd) {
if (driving_mode() != Chassis::COMPLETE_AUTO_DRIVE &&
driving_mode() != Chassis::AUTO_STEER_ONLY) {
AINFO << "The current driving mode does not need to set steer.";
return;
}
const double real_angle = vehicle_params_.max_steer_angle() * angle / 100.0;
const double real_angle_spd =
ProtocolData<::apollo::canbus::Lexus>::BoundedValue(
vehicle_params_.min_steer_angle_rate(),
vehicle_params_.max_steer_angle_rate(),
vehicle_params_.max_steer_angle_rate() * angle_spd / 100.0);
// TODO(Yu/QiL): double checck to decide if reverse sign needed
steering_cmd_12c_->set_position(real_angle);
steering_cmd_12c_->set_rotation_rate(real_angle_spd);
}
void LexusController::SetEpbBreak(const ControlCommand& command) {
if (command.parking_brake()) {
// None
} else {
// None
}
}
void LexusController::SetBeam(const ControlCommand& command) {
if (command.signal().high_beam()) {
// None
} else if (command.signal().low_beam()) {
// None
} else {
// None
}
}
void LexusController::SetHorn(const ControlCommand& command) {
if (command.signal().horn()) {
// None
} else {
// None
}
}
void LexusController::SetTurningSignal(const ControlCommand& command) {
auto signal = command.signal().turn_signal();
if (signal == common::VehicleSignal::TURN_LEFT) {
turn_cmd_130_->set_turn_signal_cmd(Turn_cmd_130::TURN_SIGNAL_CMD_LEFT);
} else if (signal == common::VehicleSignal::TURN_RIGHT) {
turn_cmd_130_->set_turn_signal_cmd(Turn_cmd_130::TURN_SIGNAL_CMD_RIGHT);
} else {
turn_cmd_130_->set_turn_signal_cmd(Turn_cmd_130::TURN_SIGNAL_CMD_NONE);
}
}
void LexusController::ResetProtocol() { message_manager_->ResetSendMessages(); }
bool LexusController::CheckChassisError() {
/* ADD YOUR OWN CAR CHASSIS OPERATION
*/
return false;
}
void LexusController::SecurityDogThreadFunc() {
int32_t vertical_ctrl_fail = 0;
int32_t horizontal_ctrl_fail = 0;
if (can_sender_ == nullptr) {
AERROR << "Failed to run SecurityDogThreadFunc() because can_sender_ is "
"nullptr.";
return;
}
while (!can_sender_->IsRunning()) {
std::this_thread::yield();
}
std::chrono::duration<double, std::micro> default_period{50000};
int64_t start = 0;
int64_t end = 0;
while (can_sender_->IsRunning()) {
start = ::apollo::cyber::Time::Now().ToMicrosecond();
const Chassis::DrivingMode mode = driving_mode();
bool emergency_mode = false;
// 1. horizontal control check
if ((mode == Chassis::COMPLETE_AUTO_DRIVE ||
mode == Chassis::AUTO_STEER_ONLY) &&
!CheckResponse(CHECK_RESPONSE_STEER_UNIT_FLAG, false)) {
++horizontal_ctrl_fail;
if (horizontal_ctrl_fail >= kMaxFailAttempt) {
emergency_mode = true;
set_chassis_error_code(Chassis::MANUAL_INTERVENTION);
}
} else {
horizontal_ctrl_fail = 0;
}
// 2. vertical control check
if ((mode == Chassis::COMPLETE_AUTO_DRIVE ||
mode == Chassis::AUTO_SPEED_ONLY) &&
!CheckResponse(CHECK_RESPONSE_SPEED_UNIT_FLAG, false)) {
++vertical_ctrl_fail;
if (vertical_ctrl_fail >= kMaxFailAttempt) {
emergency_mode = true;
set_chassis_error_code(Chassis::MANUAL_INTERVENTION);
}
} else {
vertical_ctrl_fail = 0;
}
if (CheckChassisError()) {
set_chassis_error_code(Chassis::CHASSIS_ERROR);
emergency_mode = true;
}
if (emergency_mode && mode != Chassis::EMERGENCY_MODE) {
set_driving_mode(Chassis::EMERGENCY_MODE);
message_manager_->ResetSendMessages();
}
end = ::apollo::cyber::Time::Now().ToMicrosecond();
std::chrono::duration<double, std::micro> elapsed{end - start};
if (elapsed < default_period) {
std::this_thread::sleep_for(default_period - elapsed);
} else {
AERROR << "Too much time consumption in LexusController looping process:"
<< elapsed.count();
}
}
}
bool LexusController::CheckResponse(const int32_t flags, bool need_wait) {
// for Lexus, we assume CheckResponse will take 300ms. We leave a 100ms buffer
// for it.
// TODO(Yu) : check whether the current retry_num match the assumed time
// consumption
int32_t retry_num = 20;
Lexus chassis_detail;
bool is_accel_enabled = false;
bool is_brake_enabled = false;
bool is_steering_enabled = false;
do {
if (message_manager_->GetSensorData(&chassis_detail) != ErrorCode::OK) {
AERROR_EVERY(100) << "Get chassis detail failed.";
return false;
}
bool check_ok = true;
if (flags & CHECK_RESPONSE_STEER_UNIT_FLAG) {
is_steering_enabled = chassis_detail.has_steering_rpt_22c() &&
chassis_detail.steering_rpt_22c().has_enabled() &&
chassis_detail.steering_rpt_22c().enabled();
check_ok = check_ok && is_steering_enabled;
}
if (flags & CHECK_RESPONSE_SPEED_UNIT_FLAG) {
is_brake_enabled = chassis_detail.has_brake_rpt_204() &&
chassis_detail.brake_rpt_204().has_enabled() &&
chassis_detail.brake_rpt_204().enabled();
is_accel_enabled = chassis_detail.has_accel_rpt_200() &&
chassis_detail.accel_rpt_200().has_enabled() &&
chassis_detail.accel_rpt_200().enabled();
check_ok = check_ok && is_brake_enabled && is_accel_enabled;
}
if (check_ok) {
return true;
}
if (need_wait) {
--retry_num;
std::this_thread::sleep_for(
std::chrono::duration<double, std::milli>(20));
}
} while (need_wait && retry_num);
// If check_response fails, then report the specific module failure online
AERROR << "check_response fail: is_steering_enabled:" << is_steering_enabled
<< ", is_brake_enabled:" << is_brake_enabled
<< ", is_accel_enabled:" << is_accel_enabled;
return false;
}
void LexusController::set_chassis_error_mask(const int32_t mask) {
std::lock_guard<std::mutex> lock(chassis_mask_mutex_);
chassis_error_mask_ = mask;
}
int32_t LexusController::chassis_error_mask() {
std::lock_guard<std::mutex> lock(chassis_mask_mutex_);
return chassis_error_mask_;
}
Chassis::ErrorCode LexusController::chassis_error_code() {
std::lock_guard<std::mutex> lock(chassis_error_code_mutex_);
return chassis_error_code_;
}
void LexusController::set_chassis_error_code(
const Chassis::ErrorCode& error_code) {
std::lock_guard<std::mutex> lock(chassis_error_code_mutex_);
chassis_error_code_ = error_code;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/cyberfile.xml
|
<package format="2">
<name>canbus-vehicle-lexus</name>
<version>local</version>
<description>
Dynamic loading for canbus lexus vehicle module
</description>
<maintainer email="apollo-support@baidu.com">Apollo</maintainer>
<license>Apache License 2.0</license>
<url type="website">https://www.apollo.auto/</url>
<url type="repository">https://github.com/ApolloAuto/apollo</url>
<url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url>
<type>module</type>
<src_path url="https://github.com/ApolloAuto/apollo">//modules/canbus_vehicle/lexus</src_path>
<depend type="binary" repo_name="cyber">cyber-dev</depend>
<depend type="binary" repo_name="common" lib_names="common">common-dev</depend>
<depend type="binary" repo_name="canbus" lib_names="canbus">canbus-dev</depend>
<depend repo_name="common-msgs" lib_names="common-msgs">common-msgs-dev</depend>
<depend type="binary" repo_name="drivers">drivers-dev</depend>
<depend repo_name="com_google_googletest" lib_names="gtest,gtest_main">3rd-gtest-dev</depend>
</package>
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_vehicle_factory.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file lexus_vehicle_factory.h
*/
#pragma once
#include <memory>
#include "modules/canbus/proto/canbus_conf.pb.h"
#include "modules/canbus/proto/vehicle_parameter.pb.h"
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
#include "cyber/cyber.h"
#include "modules/canbus/vehicle/abstract_vehicle_factory.h"
#include "modules/canbus/vehicle/vehicle_controller.h"
#include "modules/common/status/status.h"
#include "modules/drivers/canbus/can_client/can_client.h"
#include "modules/drivers/canbus/can_comm/can_receiver.h"
#include "modules/drivers/canbus/can_comm/can_sender.h"
#include "modules/drivers/canbus/can_comm/message_manager.h"
/**
* @namespace apollo::canbus
* @brief apollo::canbus
*/
namespace apollo {
namespace canbus {
/**
* @class LexusVehicleFactory
*
* @brief this class is inherited from AbstractVehicleFactory. It can be used to
* create controller and message manager for lexus vehicle.
*/
class LexusVehicleFactory : public AbstractVehicleFactory {
public:
/**
* @brief destructor
*/
virtual ~LexusVehicleFactory() = default;
/**
* @brief init vehicle factory
* @returns true if successfully initialized
*/
bool Init(const CanbusConf *canbus_conf) override;
/**
* @brief start canclient, cansender, canreceiver, vehicle controller
* @returns true if successfully started
*/
bool Start() override;
/**
* @brief create ch vehicle controller
* @returns a unique_ptr that points to the created controller
*/
void Stop() override;
/**
* @brief update control command
*/
void UpdateCommand(
const apollo::control::ControlCommand *control_command) override;
/**
* @brief publish chassis messages
*/
Chassis publish_chassis() override;
/**
* @brief publish chassis for vehicle messages
*/
void PublishChassisDetail() override;
private:
/**
* @brief create lexus vehicle controller
* @returns a unique_ptr that points to the created controller
*/
std::unique_ptr<VehicleController<::apollo::canbus::Lexus>>
CreateVehicleController();
/**
* @brief create lexus message manager
* @returns a unique_ptr that points to the created message manager
*/
std::unique_ptr<MessageManager<::apollo::canbus::Lexus>>
CreateMessageManager();
std::unique_ptr<::apollo::cyber::Node> node_ = nullptr;
std::unique_ptr<apollo::drivers::canbus::CanClient> can_client_;
CanSender<::apollo::canbus::Lexus> can_sender_;
apollo::drivers::canbus::CanReceiver<::apollo::canbus::Lexus> can_receiver_;
std::unique_ptr<MessageManager<::apollo::canbus::Lexus>> message_manager_;
std::unique_ptr<VehicleController<::apollo::canbus::Lexus>>
vehicle_controller_;
std::shared_ptr<::apollo::cyber::Writer<::apollo::canbus::Lexus>>
chassis_detail_writer_;
};
CYBER_REGISTER_VEHICLEFACTORY(LexusVehicleFactory)
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_controller_test.cc
|
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
*implied. See the License for the specific language governing permissions
*and limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/lexus_controller.h"
#include "cyber/common/file.h"
#include "gtest/gtest.h"
#include "modules/canbus/proto/canbus_conf.pb.h"
#include "modules/common_msgs/chassis_msgs/chassis.pb.h"
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/canbus_vehicle/lexus/lexus_message_manager.h"
#include "modules/common_msgs/basic_msgs/vehicle_signal.pb.h"
#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
#include "modules/drivers/canbus/can_comm/can_sender.h"
namespace apollo {
namespace canbus {
namespace lexus {
using apollo::common::ErrorCode;
using apollo::common::VehicleSignal;
using apollo::control::ControlCommand;
class LexusControllerTest : public ::testing::Test {
public:
virtual void SetUp() {
std::string canbus_conf_file =
"/apollo/modules/canbus/testdata/conf/lexus_canbus_conf_test.pb.txt";
cyber::common::GetProtoFromFile(canbus_conf_file, &canbus_conf_);
params_ = canbus_conf_.vehicle_parameter();
control_cmd_.set_throttle(20.0);
control_cmd_.set_brake(0.0);
control_cmd_.set_steering_rate(80.0);
control_cmd_.set_horn(false);
}
protected:
LexusController controller_;
ControlCommand control_cmd_;
VehicleSignal vehicle_signal_;
CanSender<::apollo::canbus::Lexus> sender_;
LexusMessageManager msg_manager_;
CanbusConf canbus_conf_;
VehicleParameter params_;
};
TEST_F(LexusControllerTest, Init) {
ErrorCode ret = controller_.Init(params_, &sender_, &msg_manager_);
EXPECT_EQ(ret, ErrorCode::OK);
}
TEST_F(LexusControllerTest, SetDrivingMode) {
Chassis chassis;
chassis.set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
controller_.Init(params_, &sender_, &msg_manager_);
controller_.set_driving_mode(chassis.driving_mode());
EXPECT_EQ(controller_.driving_mode(), chassis.driving_mode());
EXPECT_EQ(controller_.SetDrivingMode(chassis.driving_mode()), ErrorCode::OK);
}
TEST_F(LexusControllerTest, Status) {
controller_.Init(params_, &sender_, &msg_manager_);
controller_.set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
EXPECT_EQ(controller_.Update(control_cmd_), ErrorCode::OK);
controller_.SetHorn(control_cmd_);
controller_.SetBeam(control_cmd_);
controller_.SetTurningSignal(control_cmd_);
EXPECT_FALSE(controller_.CheckChassisError());
EXPECT_EQ(controller_.chassis_error_code(), Chassis::NO_ERROR);
}
TEST_F(LexusControllerTest, UpdateDrivingMode) {
controller_.Init(params_, &sender_, &msg_manager_);
controller_.set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
EXPECT_EQ(controller_.SetDrivingMode(Chassis::COMPLETE_MANUAL),
ErrorCode::OK);
controller_.set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
EXPECT_EQ(controller_.SetDrivingMode(Chassis::AUTO_STEER_ONLY),
ErrorCode::OK);
controller_.set_driving_mode(Chassis::COMPLETE_AUTO_DRIVE);
EXPECT_EQ(controller_.SetDrivingMode(Chassis::AUTO_SPEED_ONLY),
ErrorCode::OK);
EXPECT_EQ(controller_.SetDrivingMode(Chassis::COMPLETE_AUTO_DRIVE),
ErrorCode::CANBUS_ERROR);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_controller.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include <memory>
#include <thread>
#include "gtest/gtest_prod.h"
#include "modules/canbus/proto/canbus_conf.pb.h"
#include "modules/canbus/proto/vehicle_parameter.pb.h"
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/common_msgs/basic_msgs/error_code.pb.h"
#include "modules/common_msgs/chassis_msgs/chassis.pb.h"
#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
#include "modules/canbus_vehicle/lexus/protocol/accel_cmd_100.h"
#include "modules/canbus_vehicle/lexus/protocol/brake_cmd_104.h"
#include "modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_cmd_108.h"
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_right_rpt_210.h"
#include "modules/canbus_vehicle/lexus/protocol/hazard_lights_cmd_114.h"
#include "modules/canbus_vehicle/lexus/protocol/headlight_cmd_118.h"
#include "modules/canbus_vehicle/lexus/protocol/horn_cmd_11c.h"
#include "modules/canbus_vehicle/lexus/protocol/parking_brake_cmd_124.h"
#include "modules/canbus_vehicle/lexus/protocol/shift_cmd_128.h"
#include "modules/canbus_vehicle/lexus/protocol/steering_cmd_12c.h"
#include "modules/canbus_vehicle/lexus/protocol/turn_cmd_130.h"
#include "modules/canbus_vehicle/lexus/protocol/wiper_cmd_134.h"
#include "modules/canbus/vehicle/vehicle_controller.h"
namespace apollo {
namespace canbus {
namespace lexus {
class LexusController final
: public VehicleController<::apollo::canbus::Lexus> {
public:
virtual ~LexusController();
::apollo::common::ErrorCode Init(
const VehicleParameter& params,
CanSender<::apollo::canbus::Lexus>* const can_sender,
MessageManager<::apollo::canbus::Lexus>* const message_manager) override;
bool Start() override;
/**
* @brief stop the vehicle controller.
*/
void Stop() override;
/**
* @brief calculate and return the chassis.
* @returns a copy of chassis. Use copy here to avoid multi-thread issues.
*/
Chassis chassis() override;
FRIEND_TEST(LexusControllerTest, SetDrivingMode);
FRIEND_TEST(LexusControllerTest, Status);
FRIEND_TEST(LexusControllerTest, UpdateDrivingMode);
private:
// main logical function for operation the car enter or exit the auto driving
void Emergency() override;
::apollo::common::ErrorCode EnableAutoMode() override;
::apollo::common::ErrorCode DisableAutoMode() override;
::apollo::common::ErrorCode EnableSteeringOnlyMode() override;
::apollo::common::ErrorCode EnableSpeedOnlyMode() override;
// NEUTRAL, REVERSE, DRIVE
void Gear(Chassis::GearPosition state) override;
// brake with new acceleration
// acceleration:0.00~99.99, unit:
// acceleration_spd: 60 ~ 100, suggest: 90
void Brake(double acceleration) override;
// drive with old acceleration
// gas:0.00~99.99 unit:
void Throttle(double throttle) override;
// drive with acceleration/deceleration
// acc:-7.0~5.0 unit:m/s^2
void Acceleration(double acc) override;
// steering with old angle speed
// angle:-99.99~0.00~99.99, unit:, left:+, right:-
void Steer(double angle) override;
// steering with new angle speed
// angle:-99.99~0.00~99.99, unit:, left:+, right:-
// angle_spd:0.00~99.99, unit:deg/s
void Steer(double angle, double angle_spd) override;
// set Electrical Park Brake
void SetEpbBreak(const ::apollo::control::ControlCommand& command) override;
void SetBeam(const ::apollo::control::ControlCommand& command) override;
void SetHorn(const ::apollo::control::ControlCommand& command) override;
void SetTurningSignal(
const ::apollo::control::ControlCommand& command) override;
bool VerifyID() override;
void ResetProtocol();
bool CheckChassisError();
private:
void SecurityDogThreadFunc();
virtual bool CheckResponse(const int32_t flags, bool need_wait);
void set_chassis_error_mask(const int32_t mask);
int32_t chassis_error_mask();
Chassis::ErrorCode chassis_error_code();
void set_chassis_error_code(const Chassis::ErrorCode& error_code);
private:
// control protocol
Accelcmd100* accel_cmd_100_ = nullptr;
Brakecmd104* brake_cmd_104_ = nullptr;
Cruisecontrolbuttonscmd108* cruise_control_buttons_cmd_108_ = nullptr;
Dashcontrolsrightrpt210* dash_controls_right_rpt_210_ = nullptr;
Hazardlightscmd114* hazard_lights_cmd_114_ = nullptr;
Headlightcmd118* headlight_cmd_118_ = nullptr;
Horncmd11c* horn_cmd_11c_ = nullptr;
Parkingbrakecmd124* parking_brake_cmd_124_ = nullptr;
Shiftcmd128* shift_cmd_128_ = nullptr;
Steeringcmd12c* steering_cmd_12c_ = nullptr;
Turncmd130* turn_cmd_130_ = nullptr;
Wipercmd134* wiper_cmd_134_ = nullptr;
Chassis chassis_;
std::unique_ptr<std::thread> thread_;
bool is_chassis_error_ = false;
std::mutex chassis_error_code_mutex_;
Chassis::ErrorCode chassis_error_code_ = Chassis::NO_ERROR;
std::mutex chassis_mask_mutex_;
int32_t chassis_error_mask_ = 0;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_vehicle_factory.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/lexus_vehicle_factory.h"
#include "cyber/common/log.h"
#include "modules/canbus/common/canbus_gflags.h"
#include "modules/canbus_vehicle/lexus/lexus_controller.h"
#include "modules/canbus_vehicle/lexus/lexus_message_manager.h"
#include "modules/common/adapters/adapter_gflags.h"
#include "modules/common/util/util.h"
#include "modules/drivers/canbus/can_client/can_client_factory.h"
using apollo::common::ErrorCode;
using apollo::control::ControlCommand;
using apollo::drivers::canbus::CanClientFactory;
namespace apollo {
namespace canbus {
bool LexusVehicleFactory::Init(const CanbusConf *canbus_conf) {
// Init can client
auto can_factory = CanClientFactory::Instance();
can_factory->RegisterCanClients();
can_client_ = can_factory->CreateCANClient(canbus_conf->can_card_parameter());
if (!can_client_) {
AERROR << "Failed to create can client.";
return false;
}
AINFO << "Can client is successfully created.";
message_manager_ = this->CreateMessageManager();
if (message_manager_ == nullptr) {
AERROR << "Failed to create message manager.";
return false;
}
AINFO << "Message manager is successfully created.";
if (can_receiver_.Init(can_client_.get(), message_manager_.get(),
canbus_conf->enable_receiver_log()) != ErrorCode::OK) {
AERROR << "Failed to init can receiver.";
return false;
}
AINFO << "The can receiver is successfully initialized.";
if (can_sender_.Init(can_client_.get(), message_manager_.get(),
canbus_conf->enable_sender_log()) != ErrorCode::OK) {
AERROR << "Failed to init can sender.";
return false;
}
AINFO << "The can sender is successfully initialized.";
vehicle_controller_ = CreateVehicleController();
if (vehicle_controller_ == nullptr) {
AERROR << "Failed to create vehicle controller.";
return false;
}
AINFO << "The vehicle controller is successfully created.";
if (vehicle_controller_->Init(canbus_conf->vehicle_parameter(), &can_sender_,
message_manager_.get()) != ErrorCode::OK) {
AERROR << "Failed to init vehicle controller.";
return false;
}
AINFO << "The vehicle controller is successfully"
<< " initialized with canbus conf as : "
<< canbus_conf->vehicle_parameter().ShortDebugString();
node_ = ::apollo::cyber::CreateNode("chassis_detail");
chassis_detail_writer_ =
node_->CreateWriter<::apollo::canbus::Lexus>(FLAGS_chassis_detail_topic);
return true;
}
bool LexusVehicleFactory::Start() {
// 1. init and start the can card hardware
if (can_client_->Start() != ErrorCode::OK) {
AERROR << "Failed to start can client";
return false;
}
AINFO << "Can client is started.";
// 2. start receive first then send
if (can_receiver_.Start() != ErrorCode::OK) {
AERROR << "Failed to start can receiver.";
return false;
}
AINFO << "Can receiver is started.";
// 3. start send
if (can_sender_.Start() != ErrorCode::OK) {
AERROR << "Failed to start can sender.";
return false;
}
// 4. start controller
if (!vehicle_controller_->Start()) {
AERROR << "Failed to start vehicle controller.";
return false;
}
return true;
}
void LexusVehicleFactory::Stop() {
can_sender_.Stop();
can_receiver_.Stop();
can_client_->Stop();
vehicle_controller_->Stop();
AINFO << "Cleanup cansender, canreceiver, canclient, vehicle controller.";
}
void LexusVehicleFactory::UpdateCommand(
const apollo::control::ControlCommand *control_command) {
if (vehicle_controller_->Update(*control_command) != ErrorCode::OK) {
AERROR << "Failed to process callback function OnControlCommand because "
"vehicle_controller_->Update error.";
return;
}
can_sender_.Update();
}
Chassis LexusVehicleFactory::publish_chassis() {
Chassis chassis = vehicle_controller_->chassis();
ADEBUG << chassis.ShortDebugString();
return chassis;
}
void LexusVehicleFactory::PublishChassisDetail() {
Lexus chassis_detail;
message_manager_->GetSensorData(&chassis_detail);
ADEBUG << chassis_detail.ShortDebugString();
chassis_detail_writer_->Write(chassis_detail);
}
std::unique_ptr<VehicleController<::apollo::canbus::Lexus>>
LexusVehicleFactory::CreateVehicleController() {
return std::unique_ptr<VehicleController<::apollo::canbus::Lexus>>(
new lexus::LexusController());
}
std::unique_ptr<MessageManager<::apollo::canbus::Lexus>>
LexusVehicleFactory::CreateMessageManager() {
return std::unique_ptr<MessageManager<::apollo::canbus::Lexus>>(
new lexus::LexusMessageManager());
}
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/BUILD
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//tools/install:install.bzl", "install", "install_files", "install_src_files")
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
CANBUS_COPTS = ["-DMODULE_NAME=\\\"canbus\\\""]
cc_library(
name = "lexus_vehicle_factory",
srcs = ["lexus_vehicle_factory.cc"],
hdrs = ["lexus_vehicle_factory.h"],
copts = CANBUS_COPTS,
alwayslink = True,
deps = [
":lexus_controller",
":lexus_message_manager",
"//modules/canbus/common:canbus_gflags",
"//modules/common/adapters:adapter_gflags",
"//modules/common/status",
"//modules/canbus/vehicle:abstract_vehicle_factory",
"//modules/drivers/canbus:sensor_canbus_lib",
],
)
cc_binary(
name = "liblexus_vehicle_factory_lib.so",
linkshared = True,
linkstatic = True,
deps = [":lexus_vehicle_factory"],
)
cc_library(
name = "lexus_message_manager",
srcs = ["lexus_message_manager.cc"],
hdrs = ["lexus_message_manager.h"],
copts = CANBUS_COPTS,
deps = [
"//modules/canbus_vehicle/lexus/proto:lexus_cc_proto",
"//modules/canbus_vehicle/lexus/protocol:canbus_lexus_protocol",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
],
)
cc_library(
name = "lexus_controller",
srcs = ["lexus_controller.cc"],
hdrs = ["lexus_controller.h"],
copts = CANBUS_COPTS,
deps = [
":lexus_message_manager",
"//modules/common_msgs/chassis_msgs:chassis_cc_proto",
"//modules/canbus_vehicle/lexus/proto:lexus_cc_proto",
"//modules/canbus/vehicle:vehicle_controller_base",
"//modules/canbus_vehicle/lexus/protocol:canbus_lexus_protocol",
"//modules/drivers/canbus/can_comm:can_sender",
"//modules/drivers/canbus/can_comm:message_manager_base",
"//modules/drivers/canbus/common:canbus_common",
],
)
cc_test(
name = "lexus_controller_test",
size = "small",
srcs = ["lexus_controller_test.cc"],
data = ["//modules/canbus:test_data"],
deps = [
"//modules/canbus_vehicle/lexus:lexus_controller",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "lexus_vehicle_factory_test",
size = "small",
srcs = ["lexus_vehicle_factory_test.cc"],
data = ["//modules/canbus:test_data"],
linkstatic = True,
deps = [
":lexus_vehicle_factory",
"@com_google_googletest//:gtest_main",
],
)
install(
name = "install",
library_dest = "canbus-vehicle-lexus/lib",
data_dest = "canbus-vehicle-lexus",
data = [
":runtime_data",
":cyberfile.xml",
":canbus-vehicle-lexus.BUILD",
],
targets = [
":liblexus_vehicle_factory_lib.so",
],
deps = [
":pb_lexus",
":pb_hdrs",
],
)
install(
name = "pb_hdrs",
data_dest = "canbus-vehicle-lexus/include",
data = [
"//modules/canbus_vehicle/lexus/proto:lexus_cc_proto",
],
)
install_files(
name = "pb_lexus",
dest = "canbus-vehicle-lexus",
files = [
"//modules/canbus_vehicle/lexus/proto:lexus_py_pb2",
],
)
filegroup(
name = "runtime_data",
srcs = glob([
"testdata/**",
]),
)
install_src_files(
name = "install_src",
deps = [
":install_lexus_src",
":install_lexus_hdrs"
],
)
install_src_files(
name = "install_lexus_src",
src_dir = ["."],
dest = "canbus-vehicle-lexus/src",
filter = "*",
)
install_src_files(
name = "install_lexus_hdrs",
src_dir = ["."],
dest = "canbus-vehicle-lexus/include",
filter = "*.h",
)
cpplint()
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/lexus_message_manager.h
|
/* Copyright 2018 The Apollo Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/message_manager.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::MessageManager;
class LexusMessageManager
: public MessageManager<::apollo::canbus::Lexus> {
public:
LexusMessageManager();
virtual ~LexusMessageManager();
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/testdata/lexus_canbus_conf_test.pb.txt
|
vehicle_parameter {
brand: LEXUS
max_enable_fail_attempt: 5
driving_mode: COMPLETE_AUTO_DRIVE
}
can_card_parameter {
brand:SOCKET_CAN_RAW
type: PCI_CARD
channel_id: CHANNEL_ID_ZERO
}
enable_debug_mode: false
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/proto/lexus.proto
|
syntax = "proto2";
package apollo.canbus;
message Hazard_lights_rpt_214 {
// Report Message
// [] [0|1]
optional bool output_value = 1;
// [] [0|1]
optional bool commanded_value = 2;
// [] [0|1]
optional bool manual_input = 3;
// [] [0|1]
optional bool vehicle_fault = 4;
// [] [0|1]
optional bool pacmod_fault = 5;
// [] [0|1]
optional bool override_active = 6;
// [] [0|1]
optional bool output_reported_fault = 7;
// [] [0|1]
optional bool input_output_fault = 8;
// [] [0|1]
optional bool enabled = 9;
// [] [0|1]
optional bool command_output_fault = 10;
}
message Steering_cmd_12c {
// Report Message
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [rad] [-32.768|32.767]
optional double position = 5;
// [rad/s] [0|65.535]
optional double rotation_rate = 6;
}
message Dash_controls_right_rpt_210 {
// Control Message
enum Output_valueType {
OUTPUT_VALUE_DASH_CONTROL_NONE = 0;
OUTPUT_VALUE_DASH_CONTROL_OK = 1;
OUTPUT_VALUE_DASH_CONTROL_LEFT = 2;
OUTPUT_VALUE_DASH_CONTROL_RIGHT = 3;
OUTPUT_VALUE_DASH_CONTROL_UP = 4;
OUTPUT_VALUE_DASH_CONTROL_DOWN = 5;
}
enum Commanded_valueType {
COMMANDED_VALUE_DASH_CONTROL_NONE = 0;
COMMANDED_VALUE_DASH_CONTROL_OK = 1;
COMMANDED_VALUE_DASH_CONTROL_LEFT = 2;
COMMANDED_VALUE_DASH_CONTROL_RIGHT = 3;
COMMANDED_VALUE_DASH_CONTROL_UP = 4;
COMMANDED_VALUE_DASH_CONTROL_DOWN = 5;
}
enum Manual_inputType {
MANUAL_INPUT_DASH_CONTROL_NONE = 0;
MANUAL_INPUT_DASH_CONTROL_OK = 1;
MANUAL_INPUT_DASH_CONTROL_LEFT = 2;
MANUAL_INPUT_DASH_CONTROL_RIGHT = 3;
MANUAL_INPUT_DASH_CONTROL_UP = 4;
MANUAL_INPUT_DASH_CONTROL_DOWN = 5;
}
// [] [0|255]
optional Output_valueType output_value = 1;
// [] [0|255]
optional Commanded_valueType commanded_value = 2;
// [] [0|1]
optional bool vehicle_fault = 3;
// [] [0|1]
optional bool pacmod_fault = 4;
// [] [0|1]
optional bool override_active = 5;
// [] [0|1]
optional bool output_reported_fault = 6;
// [] [0|1]
optional bool input_output_fault = 7;
// [] [0|1]
optional bool enabled = 8;
// [] [0|1]
optional bool command_output_fault = 9;
// [] [0|255]
optional Manual_inputType manual_input = 10;
}
message Dash_controls_left_cmd_10c {
// Report Message
enum Dash_controls_buttonType {
DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE = 0;
DASH_CONTROLS_BUTTON_DASH_CONTROL_OK = 1;
DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT = 2;
DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT = 3;
DASH_CONTROLS_BUTTON_DASH_CONTROL_UP = 4;
DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN = 5;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|255]
optional Dash_controls_buttonType dash_controls_button = 5;
}
message Steering_rpt_22c {
// Report Message
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [rad] [-32.768|32.767]
optional double manual_input = 8;
// [rad] [-32.768|32.767]
optional double commanded_value = 9;
// [rad] [-32.768|32.767]
optional double output_value = 10;
}
message Turn_aux_rpt_330 {
// Report Message
// [] [0|1]
optional bool pass_blinker_bulb_on_is_valid = 1;
// [] [0|1]
optional bool pass_blinker_bulb_on = 2;
// [] [0|1]
optional bool driver_blinker_bulb_on_is_valid = 3;
// [] [0|1]
optional bool driver_blinker_bulb_on = 4;
}
message Headlight_rpt_218 {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_HEADLIGHTS_OFF = 0;
OUTPUT_VALUE_LOW_BEAMS = 1;
OUTPUT_VALUE_HIGH_BEAMS = 2;
}
enum Manual_inputType {
MANUAL_INPUT_HEADLIGHTS_OFF = 0;
MANUAL_INPUT_LOW_BEAMS = 1;
MANUAL_INPUT_HIGH_BEAMS = 2;
}
enum Commanded_valueType {
COMMANDED_VALUE_HEADLIGHTS_OFF = 0;
COMMANDED_VALUE_LOW_BEAMS = 1;
COMMANDED_VALUE_HIGH_BEAMS = 2;
}
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|2]
optional Output_valueType output_value = 8;
// [] [0|2]
optional Manual_inputType manual_input = 9;
// [] [0|2]
optional Commanded_valueType commanded_value = 10;
}
message Hazard_lights_cmd_114 {
// Control Message
// [] [0|1]
optional bool hazard_lights_cmd = 1;
// [] [0|1]
optional bool ignore_overrides = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool enable = 4;
// [] [0|1]
optional bool clear_faults = 5;
}
message Dash_controls_left_rpt_20c {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_DASH_CONTROL_NONE = 0;
OUTPUT_VALUE_DASH_CONTROL_OK = 1;
OUTPUT_VALUE_DASH_CONTROL_LEFT = 2;
OUTPUT_VALUE_DASH_CONTROL_RIGHT = 3;
OUTPUT_VALUE_DASH_CONTROL_UP = 4;
OUTPUT_VALUE_DASH_CONTROL_DOWN = 5;
}
enum Commanded_valueType {
COMMANDED_VALUE_DASH_CONTROL_NONE = 0;
COMMANDED_VALUE_DASH_CONTROL_OK = 1;
COMMANDED_VALUE_DASH_CONTROL_LEFT = 2;
COMMANDED_VALUE_DASH_CONTROL_RIGHT = 3;
COMMANDED_VALUE_DASH_CONTROL_UP = 4;
COMMANDED_VALUE_DASH_CONTROL_DOWN = 5;
}
enum Manual_inputType {
MANUAL_INPUT_DASH_CONTROL_NONE = 0;
MANUAL_INPUT_DASH_CONTROL_OK = 1;
MANUAL_INPUT_DASH_CONTROL_LEFT = 2;
MANUAL_INPUT_DASH_CONTROL_RIGHT = 3;
MANUAL_INPUT_DASH_CONTROL_UP = 4;
MANUAL_INPUT_DASH_CONTROL_DOWN = 5;
}
// [] [0|255]
optional Output_valueType output_value = 1;
// [] [0|255]
optional Commanded_valueType commanded_value = 2;
// [] [0|255]
optional Manual_inputType manual_input = 3;
// [] [0|1]
optional bool vehicle_fault = 4;
// [] [0|1]
optional bool pacmod_fault = 5;
// [] [0|1]
optional bool override_active = 6;
// [] [0|1]
optional bool output_reported_fault = 7;
// [] [0|1]
optional bool input_output_fault = 8;
// [] [0|1]
optional bool enabled = 9;
// [] [0|1]
optional bool command_output_fault = 10;
}
message Headlight_aux_rpt_318 {
// Report Message
enum Headlights_modeType {
HEADLIGHTS_MODE_HEADLIGHTS_OFF = 0;
HEADLIGHTS_MODE_PARKING_LIGHTS_ONLY = 1;
HEADLIGHTS_MODE_HEADLIGHTS_ON_MANUAL_MODE = 2;
HEADLIGHTS_MODE_HEADLIGHTS_ON_AUTO_MODE = 3;
}
// [] [0|1]
optional bool headlights_mode_is_valid = 1;
// [] [0|3]
optional Headlights_modeType headlights_mode = 2;
// [] [0|1]
optional bool fog_lights_on_is_valid = 3;
// [] [0|1]
optional bool fog_lights_on = 4;
// [] [0|1]
optional bool headlights_on_bright_is_valid = 5;
// [] [0|1]
optional bool headlights_on_bright = 6;
// [] [0|1]
optional bool headlights_on_is_valid = 7;
// [] [0|1]
optional bool headlights_on = 8;
}
message Dash_controls_right_cmd_110 {
// Report Message
enum Dash_controls_buttonType {
DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE = 0;
DASH_CONTROLS_BUTTON_DASH_CONTROL_OK = 1;
DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT = 2;
DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT = 3;
DASH_CONTROLS_BUTTON_DASH_CONTROL_UP = 4;
DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN = 5;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|255]
optional Dash_controls_buttonType dash_controls_button = 5;
}
message Wiper_cmd_134 {
// Control Message
enum Wiper_cmdType {
WIPER_CMD_WIPERS_OFF = 0;
WIPER_CMD_INTERMITTENT_1 = 1;
WIPER_CMD_INTERMITTENT_2 = 2;
WIPER_CMD_INTERMITTENT_3 = 3;
WIPER_CMD_INTERMITTENT_4 = 4;
WIPER_CMD_INTERMITTENT_5 = 5;
WIPER_CMD_LOW = 6;
WIPER_CMD_HIGH = 7;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|7]
optional Wiper_cmdType wiper_cmd = 4;
// [] [0|1]
optional bool clear_faults = 5;
}
message Wiper_rpt_234 {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_WIPERS_OFF = 0;
OUTPUT_VALUE_INTERMITTENT_1 = 1;
OUTPUT_VALUE_INTERMITTENT_2 = 2;
OUTPUT_VALUE_INTERMITTENT_3 = 3;
OUTPUT_VALUE_INTERMITTENT_4 = 4;
OUTPUT_VALUE_INTERMITTENT_5 = 5;
OUTPUT_VALUE_LOW = 6;
OUTPUT_VALUE_HIGH = 7;
}
enum Commanded_valueType {
COMMANDED_VALUE_WIPERS_OFF = 0;
COMMANDED_VALUE_INTERMITTENT_1 = 1;
COMMANDED_VALUE_INTERMITTENT_2 = 2;
COMMANDED_VALUE_INTERMITTENT_3 = 3;
COMMANDED_VALUE_INTERMITTENT_4 = 4;
COMMANDED_VALUE_INTERMITTENT_5 = 5;
COMMANDED_VALUE_LOW = 6;
COMMANDED_VALUE_HIGH = 7;
}
enum Manual_inputType {
MANUAL_INPUT_WIPERS_OFF = 0;
MANUAL_INPUT_INTERMITTENT_1 = 1;
MANUAL_INPUT_INTERMITTENT_2 = 2;
MANUAL_INPUT_INTERMITTENT_3 = 3;
MANUAL_INPUT_INTERMITTENT_4 = 4;
MANUAL_INPUT_INTERMITTENT_5 = 5;
MANUAL_INPUT_LOW = 6;
MANUAL_INPUT_HIGH = 7;
}
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|7]
optional Output_valueType output_value = 8;
// [] [0|7]
optional Commanded_valueType commanded_value = 9;
// [] [0|7]
optional Manual_inputType manual_input = 10;
}
message Turn_rpt_230 {
// Report Message
enum Manual_inputType {
MANUAL_INPUT_RIGHT = 0;
MANUAL_INPUT_NONE = 1;
MANUAL_INPUT_LEFT = 2;
MANUAL_INPUT_HAZARD = 3;
}
enum Commanded_valueType {
COMMANDED_VALUE_RIGHT = 0;
COMMANDED_VALUE_NONE = 1;
COMMANDED_VALUE_LEFT = 2;
COMMANDED_VALUE_HAZARD = 3;
}
enum Output_valueType {
OUTPUT_VALUE_RIGHT = 0;
OUTPUT_VALUE_NONE = 1;
OUTPUT_VALUE_LEFT = 2;
OUTPUT_VALUE_HAZARD = 3;
}
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|3]
optional Manual_inputType manual_input = 8;
// [] [0|3]
optional Commanded_valueType commanded_value = 9;
// [] [0|3]
optional Output_valueType output_value = 10;
}
message Headlight_cmd_118 {
// Control Message
enum Headlight_cmdType {
HEADLIGHT_CMD_HEADLIGHTS_OFF = 0;
HEADLIGHT_CMD_LOW_BEAMS = 1;
HEADLIGHT_CMD_HIGH_BEAMS = 2;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|2]
optional Headlight_cmdType headlight_cmd = 5;
}
message Door_rpt_417 {
// Report Message
// [] [0|1]
optional bool fuel_door_open_is_valid = 1;
// [] [0|1]
optional bool trunk_open_is_valid = 2;
// [] [0|1]
optional bool hood_open_is_valid = 3;
// [] [0|1]
optional bool rear_pass_door_open_is_valid = 4;
// [] [0|1]
optional bool rear_driver_door_open_is_valid = 5;
// [] [0|1]
optional bool pass_door_open_is_valid = 6;
// [] [0|1]
optional bool driver_door_open_is_valid = 7;
// [] [0|1]
optional bool fuel_door_open = 8;
// [] [0|1]
optional bool trunk_open = 9;
// [] [0|1]
optional bool hood_open = 10;
// [] [0|1]
optional bool rear_pass_door_open = 11;
// [] [0|1]
optional bool rear_driver_door_open = 12;
// [] [0|1]
optional bool pass_door_open = 13;
// [] [0|1]
optional bool driver_door_open = 14;
}
message Component_rpt_20 {
// Report Message
enum Component_typeType {
COMPONENT_TYPE_PACMOD = 0;
COMPONENT_TYPE_PACMINI = 1;
COMPONENT_TYPE_PACMICRO = 2;
}
enum Component_funcType {
COMPONENT_FUNC_PACMOD = 0;
COMPONENT_FUNC_STEERING_AND_STEERING_COLUMN = 1;
COMPONENT_FUNC_ACCELERATOR_AND_BRAKING = 2;
COMPONENT_FUNC_BRAKING = 3;
COMPONENT_FUNC_SHIFTING = 4;
COMPONENT_FUNC_STEERING = 5;
COMPONENT_FUNC_E_SHIFTER = 6;
COMPONENT_FUNC_WATCHDOG = 7;
}
// [] [0|255]
optional Component_typeType component_type = 1;
// [] [0|255]
optional Component_funcType component_func = 2;
// [] [0|15]
optional int32 counter = 3;
// [] [0|15]
optional int32 complement = 4;
// [] [0|1]
optional bool config_fault = 5;
}
message Wheel_speed_rpt_407 {
// Report Message
// [rad/s] [-327.68|327.67]
optional double wheel_spd_rear_right = 1;
// [rad/s] [-327.68|327.67]
optional double wheel_spd_rear_left = 2;
// [rad/s] [-327.68|327.67]
optional double wheel_spd_front_right = 3;
// [rad/s] [-327.68|327.67]
optional double wheel_spd_front_left = 4;
}
message Steering_motor_rpt_3_406 {
// Report Message
// [N-m] [-2147483.648|2147483.647]
optional double torque_output = 1;
// [N-m] [-2147483.648|2147483.647]
optional double torque_input = 2;
}
message Steering_motor_rpt_2_405 {
// Report Message
// [deg C] [-32808|32727]
optional int32 encoder_temperature = 1;
// [deg C] [-32808|32727]
optional int32 motor_temperature = 2;
// [rev/s] [-2147483.648|2147483.647]
optional double angular_speed = 3;
}
message Steering_motor_rpt_1_404 {
// Report Message
// [amps] [0|4294967.295]
optional double motor_current = 1;
// [amps] [-2147483.648|2147483.647]
optional double shaft_position = 2;
}
message Brake_motor_rpt_3_403 {
// Report Message
// [N-m] [-2147483.648|2147483.647]
optional double torque_output = 1;
// [N-m] [-2147483.648|2147483.647]
optional double torque_input = 2;
}
message Brake_motor_rpt_2_402 {
// Report Message
// [deg C] [-32808|32727]
optional int32 encoder_temperature = 1;
// [deg C] [-32808|32727]
optional int32 motor_temperature = 2;
// [rev/s] [0|4294967.295]
optional double angular_speed = 3;
}
message Brake_motor_rpt_1_401 {
// Report Message
// [amps] [0|4294967.295]
optional double motor_current = 1;
// [radians] [-2147483.648|2147483.647]
optional double shaft_position = 2;
}
message Wiper_aux_rpt_334 {
// Report Message
// [] [0|1]
optional bool spray_empty_is_valid = 1;
// [] [0|1]
optional bool spray_empty = 2;
// [] [0|1]
optional bool spray_near_empty_is_valid = 3;
// [] [0|1]
optional bool spray_near_empty = 4;
// [] [0|1]
optional bool rear_spraying_is_valid = 5;
// [] [0|1]
optional bool rear_spraying = 6;
// [] [0|1]
optional bool rear_wiping_is_valid = 7;
// [] [0|1]
optional bool rear_wiping = 8;
// [] [0|1]
optional bool front_spraying_is_valid = 9;
// [] [0|1]
optional bool front_spraying = 10;
// [] [0|1]
optional bool front_wiping_is_valid = 11;
// [] [0|1]
optional bool front_wiping = 12;
}
message Shift_aux_rpt_328 {
// Report Message
// [] [0|1]
optional bool speed_interlock_active_is_valid = 1;
// [] [0|1]
optional bool speed_interlock_active = 2;
// [] [0|1]
optional bool brake_interlock_active_is_valid = 3;
// [] [0|1]
optional bool brake_interlock_active = 4;
// [] [0|1]
optional bool stay_in_neutral_mode_is_valid = 5;
// [] [0|1]
optional bool stay_in_neutral_mode = 6;
// [] [0|1]
optional bool between_gears_is_valid = 7;
// [] [0|1]
optional bool between_gears = 8;
}
message Accel_rpt_200 {
// Report Message
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool output_reported_fault = 3;
// [] [0|1]
optional bool input_output_fault = 4;
// [] [0|1]
optional bool command_output_fault = 5;
// [] [0|1]
optional bool override_active = 6;
// [] [0|1]
optional bool enabled = 7;
// [] [0|1]
optional double manual_input = 8;
// [] [0|1]
optional double commanded_value = 9;
// [] [0|1]
optional double output_value = 10;
}
message Brake_rpt_204 {
// Report Message
// [] [0|1]
optional bool command_output_fault = 1;
// [] [0|1]
optional bool vehicle_fault = 2;
// [] [0|1]
optional bool pacmod_fault = 3;
// [] [0|1]
optional bool override_active = 4;
// [] [0|1]
optional bool output_reported_fault = 5;
// [] [0|1]
optional bool input_output_fault = 6;
// [] [0|1]
optional bool enabled = 7;
// [] [0|1]
optional double manual_input = 8;
// [] [0|1]
optional double commanded_value = 9;
// [] [0|1]
optional double output_value = 10;
}
message Horn_cmd_11c {
// Report Message
enum Horn_cmdType {
HORN_CMD_OFF = 0;
HORN_CMD_ON = 1;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|1]
optional Horn_cmdType horn_cmd = 5;
}
message Global_rpt_10 {
// Report Message
enum Pacmod_system_enabledType {
PACMOD_SYSTEM_ENABLED_CONTROL_DISABLED = 0;
PACMOD_SYSTEM_ENABLED_CONTROL_ENABLED = 1;
}
enum Pacmod_system_override_activeType {
PACMOD_SYSTEM_OVERRIDE_ACTIVE_NOT_OVERRIDDEN = 0;
PACMOD_SYSTEM_OVERRIDE_ACTIVE_OVERRIDDEN = 1;
}
enum Brk_can_timeoutType {
BRK_CAN_TIMEOUT_NO_ACTIVE_CAN_TIMEOUT = 0;
BRK_CAN_TIMEOUT_ACTIVE_CAN_TIMEOUT = 1;
}
// [] [0|1]
optional bool config_fault_active = 1;
// [] [0|1]
optional bool pacmod_subsystem_timeout = 2;
// [] [0|1]
optional Pacmod_system_enabledType pacmod_system_enabled = 3;
// [] [0|1]
optional Pacmod_system_override_activeType pacmod_system_override_active = 4;
// [] [0|1]
optional bool pacmod_system_fault_active = 5;
// [] [0|1]
optional bool veh_can_timeout = 6;
// [] [0|1]
optional bool str_can_timeout = 7;
// [] [0|1]
optional Brk_can_timeoutType brk_can_timeout = 8;
// [] [0|1]
optional bool usr_can_timeout = 9;
// [] [0|65535]
optional int32 usr_can_read_errors = 10;
}
message Accel_aux_rpt_300 {
// Report Message
// [] [0|1]
optional bool user_interaction_is_valid = 1;
// [] [0|1]
optional bool user_interaction = 2;
// [] [0|1]
optional bool raw_pedal_force_is_valid = 3;
// [] [-32.768|32.767]
optional double raw_pedal_force = 4;
// [] [0|1]
optional bool raw_pedal_pos_is_valid = 5;
// [] [-32.768|32.767]
optional double raw_pedal_pos = 6;
}
message Cruise_control_buttons_rpt_208 {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_CRUISE_CONTROL_NONE = 0;
OUTPUT_VALUE_CRUISE_CONTROL_CNCL = 1;
OUTPUT_VALUE_CRUISE_CONTROL_ACC_FURTHER = 2;
OUTPUT_VALUE_CRUISE_CONTROL_ACC_CLOSER = 3;
OUTPUT_VALUE_CRUISE_CONTROL_SET_DEC = 4;
OUTPUT_VALUE_CRUISE_CONTROL_RES_INC = 5;
OUTPUT_VALUE_CRUISE_CONTROL_ON_OFF = 6;
}
enum Manual_inputType {
MANUAL_INPUT_CRUISE_CONTROL_NONE = 0;
MANUAL_INPUT_CRUISE_CONTROL_CNCL = 1;
MANUAL_INPUT_CRUISE_CONTROL_ACC_FURTHER = 2;
MANUAL_INPUT_CRUISE_CONTROL_ACC_CLOSER = 3;
MANUAL_INPUT_CRUISE_CONTROL_SET_DEC = 4;
MANUAL_INPUT_CRUISE_CONTROL_RES_INC = 5;
MANUAL_INPUT_CRUISE_CONTROL_ON_OFF = 6;
}
enum Commanded_valueType {
COMMANDED_VALUE_CRUISE_CONTROL_NONE = 0;
COMMANDED_VALUE_CRUISE_CONTROL_CNCL = 1;
COMMANDED_VALUE_CRUISE_CONTROL_ACC_FURTHER = 2;
COMMANDED_VALUE_CRUISE_CONTROL_ACC_CLOSER = 3;
COMMANDED_VALUE_CRUISE_CONTROL_SET_DEC = 4;
COMMANDED_VALUE_CRUISE_CONTROL_RES_INC = 5;
COMMANDED_VALUE_CRUISE_CONTROL_ON_OFF = 6;
}
// [] [0|255]
optional Output_valueType output_value = 1;
// [] [0|255]
optional Manual_inputType manual_input = 2;
// [] [0|255]
optional Commanded_valueType commanded_value = 3;
// [] [0|1]
optional bool vehicle_fault = 4;
// [] [0|1]
optional bool pacmod_fault = 5;
// [] [0|1]
optional bool override_active = 6;
// [] [0|1]
optional bool output_reported_fault = 7;
// [] [0|1]
optional bool input_output_fault = 8;
// [] [0|1]
optional bool enabled = 9;
// [] [0|1]
optional bool command_output_fault = 10;
}
message Vehicle_speed_rpt_400 {
// Report Message
enum Vehicle_speed_validType {
VEHICLE_SPEED_VALID_INVALID = 0;
VEHICLE_SPEED_VALID_VALID = 1;
}
// [m/s] [-327.68|327.67]
optional double vehicle_speed = 1;
// [] [0|1]
optional Vehicle_speed_validType vehicle_speed_valid = 2;
}
message Brake_aux_rpt_304 {
// Report Message
// [] [0|1]
optional bool brake_on_off_is_valid = 1;
// [] [0|1]
optional bool brake_on_off = 2;
// [] [0|1]
optional bool user_interaction_is_valid = 3;
// [] [0|1]
optional bool user_interaction = 4;
// [] [0|1]
optional bool raw_brake_pressure_is_valid = 5;
// [] [-32.768|32.767]
optional double raw_brake_pressure = 6;
// [] [0|1]
optional bool raw_pedal_force_is_valid = 7;
// [] [-32.768|32.767]
optional double raw_pedal_force = 8;
// [] [0|1]
optional bool raw_pedal_pos_is_valid = 9;
// [] [-32.768|32.767]
optional double raw_pedal_pos = 10;
}
message Media_controls_cmd_120 {
// Report Message
enum Media_controls_cmdType {
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NONE = 0;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOICE_COMMAND = 1;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_MUTE = 2;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_PREV_TRACK_ANSWER = 3;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NEXT_TRACK_HANG_UP = 4;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_UP = 5;
MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_DOWN = 6;
}
// [] [0|255]
optional Media_controls_cmdType media_controls_cmd = 1;
// [] [0|1]
optional bool ignore_overrides = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|1]
optional bool enable = 5;
}
message Cruise_control_buttons_cmd_108 {
// Control Message
enum Cruise_control_buttonType {
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE = 0;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_CNCL = 1;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_FURTHER = 2;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_CLOSER = 3;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_SET_DEC = 4;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_RES_INC = 5;
CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ON_OFF = 6;
}
// [] [0|255]
optional Cruise_control_buttonType cruise_control_button = 1;
// [] [0|1]
optional bool ignore_overrides = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool enable = 4;
// [] [0|1]
optional bool clear_faults = 5;
}
message Parking_brake_cmd_124 {
// Control Message
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool parking_brake_cmd = 4;
// [] [0|1]
optional bool clear_faults = 5;
}
message Horn_rpt_21c {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_OFF = 0;
OUTPUT_VALUE_ON = 1;
}
enum Commanded_valueType {
COMMANDED_VALUE_OFF = 0;
COMMANDED_VALUE_ON = 1;
}
enum Manual_inputType {
MANUAL_INPUT_OFF = 0;
MANUAL_INPUT_ON = 1;
}
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|1]
optional Output_valueType output_value = 8;
// [] [0|1]
optional Commanded_valueType commanded_value = 9;
// [] [0|1]
optional Manual_inputType manual_input = 10;
}
message Shift_rpt_228 {
// Report Message
enum Manual_inputType {
MANUAL_INPUT_PARK = 0;
MANUAL_INPUT_REVERSE = 1;
MANUAL_INPUT_NEUTRAL = 2;
MANUAL_INPUT_FORWARD_HIGH = 3;
MANUAL_INPUT_LOW = 4;
MANUAL_INPUT_BETWEEN_GEARS = 5;
MANUAL_INPUT_ERROR = 6;
MANUAL_INPUT_NONE = 7;
}
enum Commanded_valueType {
COMMANDED_VALUE_PARK = 0;
COMMANDED_VALUE_REVERSE = 1;
COMMANDED_VALUE_NEUTRAL = 2;
COMMANDED_VALUE_FORWARD_HIGH = 3;
COMMANDED_VALUE_LOW = 4;
COMMANDED_VALUE_NONE = 7;
}
enum Output_valueType {
OUTPUT_VALUE_PARK = 0;
OUTPUT_VALUE_REVERSE = 1;
OUTPUT_VALUE_NEUTRAL = 2;
OUTPUT_VALUE_FORWARD_HIGH = 3;
OUTPUT_VALUE_LOW = 4;
OUTPUT_VALUE_BETWEEN_GEARS = 5;
OUTPUT_VALUE_ERROR = 6;
OUTPUT_VALUE_NONE = 7;
}
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|4]
optional Manual_inputType manual_input = 8;
// [] [0|4]
optional Commanded_valueType commanded_value = 9;
// [] [0|4]
optional Output_valueType output_value = 10;
}
message Shift_cmd_128 {
// Control Message
enum Shift_cmdType {
SHIFT_CMD_PARK = 0;
SHIFT_CMD_REVERSE = 1;
SHIFT_CMD_NEUTRAL = 2;
SHIFT_CMD_FORWARD_HIGH = 3;
SHIFT_CMD_LOW = 4;
SHIFT_CMD_NONE = 7;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// FORWARD is also HIGH on vehicles with LOW/HIGH, PARK and LOW only available
// on certain Vehicles. [] [0|4]
optional Shift_cmdType shift_cmd = 5;
}
message Accel_cmd_100 {
// Control Message
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|1]
optional double accel_cmd = 5;
}
message Parking_brake_rpt_224 {
// Report Message
// [] [0|1]
optional bool vehicle_fault = 1;
// [] [0|1]
optional bool pacmod_fault = 2;
// [] [0|1]
optional bool override_active = 3;
// [] [0|1]
optional bool output_reported_fault = 4;
// [] [0|1]
optional bool input_output_fault = 5;
// [] [0|1]
optional bool enabled = 6;
// [] [0|1]
optional bool command_output_fault = 7;
// [] [0|1]
optional bool output_value = 8;
// [] [0|1]
optional bool commanded_value = 9;
// [] [0|1]
optional bool manual_input = 10;
}
message Brake_cmd_104 {
// Control Message
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|1]
optional double brake_cmd = 5;
}
message Media_controls_rpt_220 {
// Report Message
enum Output_valueType {
OUTPUT_VALUE_MEDIA_CONTROL_NONE = 0;
OUTPUT_VALUE_MEDIA_CONTROL_VOICE_COMMAND = 1;
OUTPUT_VALUE_MEDIA_CONTROL_MUTE = 2;
OUTPUT_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER = 3;
OUTPUT_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP = 4;
OUTPUT_VALUE_MEDIA_CONTROL_VOL_UP = 5;
OUTPUT_VALUE_MEDIA_CONTROL_VOL_DOWN = 6;
}
enum Commanded_valueType {
COMMANDED_VALUE_MEDIA_CONTROL_NONE = 0;
COMMANDED_VALUE_MEDIA_CONTROL_VOICE_COMMAND = 1;
COMMANDED_VALUE_MEDIA_CONTROL_MUTE = 2;
COMMANDED_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER = 3;
COMMANDED_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP = 4;
COMMANDED_VALUE_MEDIA_CONTROL_VOL_UP = 5;
COMMANDED_VALUE_MEDIA_CONTROL_VOL_DOWN = 6;
}
enum Manual_inputType {
MANUAL_INPUT_MEDIA_CONTROL_NONE = 0;
MANUAL_INPUT_MEDIA_CONTROL_VOICE_COMMAND = 1;
MANUAL_INPUT_MEDIA_CONTROL_MUTE = 2;
MANUAL_INPUT_MEDIA_CONTROL_PREV_TRACK_ANSWER = 3;
MANUAL_INPUT_MEDIA_CONTROL_NEXT_TRACK_HANG_UP = 4;
MANUAL_INPUT_MEDIA_CONTROL_VOL_UP = 5;
MANUAL_INPUT_MEDIA_CONTROL_VOL_DOWN = 6;
}
// [] [0|255]
optional Output_valueType output_value = 1;
// [] [0|255]
optional Commanded_valueType commanded_value = 2;
// [] [0|255]
optional Manual_inputType manual_input = 3;
// [] [0|1]
optional bool vehicle_fault = 4;
// [] [0|1]
optional bool pacmod_fault = 5;
// [] [0|1]
optional bool override_active = 6;
// [] [0|1]
optional bool output_reported_fault = 7;
// [] [0|1]
optional bool input_output_fault = 8;
// [] [0|1]
optional bool enabled = 9;
// [] [0|1]
optional bool command_output_fault = 10;
}
message Steering_aux_rpt_32c {
// Report Message
// [] [0|1]
optional bool user_interaction_is_valid = 1;
// [] [0|1]
optional bool user_interaction = 2;
// [] [0|1]
optional bool rotation_rate_is_valid = 3;
// [rad/s] [0|65.535]
optional double rotation_rate = 4;
// [] [0|1]
optional bool raw_torque_is_valid = 5;
// [] [-32.768|32.767]
optional double raw_torque = 6;
// [] [0|1]
optional bool raw_position_is_valid = 7;
// [] [-32.768|32.767]
optional double raw_position = 8;
}
message Lat_lon_heading_rpt_40e {
// Report Message
// [deg] [-327.68|327.67]
optional double heading = 1;
// [sec] [-128|127]
optional int32 longitude_seconds = 2;
// [min] [-128|127]
optional int32 longitude_minutes = 3;
// [deg] [-128|127]
optional int32 longitude_degrees = 4;
// [sec] [-128|127]
optional int32 latitude_seconds = 5;
// [min] [-128|127]
optional int32 latitude_minutes = 6;
// [deg] [-128|127]
optional int32 latitude_degrees = 7;
}
message Yaw_rate_rpt_40d {
// Report Message
// [rad/s] [-327.68|327.67]
optional double yaw_rate = 1;
}
message Date_time_rpt_40f {
// Report Message
// [sec] [0|60]
optional int32 time_second = 1;
// [min] [0|60]
optional int32 time_minute = 2;
// [hr] [0|23]
optional int32 time_hour = 3;
// [dy] [1|31]
optional int32 date_day = 4;
// [mon] [1|12]
optional int32 date_month = 5;
// [yr] [2000|2255]
optional int32 date_year = 6;
}
message Vin_rpt_414 {
// Report Message
// [] [0|0]
optional int32 veh_serial = 1;
// [] [0|0]
optional int32 veh_my_code = 2;
// [] [0|0]
optional int32 veh_mfg_code = 3;
}
message Occupancy_rpt_415 {
// Report Message
// [] [0|1]
optional bool rear_seatbelt_buckled_is_valid = 1;
// [] [0|1]
optional bool pass_seatbelt_buckled_is_valid = 2;
// [] [0|1]
optional bool driver_seatbelt_buckled_is_valid = 3;
// [] [0|1]
optional bool rear_seat_occupied_is_valid = 4;
// [] [0|1]
optional bool pass_seat_occupied_is_valid = 5;
// [] [0|1]
optional bool driver_seat_occupied_is_valid = 6;
// [] [0|1]
optional bool rear_seatbelt_buckled = 7;
// [] [0|1]
optional bool pass_seatbelt_buckled = 8;
// [] [0|1]
optional bool driver_seatbelt_buckled = 9;
// [] [0|1]
optional bool rear_seat_occupied = 10;
// [] [0|1]
optional bool pass_seat_occupied = 11;
// [] [0|1]
optional bool driver_seat_occupied = 12;
}
message Interior_lights_rpt_416 {
// Report Message
enum Dim_levelType {
DIM_LEVEL_DIM_LEVEL_MIN = 0;
DIM_LEVEL_DIM_LEVEL_1 = 1;
DIM_LEVEL_DIM_LEVEL_2 = 2;
DIM_LEVEL_DIM_LEVEL_3 = 3;
DIM_LEVEL_DIM_LEVEL_4 = 4;
DIM_LEVEL_DIM_LEVEL_5 = 5;
DIM_LEVEL_DIM_LEVEL_6 = 6;
DIM_LEVEL_DIM_LEVEL_7 = 7;
DIM_LEVEL_DIM_LEVEL_8 = 8;
DIM_LEVEL_DIM_LEVEL_9 = 9;
DIM_LEVEL_DIM_LEVEL_10 = 10;
DIM_LEVEL_DIM_LEVEL_11 = 11;
DIM_LEVEL_DIM_LEVEL_MAX = 12;
}
// [] [0|1]
optional bool dim_level_is_valid = 1;
// [] [0|1]
optional bool mood_lights_on_is_valid = 2;
// [] [0|1]
optional bool rear_dome_lights_on_is_valid = 3;
// [] [0|1]
optional bool front_dome_lights_on_is_valid = 4;
// [] [0|12]
optional Dim_levelType dim_level = 5;
// [] [0|1]
optional bool mood_lights_on = 6;
// [] [0|1]
optional bool rear_dome_lights_on = 7;
// [] [0|1]
optional bool front_dome_lights_on = 8;
}
message Turn_cmd_130 {
// Control Message
enum Turn_signal_cmdType {
TURN_SIGNAL_CMD_RIGHT = 0;
TURN_SIGNAL_CMD_NONE = 1;
TURN_SIGNAL_CMD_LEFT = 2;
TURN_SIGNAL_CMD_HAZARD = 3;
}
// [] [0|1]
optional bool ignore_overrides = 1;
// [] [0|1]
optional bool enable = 2;
// [] [0|1]
optional bool clear_override = 3;
// [] [0|1]
optional bool clear_faults = 4;
// [] [0|3]
optional Turn_signal_cmdType turn_signal_cmd = 5;
}
message Detected_object_rpt_411 {
// Report Message
// [m] [0|16777.215]
optional double front_object_distance_high_res = 1;
// [m] [0|16777.215]
optional double front_object_distance_low_res = 2;
}
message Veh_specific_rpt_1_412 {
// Report Message
// [] [0|0]
optional int32 shift_pos_2 = 1;
// [] [0|0]
optional int32 shift_pos_1 = 2;
}
message Veh_dynamics_rpt_413 {
// Report Message
// [] [-32.768|32.767]
optional double veh_g_forces = 1;
}
message Rear_lights_rpt_418 {
// Report Message
// [] [0|1]
optional bool reverse_lights_on_is_valid = 1;
// [] [0|1]
optional bool brake_lights_on_is_valid = 2;
// [] [0|1]
optional bool reverse_lights_on = 3;
// [] [0|1]
optional bool brake_lights_on = 4;
}
// CheckResponseSignal
message CheckResponseSignal {
optional bool is_eps_online = 1 [default = false];
optional bool is_epb_online = 2 [default = false];
optional bool is_esp_online = 3 [default = false];
optional bool is_vtog_online = 4 [default = false];
optional bool is_scu_online = 5 [default = false];
optional bool is_switch_online = 6 [default = false];
optional bool is_vcu_online = 7 [default = false];
}
message Lexus {
optional Hazard_lights_rpt_214 hazard_lights_rpt_214 = 1; // report message
optional Steering_cmd_12c steering_cmd_12c = 2; // report message
optional Dash_controls_right_rpt_210 dash_controls_right_rpt_210 =
3; // control message
optional Dash_controls_left_cmd_10c dash_controls_left_cmd_10c =
4; // report message
optional Steering_rpt_22c steering_rpt_22c = 5; // report message
optional Turn_aux_rpt_330 turn_aux_rpt_330 = 6; // report message
optional Headlight_rpt_218 headlight_rpt_218 = 7; // report message
optional Hazard_lights_cmd_114 hazard_lights_cmd_114 = 8; // control message
optional Dash_controls_left_rpt_20c dash_controls_left_rpt_20c =
9; // report message
optional Headlight_aux_rpt_318 headlight_aux_rpt_318 = 10; // report message
optional Dash_controls_right_cmd_110 dash_controls_right_cmd_110 =
11; // report message
optional Wiper_cmd_134 wiper_cmd_134 = 12; // control message
optional Wiper_rpt_234 wiper_rpt_234 = 13; // report message
optional Turn_rpt_230 turn_rpt_230 = 14; // report message
optional Headlight_cmd_118 headlight_cmd_118 = 15; // control message
optional Door_rpt_417 door_rpt_417 = 16; // report message
optional Component_rpt_20 component_rpt_20 = 17; // report message
optional Wheel_speed_rpt_407 wheel_speed_rpt_407 = 18; // report message
optional Steering_motor_rpt_3_406 steering_motor_rpt_3_406 =
19; // report message
optional Steering_motor_rpt_2_405 steering_motor_rpt_2_405 =
20; // report message
optional Steering_motor_rpt_1_404 steering_motor_rpt_1_404 =
21; // report message
optional Brake_motor_rpt_3_403 brake_motor_rpt_3_403 = 22; // report message
optional Brake_motor_rpt_2_402 brake_motor_rpt_2_402 = 23; // report message
optional Brake_motor_rpt_1_401 brake_motor_rpt_1_401 = 24; // report message
optional Wiper_aux_rpt_334 wiper_aux_rpt_334 = 25; // report message
optional Shift_aux_rpt_328 shift_aux_rpt_328 = 26; // report message
optional Accel_rpt_200 accel_rpt_200 = 27; // report message
optional Brake_rpt_204 brake_rpt_204 = 28; // report message
optional Horn_cmd_11c horn_cmd_11c = 29; // report message
optional Global_rpt_10 global_rpt_10 = 30; // report message
optional Accel_aux_rpt_300 accel_aux_rpt_300 = 31; // report message
optional Cruise_control_buttons_rpt_208 cruise_control_buttons_rpt_208 =
32; // report message
optional Vehicle_speed_rpt_400 vehicle_speed_rpt_400 = 33; // report message
optional Brake_aux_rpt_304 brake_aux_rpt_304 = 34; // report message
optional Media_controls_cmd_120 media_controls_cmd_120 =
35; // report message
optional Cruise_control_buttons_cmd_108 cruise_control_buttons_cmd_108 =
36; // control message
optional Parking_brake_cmd_124 parking_brake_cmd_124 = 37; // control message
optional Horn_rpt_21c horn_rpt_21c = 38; // report message
optional Shift_rpt_228 shift_rpt_228 = 39; // report message
optional Shift_cmd_128 shift_cmd_128 = 40; // control message
optional Accel_cmd_100 accel_cmd_100 = 41; // control message
optional Parking_brake_rpt_224 parking_brake_rpt_224 = 42; // report message
optional Brake_cmd_104 brake_cmd_104 = 43; // control message
optional Media_controls_rpt_220 media_controls_rpt_220 =
44; // report message
optional Steering_aux_rpt_32c steering_aux_rpt_32c = 45; // report message
optional Lat_lon_heading_rpt_40e lat_lon_heading_rpt_40e =
46; // report message
optional Yaw_rate_rpt_40d yaw_rate_rpt_40d = 47; // report message
optional Date_time_rpt_40f date_time_rpt_40f = 48; // report message
optional Vin_rpt_414 vin_rpt_414 = 49; // report message
optional Occupancy_rpt_415 occupancy_rpt_415 = 50; // report message
optional Interior_lights_rpt_416 interior_lights_rpt_416 =
51; // report message
optional Turn_cmd_130 turn_cmd_130 = 52; // control message
optional Detected_object_rpt_411 detected_object_rpt_411 =
53; // report message
optional Veh_specific_rpt_1_412 veh_specific_rpt_1_412 =
54; // report message
optional Veh_dynamics_rpt_413 veh_dynamics_rpt_413 = 55; // report message
optional Rear_lights_rpt_418 rear_lights_rpt_418 = 56; // report message
optional CheckResponseSignal check_response = 100;
}
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/proto/BUILD
|
## Auto generated by `proto_build_generator.py`
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("//tools:python_rules.bzl", "py_proto_library")
package(default_visibility = ["//visibility:public"])
cc_proto_library(
name = "lexus_cc_proto",
deps = [
":lexus_proto",
],
)
proto_library(
name = "lexus_proto",
srcs = ["lexus.proto"],
)
py_proto_library(
name = "lexus_py_pb2",
deps = [
":lexus_proto",
],
)
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/date_time_rpt_40f.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/date_time_rpt_40f.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Datetimerpt40f::Datetimerpt40f() {}
const int32_t Datetimerpt40f::ID = 0x40F;
void Datetimerpt40f::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_date_time_rpt_40f()->set_time_second(
time_second(bytes, length));
chassis->mutable_date_time_rpt_40f()->set_time_minute(
time_minute(bytes, length));
chassis->mutable_date_time_rpt_40f()->set_time_hour(
time_hour(bytes, length));
chassis->mutable_date_time_rpt_40f()->set_date_day(
date_day(bytes, length));
chassis->mutable_date_time_rpt_40f()->set_date_month(
date_month(bytes, length));
chassis->mutable_date_time_rpt_40f()->set_date_year(
date_year(bytes, length));
}
// config detail: {'name': 'time_second', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|60]', 'bit': 47,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'sec'}
int Datetimerpt40f::time_second(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 5);
int32_t x = t0.get_byte(0, 8);
int ret = static_cast<int>(x);
return ret;
}
// config detail: {'name': 'time_minute', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|60]', 'bit': 39,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'min'}
int Datetimerpt40f::time_minute(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
int ret = static_cast<int>(x);
return ret;
}
// config detail: {'name': 'time_hour', 'offset': 0.0, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'physical_range': '[0|23]', 'bit': 31, 'type':
// 'int', 'order': 'motorola', 'physical_unit': 'hr'}
int Datetimerpt40f::time_hour(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'name': 'date_day', 'offset': 1.0, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'physical_range': '[1|31]', 'bit': 23, 'type':
// 'int', 'order': 'motorola', 'physical_unit': 'dy'}
int Datetimerpt40f::date_day(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
int ret = x + 1;
return ret;
}
// config detail: {'name': 'date_month', 'offset': 1.0, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'physical_range': '[1|12]', 'bit': 15, 'type':
// 'int', 'order': 'motorola', 'physical_unit': 'mon'}
int Datetimerpt40f::date_month(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
int ret = x + 1;
return ret;
}
// config detail: {'name': 'date_year', 'offset': 2000.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[2000|2255]', 'bit': 7,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'yr'}
int Datetimerpt40f::date_year(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
int ret = x + 2000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/veh_specific_rpt_1_412.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Vehspecificrpt1412 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Vehspecificrpt1412();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'SHIFT_POS_2', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 15,
// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
int shift_pos_2(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'SHIFT_POS_1', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 7,
// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
int shift_pos_1(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/component_rpt_20.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/component_rpt_20.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Componentrpt20::Componentrpt20() {}
const int32_t Componentrpt20::ID = 0x20;
void Componentrpt20::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_component_rpt_20()->set_component_type(
component_type(bytes, length));
chassis->mutable_component_rpt_20()->set_component_func(
component_func(bytes, length));
chassis->mutable_component_rpt_20()->set_counter(
counter(bytes, length));
chassis->mutable_component_rpt_20()->set_complement(
complement(bytes, length));
chassis->mutable_component_rpt_20()->set_config_fault(
config_fault(bytes, length));
}
// config detail: {'name': 'component_type', 'enum': {0:
// 'COMPONENT_TYPE_PACMOD', 1: 'COMPONENT_TYPE_PACMINI', 2:
// 'COMPONENT_TYPE_PACMICRO'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit': 7, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Component_rpt_20::Component_typeType Componentrpt20::component_type(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Component_rpt_20::Component_typeType ret =
static_cast<Component_rpt_20::Component_typeType>(x);
return ret;
}
// config detail: {'name': 'component_func', 'enum': {0:
// 'COMPONENT_FUNC_PACMOD', 1: 'COMPONENT_FUNC_STEERING_AND_STEERING_COLUMN', 2:
// 'COMPONENT_FUNC_ACCELERATOR_AND_BRAKING', 3: 'COMPONENT_FUNC_BRAKING', 4:
// 'COMPONENT_FUNC_SHIFTING', 5: 'COMPONENT_FUNC_STEERING', 6:
// 'COMPONENT_FUNC_E_SHIFTER', 7: 'COMPONENT_FUNC_WATCHDOG'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]',
// 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Component_rpt_20::Component_funcType Componentrpt20::component_func(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Component_rpt_20::Component_funcType ret =
static_cast<Component_rpt_20::Component_funcType>(x);
return ret;
}
// config detail: {'name': 'counter', 'offset': 0.0, 'precision': 1.0, 'len': 4,
// 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 19, 'type': 'int',
// 'order': 'motorola', 'physical_unit': ''}
int Componentrpt20::counter(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 4);
int ret = x;
return ret;
}
// config detail: {'name': 'complement', 'offset': 0.0, 'precision': 1.0, 'len':
// 4, 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 23, 'type':
// 'int', 'order': 'motorola', 'physical_unit': ''}
int Componentrpt20::complement(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(4, 4);
int ret = x;
return ret;
}
// config detail: {'name': 'config_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 24,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Componentrpt20::config_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/horn_cmd_11c.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Horncmd11c : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Horncmd11c();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Horncmd11c* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Horncmd11c* set_enable(bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Horncmd11c* set_clear_override(bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Horncmd11c* set_clear_faults(bool clear_faults);
// config detail: {'name': 'HORN_CMD', 'enum': {0: 'HORN_CMD_OFF', 1:
// 'HORN_CMD_ON'}, 'precision': 1.0, 'len': 1, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 8, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Horncmd11c* set_horn_cmd(Horn_cmd_11c::Horn_cmdType horn_cmd);
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
// config detail: {'name': 'HORN_CMD', 'enum': {0: 'HORN_CMD_OFF', 1:
// 'HORN_CMD_ON'}, 'precision': 1.0, 'len': 1, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 8, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
void set_p_horn_cmd(uint8_t* data, Horn_cmd_11c::Horn_cmdType horn_cmd);
private:
bool ignore_overrides_;
bool enable_;
bool clear_override_;
bool clear_faults_;
Horn_cmd_11c::Horn_cmdType horn_cmd_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/vin_rpt_414.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/vin_rpt_414.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Vinrpt414::Vinrpt414() {}
const int32_t Vinrpt414::ID = 0x414;
void Vinrpt414::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_vin_rpt_414()->set_veh_serial(
veh_serial(bytes, length));
chassis->mutable_vin_rpt_414()->set_veh_my_code(
veh_my_code(bytes, length));
chassis->mutable_vin_rpt_414()->set_veh_mfg_code(
veh_mfg_code(bytes, length));
}
// config detail: {'name': 'veh_serial', 'offset': 0.0, 'precision': 1.0, 'len':
// 24, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 39, 'type':
// 'int', 'order': 'motorola', 'physical_unit': ''}
int Vinrpt414::veh_serial(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 6);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
int ret = x;
return ret;
}
// config detail: {'name': 'veh_my_code', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 31,
// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
int Vinrpt414::veh_my_code(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
int ret = x;
return ret;
}
// config detail: {'name': 'veh_mfg_code', 'offset': 0.0, 'precision': 1.0,
// 'len': 24, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 7,
// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
int Vinrpt414::veh_mfg_code(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 2);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
int ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/parking_brake_rpt_224.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/parking_brake_rpt_224.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Parkingbrakerpt224::Parkingbrakerpt224() {}
const int32_t Parkingbrakerpt224::ID = 0x224;
void Parkingbrakerpt224::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_parking_brake_rpt_224()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_override_active(
override_active(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_enabled(
enabled(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_output_value(
output_value(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_parking_brake_rpt_224()->set_manual_input(
manual_input(bytes, length));
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::enabled(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_value', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 24,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::output_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'commanded_value', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 16,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::commanded_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'manual_input', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Parkingbrakerpt224::manual_input(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/date_time_rpt_40f.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Datetimerpt40f : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Datetimerpt40f();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'TIME_SECOND', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|60]', 'bit': 47,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'sec'}
int time_second(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'TIME_MINUTE', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|60]', 'bit': 39,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'min'}
int time_minute(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'TIME_HOUR', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|23]', 'bit': 31,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'hr'}
int time_hour(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DATE_DAY', 'offset': 1.0, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'physical_range': '[1|31]', 'bit': 23, 'type':
// 'int', 'order': 'motorola', 'physical_unit': 'dy'}
int date_day(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DATE_MONTH', 'offset': 1.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[1|12]', 'bit': 15,
// 'type': 'int', 'order': 'motorola', 'physical_unit': 'mon'}
int date_month(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DATE_YEAR', 'offset': 2000.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[2000|2255]', 'bit':
// 7, 'type': 'int', 'order': 'motorola', 'physical_unit': 'yr'}
int date_year(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_1_404.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_1_404.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Steeringmotorrpt1404::Steeringmotorrpt1404() {}
const int32_t Steeringmotorrpt1404::ID = 0x404;
void Steeringmotorrpt1404::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_steering_motor_rpt_1_404()->set_motor_current(
motor_current(bytes, length));
chassis->mutable_steering_motor_rpt_1_404()->set_shaft_position(
shaft_position(bytes, length));
}
// config detail: {'name': 'motor_current', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'amps'}
double Steeringmotorrpt1404::motor_current(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 2);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 3);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'shaft_position', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'amps'}
double Steeringmotorrpt1404::shaft_position(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 6);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 7);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 0;
x >>= 0;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_cmd_104.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/brake_cmd_104.h"
#include <algorithm>
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Brakecmd104::ID = 0x104;
// public
Brakecmd104::Brakecmd104() { Reset(); }
uint32_t Brakecmd104::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Brakecmd104::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_clear_faults(data, clear_faults_);
set_p_brake_cmd(data, brake_cmd_);
}
void Brakecmd104::Reset() {
// TODO(QiL) you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
clear_faults_ = false;
brake_cmd_ = 0.0;
}
Brakecmd104* Brakecmd104::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Brakecmd104::set_p_ignore_overrides(uint8_t* data, bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Brakecmd104* Brakecmd104::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Brakecmd104::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Brakecmd104* Brakecmd104::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Brakecmd104::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Brakecmd104* Brakecmd104::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Brakecmd104::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
Brakecmd104* Brakecmd104::set_brake_cmd(double brake_cmd) {
brake_cmd_ = brake_cmd;
return this;
}
// config detail: {'name': 'BRAKE_CMD', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
void Brakecmd104::set_p_brake_cmd(uint8_t* data, double brake_cmd) {
const double scaling_bias = 0.0; // estimated from the garage test data
const double scaling_gain = 0.80; // estimated from the garage test data
brake_cmd = std::max(0.0, (brake_cmd - scaling_bias) / (scaling_gain * 100));
brake_cmd = ProtocolData::BoundedValue(0.0, 1.0, brake_cmd);
// TODO(AS): fix this scaling.
int x = static_cast<int>(brake_cmd / 0.001000);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set0(data + 2);
to_set0.set_value(t, 0, 8);
x >>= 8;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set1(data + 1);
to_set1.set_value(t, 0, 8);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_cmd_108.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Cruisecontrolbuttonscmd108
: public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Cruisecontrolbuttonscmd108();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'CRUISE_CONTROL_BUTTON', 'enum': {0:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE', 1:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_CNCL', 2:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_SET_DEC', 5:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_RES_INC', 6:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Cruisecontrolbuttonscmd108* set_cruise_control_button(
Cruise_control_buttons_cmd_108::Cruise_control_buttonType
cruise_control_button);
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Cruisecontrolbuttonscmd108* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Cruisecontrolbuttonscmd108* set_clear_override(bool clear_override);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Cruisecontrolbuttonscmd108* set_enable(bool enable);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Cruisecontrolbuttonscmd108* set_clear_faults(bool clear_faults);
private:
// config detail: {'name': 'CRUISE_CONTROL_BUTTON', 'enum': {0:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE', 1:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_CNCL', 2:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_SET_DEC', 5:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_RES_INC', 6:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
void set_p_cruise_control_button(
uint8_t* data, Cruise_control_buttons_cmd_108::Cruise_control_buttonType
cruise_control_button);
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
private:
Cruise_control_buttons_cmd_108::Cruise_control_buttonType
cruise_control_button_;
bool ignore_overrides_;
bool clear_override_;
bool enable_;
bool clear_faults_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_2_405.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Steeringmotorrpt2405 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Steeringmotorrpt2405();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'ENCODER_TEMPERATURE', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 7, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int encoder_temperature(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MOTOR_TEMPERATURE', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 23, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int motor_temperature(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'ANGULAR_SPEED', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'rev/s'}
double angular_speed(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/media_controls_rpt_220.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/media_controls_rpt_220.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Mediacontrolsrpt220::Mediacontrolsrpt220() {}
const int32_t Mediacontrolsrpt220::ID = 0x220;
void Mediacontrolsrpt220::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_media_controls_rpt_220()->set_output_value(
output_value(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_manual_input(
manual_input(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_override_active(
override_active(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_enabled(
enabled(bytes, length));
chassis->mutable_media_controls_rpt_220()->set_command_output_fault(
command_output_fault(bytes, length));
}
// config detail: {'name': 'output_value', 'enum': {0:
// 'OUTPUT_VALUE_MEDIA_CONTROL_NONE', 1:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'OUTPUT_VALUE_MEDIA_CONTROL_MUTE', 3:
// 'OUTPUT_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'OUTPUT_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOL_UP', 6:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 31, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Output_valueType Mediacontrolsrpt220::output_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Media_controls_rpt_220::Output_valueType ret =
static_cast<Media_controls_rpt_220::Output_valueType>(x);
return ret;
}
// config detail: {'name': 'commanded_value', 'enum': {0:
// 'COMMANDED_VALUE_MEDIA_CONTROL_NONE', 1:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'COMMANDED_VALUE_MEDIA_CONTROL_MUTE', 3:
// 'COMMANDED_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'COMMANDED_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOL_UP', 6:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Commanded_valueType
Mediacontrolsrpt220::commanded_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Media_controls_rpt_220::Commanded_valueType ret =
static_cast<Media_controls_rpt_220::Commanded_valueType>(x);
return ret;
}
// config detail: {'name': 'manual_input', 'enum': {0:
// 'MANUAL_INPUT_MEDIA_CONTROL_NONE', 1:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'MANUAL_INPUT_MEDIA_CONTROL_MUTE', 3:
// 'MANUAL_INPUT_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'MANUAL_INPUT_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOL_UP', 6:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Manual_inputType Mediacontrolsrpt220::manual_input(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Media_controls_rpt_220::Manual_inputType ret =
static_cast<Media_controls_rpt_220::Manual_inputType>(x);
return ret;
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::enabled(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolsrpt220::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_1_401.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_1_401.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Brakemotorrpt1401::Brakemotorrpt1401() {}
const int32_t Brakemotorrpt1401::ID = 0x401;
void Brakemotorrpt1401::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_brake_motor_rpt_1_401()->set_motor_current(
motor_current(bytes, length));
chassis->mutable_brake_motor_rpt_1_401()->set_shaft_position(
shaft_position(bytes, length));
}
// config detail: {'name': 'motor_current', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'amps'}
double Brakemotorrpt1401::motor_current(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 2);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 3);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'shaft_position', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'radians'}
double Brakemotorrpt1401::shaft_position(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 6);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 7);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 0;
x >>= 0;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/wiper_rpt_234.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/wiper_rpt_234.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Wiperrpt234::Wiperrpt234() {}
const int32_t Wiperrpt234::ID = 0x234;
void Wiperrpt234::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_wiper_rpt_234()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_wiper_rpt_234()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_wiper_rpt_234()->set_override_active(
override_active(bytes, length));
chassis->mutable_wiper_rpt_234()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_wiper_rpt_234()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_wiper_rpt_234()->set_enabled(
enabled(bytes, length));
chassis->mutable_wiper_rpt_234()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_wiper_rpt_234()->set_output_value(
output_value(bytes, length));
chassis->mutable_wiper_rpt_234()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_wiper_rpt_234()->set_manual_input(
manual_input(bytes, length));
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::enabled(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Wiperrpt234::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_value', 'enum': {0:
// 'OUTPUT_VALUE_WIPERS_OFF', 1: 'OUTPUT_VALUE_INTERMITTENT_1', 2:
// 'OUTPUT_VALUE_INTERMITTENT_2', 3: 'OUTPUT_VALUE_INTERMITTENT_3', 4:
// 'OUTPUT_VALUE_INTERMITTENT_4', 5: 'OUTPUT_VALUE_INTERMITTENT_5', 6:
// 'OUTPUT_VALUE_LOW', 7: 'OUTPUT_VALUE_HIGH'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 31,
// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Output_valueType Wiperrpt234::output_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Wiper_rpt_234::Output_valueType ret =
static_cast<Wiper_rpt_234::Output_valueType>(x);
return ret;
}
// config detail: {'name': 'commanded_value', 'enum': {0:
// 'COMMANDED_VALUE_WIPERS_OFF', 1: 'COMMANDED_VALUE_INTERMITTENT_1', 2:
// 'COMMANDED_VALUE_INTERMITTENT_2', 3: 'COMMANDED_VALUE_INTERMITTENT_3', 4:
// 'COMMANDED_VALUE_INTERMITTENT_4', 5: 'COMMANDED_VALUE_INTERMITTENT_5', 6:
// 'COMMANDED_VALUE_LOW', 7: 'COMMANDED_VALUE_HIGH'}, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Commanded_valueType Wiperrpt234::commanded_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Wiper_rpt_234::Commanded_valueType ret =
static_cast<Wiper_rpt_234::Commanded_valueType>(x);
return ret;
}
// config detail: {'name': 'manual_input', 'enum': {0:
// 'MANUAL_INPUT_WIPERS_OFF', 1: 'MANUAL_INPUT_INTERMITTENT_1', 2:
// 'MANUAL_INPUT_INTERMITTENT_2', 3: 'MANUAL_INPUT_INTERMITTENT_3', 4:
// 'MANUAL_INPUT_INTERMITTENT_4', 5: 'MANUAL_INPUT_INTERMITTENT_5', 6:
// 'MANUAL_INPUT_LOW', 7: 'MANUAL_INPUT_HIGH'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 15,
// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Manual_inputType Wiperrpt234::manual_input(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Wiper_rpt_234::Manual_inputType ret =
static_cast<Wiper_rpt_234::Manual_inputType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/turn_cmd_130.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/turn_cmd_130.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Turncmd130::ID = 0x130;
// public
Turncmd130::Turncmd130() { Reset(); }
uint32_t Turncmd130::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Turncmd130::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_clear_faults(data, clear_faults_);
set_p_turn_signal_cmd(data, turn_signal_cmd_);
}
void Turncmd130::Reset() {
// TODO(QiL) you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
clear_faults_ = false;
turn_signal_cmd_ = Turn_cmd_130::TURN_SIGNAL_CMD_RIGHT;
}
Turncmd130* Turncmd130::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Turncmd130::set_p_ignore_overrides(uint8_t* data, bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Turncmd130* Turncmd130::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Turncmd130::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Turncmd130* Turncmd130::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Turncmd130::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Turncmd130* Turncmd130::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Turncmd130::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
Turncmd130* Turncmd130::set_turn_signal_cmd(
Turn_cmd_130::Turn_signal_cmdType turn_signal_cmd) {
turn_signal_cmd_ = turn_signal_cmd;
return this;
}
// config detail: {'name': 'TURN_SIGNAL_CMD', 'enum': {0:
// 'TURN_SIGNAL_CMD_RIGHT', 1: 'TURN_SIGNAL_CMD_NONE', 2:
// 'TURN_SIGNAL_CMD_LEFT', 3: 'TURN_SIGNAL_CMD_HAZARD'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
// 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
void Turncmd130::set_p_turn_signal_cmd(
uint8_t* data, Turn_cmd_130::Turn_signal_cmdType turn_signal_cmd) {
uint8_t x = turn_signal_cmd;
Byte to_set(data + 1);
to_set.set_value(static_cast<uint8_t>(x), 0, 8);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_1_401.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Brakemotorrpt1401 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Brakemotorrpt1401();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'MOTOR_CURRENT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'amps'}
double motor_current(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'SHAFT_POSITION', 'offset': 0.0, 'precision':
// 0.001, 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'radians'}
double shaft_position(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_2_402.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Brakemotorrpt2402 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Brakemotorrpt2402();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'ENCODER_TEMPERATURE', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 7, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int encoder_temperature(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MOTOR_TEMPERATURE', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 23, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int motor_temperature(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'ANGULAR_SPEED', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 39, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rev/s'}
double angular_speed(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/dash_controls_left_rpt_20c.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Dashcontrolsleftrpt20c : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Dashcontrolsleftrpt20c();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0:
// 'OUTPUT_VALUE_DASH_CONTROL_NONE', 1: 'OUTPUT_VALUE_DASH_CONTROL_OK', 2:
// 'OUTPUT_VALUE_DASH_CONTROL_LEFT', 3: 'OUTPUT_VALUE_DASH_CONTROL_RIGHT', 4:
// 'OUTPUT_VALUE_DASH_CONTROL_UP', 5: 'OUTPUT_VALUE_DASH_CONTROL_DOWN'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|255]', 'bit': 31, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
Dash_controls_left_rpt_20c::Output_valueType output_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_DASH_CONTROL_NONE', 1: 'COMMANDED_VALUE_DASH_CONTROL_OK',
// 2: 'COMMANDED_VALUE_DASH_CONTROL_LEFT', 3:
// 'COMMANDED_VALUE_DASH_CONTROL_RIGHT', 4: 'COMMANDED_VALUE_DASH_CONTROL_UP',
// 5: 'COMMANDED_VALUE_DASH_CONTROL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Dash_controls_left_rpt_20c::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0:
// 'MANUAL_INPUT_DASH_CONTROL_NONE', 1: 'MANUAL_INPUT_DASH_CONTROL_OK', 2:
// 'MANUAL_INPUT_DASH_CONTROL_LEFT', 3: 'MANUAL_INPUT_DASH_CONTROL_RIGHT', 4:
// 'MANUAL_INPUT_DASH_CONTROL_UP', 5: 'MANUAL_INPUT_DASH_CONTROL_DOWN'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|255]', 'bit': 15, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
Dash_controls_left_rpt_20c::Manual_inputType manual_input(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/media_controls_cmd_120.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Mediacontrolscmd120 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Mediacontrolscmd120();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'MEDIA_CONTROLS_CMD', 'enum': {0:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NONE', 1:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_MUTE', 3:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_UP', 6:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_cmd_120::Media_controls_cmdType media_controls_cmd(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool ignore_overrides(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_override(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_faults(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enable(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_aux_rpt_304.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Brakeauxrpt304 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Brakeauxrpt304();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'BRAKE_ON_OFF_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 60, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool brake_on_off_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'BRAKE_ON_OFF', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 49,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool brake_on_off(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'USER_INTERACTION_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 59, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool user_interaction_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'USER_INTERACTION', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 48, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool user_interaction(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'RAW_BRAKE_PRESSURE_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 58, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool raw_brake_pressure_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_BRAKE_PRESSURE', 'offset': 0.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32.768|32.767]', 'bit': 39, 'type': 'double', 'order': 'motorola',
// 'physical_unit': ''}
double raw_brake_pressure(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_FORCE_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 57, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool raw_pedal_force_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_FORCE', 'offset': 0.0, 'precision': 1.0,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 23, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double raw_pedal_force(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_POS_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 56, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool raw_pedal_pos_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_POS', 'offset': 0.0, 'precision': 1.0,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double raw_pedal_pos(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/headlight_aux_rpt_318.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/headlight_aux_rpt_318.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Headlightauxrpt318::Headlightauxrpt318() {}
const int32_t Headlightauxrpt318::ID = 0x318;
void Headlightauxrpt318::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_headlight_aux_rpt_318()->set_headlights_mode_is_valid(
headlights_mode_is_valid(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_headlights_mode(
headlights_mode(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_fog_lights_on_is_valid(
fog_lights_on_is_valid(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_fog_lights_on(
fog_lights_on(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_headlights_on_bright_is_valid(
headlights_on_bright_is_valid(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_headlights_on_bright(
headlights_on_bright(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_headlights_on_is_valid(
headlights_on_is_valid(bytes, length));
chassis->mutable_headlight_aux_rpt_318()->set_headlights_on(
headlights_on(bytes, length));
}
// config detail: {'name': 'headlights_mode_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 19, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::headlights_mode_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'headlights_mode', 'enum': {0:
// 'HEADLIGHTS_MODE_HEADLIGHTS_OFF', 1: 'HEADLIGHTS_MODE_PARKING_LIGHTS_ONLY',
// 2: 'HEADLIGHTS_MODE_HEADLIGHTS_ON_MANUAL_MODE', 3:
// 'HEADLIGHTS_MODE_HEADLIGHTS_ON_AUTO_MODE'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 15,
// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Headlight_aux_rpt_318::Headlights_modeType Headlightauxrpt318::headlights_mode(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Headlight_aux_rpt_318::Headlights_modeType ret =
static_cast<Headlight_aux_rpt_318::Headlights_modeType>(x);
return ret;
}
// config detail: {'name': 'fog_lights_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 18, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::fog_lights_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'fog_lights_on', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::fog_lights_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'headlights_on_bright_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 17, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::headlights_on_bright_is_valid(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'headlights_on_bright', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::headlights_on_bright(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'headlights_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 16, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::headlights_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'headlights_on', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Headlightauxrpt318::headlights_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_3_406.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Steeringmotorrpt3406 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Steeringmotorrpt3406();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'TORQUE_OUTPUT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 7, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'N-m'}
double torque_output(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'TORQUE_INPUT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'N-m'}
double torque_input(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/parking_brake_cmd_124.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Parkingbrakecmd124 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Parkingbrakecmd124();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Parkingbrakecmd124* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Parkingbrakecmd124* set_enable(bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Parkingbrakecmd124* set_clear_override(bool clear_override);
// config detail: {'name': 'PARKING_BRAKE_CMD', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Parkingbrakecmd124* set_parking_brake_cmd(bool parking_brake_cmd);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Parkingbrakecmd124* set_clear_faults(bool clear_faults);
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'PARKING_BRAKE_CMD', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_parking_brake_cmd(uint8_t* data, bool parking_brake_cmd);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
private:
bool ignore_overrides_;
bool enable_;
bool clear_override_;
bool parking_brake_cmd_;
bool clear_faults_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/wiper_aux_rpt_334.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Wiperauxrpt334 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Wiperauxrpt334();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'SPRAY_EMPTY_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 13, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool spray_empty_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'SPRAY_EMPTY', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool spray_empty(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'SPRAY_NEAR_EMPTY_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 12, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool spray_near_empty_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'SPRAY_NEAR_EMPTY', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool spray_near_empty(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'REAR_SPRAYING_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 11, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_spraying_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_SPRAYING', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool rear_spraying(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'REAR_WIPING_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 10, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_wiping_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_WIPING', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool rear_wiping(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'FRONT_SPRAYING_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool front_spraying_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FRONT_SPRAYING', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool front_spraying(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'FRONT_WIPING_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool front_wiping_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FRONT_WIPING', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool front_wiping(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/detected_object_rpt_411.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Detectedobjectrpt411 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Detectedobjectrpt411();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'FRONT_OBJECT_DISTANCE_HIGH_RES', 'offset': 0.0,
// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
// '[0|16777.215]', 'bit': 31, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'm'}
double front_object_distance_high_res(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FRONT_OBJECT_DISTANCE_LOW_RES', 'offset': 0.0,
// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
// '[0|16777.215]', 'bit': 7, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'm'}
double front_object_distance_low_res(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/shift_rpt_228.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Shiftrpt228 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Shiftrpt228();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0: 'MANUAL_INPUT_PARK', 1:
// 'MANUAL_INPUT_REVERSE', 2: 'MANUAL_INPUT_NEUTRAL', 3:
// 'MANUAL_INPUT_FORWARD_HIGH', 4: 'MANUAL_INPUT_LOW', 5:
// 'MANUAL_INPUT_BETWEEN_GEARS', 6: 'MANUAL_INPUT_ERROR', 7:
// 'MANUAL_INPUT_NONE'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|4]', 'bit': 15, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Shift_rpt_228::Manual_inputType manual_input(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_PARK', 1: 'COMMANDED_VALUE_REVERSE', 2:
// 'COMMANDED_VALUE_NEUTRAL', 3: 'COMMANDED_VALUE_FORWARD_HIGH', 4:
// 'COMMANDED_VALUE_LOW', 7: 'COMMANDED_VALUE_NONE'}, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|4]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Shift_rpt_228::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0: 'OUTPUT_VALUE_PARK', 1:
// 'OUTPUT_VALUE_REVERSE', 2: 'OUTPUT_VALUE_NEUTRAL', 3:
// 'OUTPUT_VALUE_FORWARD_HIGH', 4: 'OUTPUT_VALUE_LOW', 5:
// 'OUTPUT_VALUE_BETWEEN_GEARS', 6: 'OUTPUT_VALUE_ERROR', 7:
// 'OUTPUT_VALUE_NONE'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|4]', 'bit': 31, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Shift_rpt_228::Output_valueType output_value(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/wiper_rpt_234.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Wiperrpt234 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Wiperrpt234();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0:
// 'OUTPUT_VALUE_WIPERS_OFF', 1: 'OUTPUT_VALUE_INTERMITTENT_1', 2:
// 'OUTPUT_VALUE_INTERMITTENT_2', 3: 'OUTPUT_VALUE_INTERMITTENT_3', 4:
// 'OUTPUT_VALUE_INTERMITTENT_4', 5: 'OUTPUT_VALUE_INTERMITTENT_5', 6:
// 'OUTPUT_VALUE_LOW', 7: 'OUTPUT_VALUE_HIGH'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit':
// 31, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Output_valueType output_value(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_WIPERS_OFF', 1: 'COMMANDED_VALUE_INTERMITTENT_1', 2:
// 'COMMANDED_VALUE_INTERMITTENT_2', 3: 'COMMANDED_VALUE_INTERMITTENT_3', 4:
// 'COMMANDED_VALUE_INTERMITTENT_4', 5: 'COMMANDED_VALUE_INTERMITTENT_5', 6:
// 'COMMANDED_VALUE_LOW', 7: 'COMMANDED_VALUE_HIGH'}, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0:
// 'MANUAL_INPUT_WIPERS_OFF', 1: 'MANUAL_INPUT_INTERMITTENT_1', 2:
// 'MANUAL_INPUT_INTERMITTENT_2', 3: 'MANUAL_INPUT_INTERMITTENT_3', 4:
// 'MANUAL_INPUT_INTERMITTENT_4', 5: 'MANUAL_INPUT_INTERMITTENT_5', 6:
// 'MANUAL_INPUT_LOW', 7: 'MANUAL_INPUT_HIGH'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Wiper_rpt_234::Manual_inputType manual_input(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/parking_brake_cmd_124.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/parking_brake_cmd_124.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Parkingbrakecmd124::ID = 0x124;
// public
Parkingbrakecmd124::Parkingbrakecmd124() { Reset(); }
uint32_t Parkingbrakecmd124::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Parkingbrakecmd124::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_parking_brake_cmd(data, parking_brake_cmd_);
set_p_clear_faults(data, clear_faults_);
}
void Parkingbrakecmd124::Reset() {
// TODO(QiL) you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
parking_brake_cmd_ = false;
clear_faults_ = false;
}
Parkingbrakecmd124* Parkingbrakecmd124::set_ignore_overrides(
bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Parkingbrakecmd124::set_p_ignore_overrides(uint8_t* data,
bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Parkingbrakecmd124* Parkingbrakecmd124::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Parkingbrakecmd124::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Parkingbrakecmd124* Parkingbrakecmd124::set_clear_override(
bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Parkingbrakecmd124::set_p_clear_override(uint8_t* data,
bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Parkingbrakecmd124* Parkingbrakecmd124::set_parking_brake_cmd(
bool parking_brake_cmd) {
parking_brake_cmd_ = parking_brake_cmd;
return this;
}
// config detail: {'name': 'PARKING_BRAKE_CMD', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Parkingbrakecmd124::set_p_parking_brake_cmd(uint8_t* data,
bool parking_brake_cmd) {
uint8_t x = parking_brake_cmd;
Byte to_set(data + 1);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Parkingbrakecmd124* Parkingbrakecmd124::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Parkingbrakecmd124::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/veh_dynamics_rpt_413.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/veh_dynamics_rpt_413.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Vehdynamicsrpt413::Vehdynamicsrpt413() {}
const int32_t Vehdynamicsrpt413::ID = 0x413;
void Vehdynamicsrpt413::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_veh_dynamics_rpt_413()->set_veh_g_forces(
veh_g_forces(bytes, length));
}
// config detail: {'name': 'veh_g_forces', 'offset': 0.0, 'precision': 0.001,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[-32.768|32.767]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Vehdynamicsrpt413::veh_g_forces(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/component_rpt_20.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Componentrpt20 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Componentrpt20();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'COMPONENT_TYPE', 'enum': {0:
// 'COMPONENT_TYPE_PACMOD', 1: 'COMPONENT_TYPE_PACMINI', 2:
// 'COMPONENT_TYPE_PACMICRO'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit': 7, 'type':
// 'enum', 'order': 'motorola', 'physical_unit': ''}
Component_rpt_20::Component_typeType component_type(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMPONENT_FUNC', 'enum': {0:
// 'COMPONENT_FUNC_PACMOD', 1: 'COMPONENT_FUNC_STEERING_AND_STEERING_COLUMN',
// 2: 'COMPONENT_FUNC_ACCELERATOR_AND_BRAKING', 3: 'COMPONENT_FUNC_BRAKING',
// 4: 'COMPONENT_FUNC_SHIFTING', 5: 'COMPONENT_FUNC_STEERING', 6:
// 'COMPONENT_FUNC_E_SHIFTER', 7: 'COMPONENT_FUNC_WATCHDOG'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|255]', 'bit': 15, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
Component_rpt_20::Component_funcType component_func(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COUNTER', 'offset': 0.0, 'precision': 1.0, 'len':
// 4, 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 19, 'type':
// 'int', 'order': 'motorola', 'physical_unit': ''}
int counter(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMPLEMENT', 'offset': 0.0, 'precision': 1.0,
// 'len': 4, 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 23,
// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
int complement(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CONFIG_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 24,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool config_fault(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/turn_cmd_130.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Turncmd130 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Turncmd130();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Turncmd130* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Turncmd130* set_enable(bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Turncmd130* set_clear_override(bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Turncmd130* set_clear_faults(bool clear_faults);
// config detail: {'name': 'TURN_SIGNAL_CMD', 'enum': {0:
// 'TURN_SIGNAL_CMD_RIGHT', 1: 'TURN_SIGNAL_CMD_NONE', 2:
// 'TURN_SIGNAL_CMD_LEFT', 3: 'TURN_SIGNAL_CMD_HAZARD'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
// 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Turncmd130* set_turn_signal_cmd(
Turn_cmd_130::Turn_signal_cmdType turn_signal_cmd);
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
// config detail: {'name': 'TURN_SIGNAL_CMD', 'enum': {0:
// 'TURN_SIGNAL_CMD_RIGHT', 1: 'TURN_SIGNAL_CMD_NONE', 2:
// 'TURN_SIGNAL_CMD_LEFT', 3: 'TURN_SIGNAL_CMD_HAZARD'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
// 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
void set_p_turn_signal_cmd(uint8_t* data,
Turn_cmd_130::Turn_signal_cmdType turn_signal_cmd);
private:
bool ignore_overrides_;
bool enable_;
bool clear_override_;
bool clear_faults_;
Turn_cmd_130::Turn_signal_cmdType turn_signal_cmd_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_rpt_204.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/brake_rpt_204.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Brakerpt204::Brakerpt204() {}
const int32_t Brakerpt204::ID = 0x204;
void Brakerpt204::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_brake_rpt_204()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_brake_rpt_204()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_brake_rpt_204()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_brake_rpt_204()->set_override_active(
override_active(bytes, length));
chassis->mutable_brake_rpt_204()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_brake_rpt_204()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_brake_rpt_204()->set_enabled(
enabled(bytes, length));
chassis->mutable_brake_rpt_204()->set_manual_input(
manual_input(bytes, length));
chassis->mutable_brake_rpt_204()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_brake_rpt_204()->set_output_value(
output_value(bytes, length));
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Brakerpt204::enabled(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'manual_input', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Brakerpt204::manual_input(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 2);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'commanded_value', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 31,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Brakerpt204::commanded_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 4);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'output_value', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 47,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Brakerpt204::output_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 5);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 6);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_rpt_22c.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Steeringrpt22c : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Steeringrpt22c();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 15, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
double manual_input(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'offset': 0.0, 'precision':
// 0.001, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32.768|32.767]', 'bit': 31, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'rad'}
double commanded_value(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 47, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
double output_value(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/accel_cmd_100.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Accelcmd100 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Accelcmd100();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Accelcmd100* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Accelcmd100* set_enable(bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Accelcmd100* set_clear_override(bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Accelcmd100* set_clear_faults(bool clear_faults);
// config detail: {'name': 'ACCEL_CMD', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
Accelcmd100* set_accel_cmd(double accel_cmd);
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
// config detail: {'name': 'ACCEL_CMD', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
void set_p_accel_cmd(uint8_t* data, double accel_cmd);
private:
bool ignore_overrides_;
bool enable_;
bool clear_override_;
bool clear_faults_;
double accel_cmd_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/veh_dynamics_rpt_413.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Vehdynamicsrpt413 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Vehdynamicsrpt413();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEH_G_FORCES', 'offset': 0.0, 'precision': 0.001,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[-32.768|32.767]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double veh_g_forces(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_cmd_104.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Brakecmd104 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Brakecmd104();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Brakecmd104* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Brakecmd104* set_enable(bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Brakecmd104* set_clear_override(bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Brakecmd104* set_clear_faults(bool clear_faults);
// config detail: {'name': 'BRAKE_CMD', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
Brakecmd104* set_brake_cmd(double brake_cmd);
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
// config detail: {'name': 'BRAKE_CMD', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
void set_p_brake_cmd(uint8_t* data, double brake_cmd);
private:
bool ignore_overrides_;
bool enable_;
bool clear_override_;
bool clear_faults_;
double brake_cmd_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/door_rpt_417.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/door_rpt_417.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Doorrpt417::Doorrpt417() {}
const int32_t Doorrpt417::ID = 0x417;
void Doorrpt417::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_door_rpt_417()->set_fuel_door_open_is_valid(
fuel_door_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_trunk_open_is_valid(
trunk_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_hood_open_is_valid(
hood_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_rear_pass_door_open_is_valid(
rear_pass_door_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_rear_driver_door_open_is_valid(
rear_driver_door_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_pass_door_open_is_valid(
pass_door_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_driver_door_open_is_valid(
driver_door_open_is_valid(bytes, length));
chassis->mutable_door_rpt_417()->set_fuel_door_open(
fuel_door_open(bytes, length));
chassis->mutable_door_rpt_417()->set_trunk_open(
trunk_open(bytes, length));
chassis->mutable_door_rpt_417()->set_hood_open(
hood_open(bytes, length));
chassis->mutable_door_rpt_417()->set_rear_pass_door_open(
rear_pass_door_open(bytes, length));
chassis->mutable_door_rpt_417()->set_rear_driver_door_open(
rear_driver_door_open(bytes, length));
chassis->mutable_door_rpt_417()->set_pass_door_open(
pass_door_open(bytes, length));
chassis->mutable_door_rpt_417()->set_driver_door_open(
driver_door_open(bytes, length));
}
// config detail: {'name': 'fuel_door_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 14, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::fuel_door_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'trunk_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 13, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::trunk_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'hood_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 12, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::hood_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rear_pass_door_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 11, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::rear_pass_door_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rear_driver_door_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 10, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::rear_driver_door_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pass_door_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::pass_door_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'driver_door_open_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::driver_door_open_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'fuel_door_open', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::fuel_door_open(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'trunk_open', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::trunk_open(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'hood_open', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 4, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::hood_open(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rear_pass_door_open', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::rear_pass_door_open(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rear_driver_door_open', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::rear_driver_door_open(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pass_door_open', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::pass_door_open(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'driver_door_open', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Doorrpt417::driver_door_open(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/media_controls_cmd_120.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/media_controls_cmd_120.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Mediacontrolscmd120::Mediacontrolscmd120() {}
const int32_t Mediacontrolscmd120::ID = 0x120;
void Mediacontrolscmd120::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_media_controls_cmd_120()->set_media_controls_cmd(
media_controls_cmd(bytes, length));
chassis->mutable_media_controls_cmd_120()->set_ignore_overrides(
ignore_overrides(bytes, length));
chassis->mutable_media_controls_cmd_120()->set_clear_override(
clear_override(bytes, length));
chassis->mutable_media_controls_cmd_120()->set_clear_faults(
clear_faults(bytes, length));
chassis->mutable_media_controls_cmd_120()->set_enable(
enable(bytes, length));
}
// config detail: {'name': 'media_controls_cmd', 'enum': {0:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NONE', 1:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_MUTE', 3:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_UP', 6:
// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_cmd_120::Media_controls_cmdType
Mediacontrolscmd120::media_controls_cmd(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Media_controls_cmd_120::Media_controls_cmdType ret =
static_cast<Media_controls_cmd_120::Media_controls_cmdType>(x);
return ret;
}
// config detail: {'name': 'ignore_overrides', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolscmd120::ignore_overrides(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_override', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolscmd120::clear_override(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_faults', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolscmd120::clear_faults(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enable', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Mediacontrolscmd120::enable(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/lat_lon_heading_rpt_40e.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Latlonheadingrpt40e : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Latlonheadingrpt40e();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'HEADING', 'offset': 0.0, 'precision': 0.01, 'len':
// 16, 'is_signed_var': True, 'physical_range': '[-327.68|327.67]', 'bit': 55,
// 'type': 'double', 'order': 'motorola', 'physical_unit': 'deg'}
double heading(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LONGITUDE_SECONDS', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 47, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'sec'}
int longitude_seconds(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LONGITUDE_MINUTES', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 39, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'min'}
int longitude_minutes(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LONGITUDE_DEGREES', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 31, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg'}
int longitude_degrees(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LATITUDE_SECONDS', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 23, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'sec'}
int latitude_seconds(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LATITUDE_MINUTES', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 15, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'min'}
int latitude_minutes(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'LATITUDE_DEGREES', 'offset': 0.0,
// 'precision': 1.0, 'len': 8, 'is_signed_var': True, 'physical_range':
// '[-128|127]', 'bit': 7, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg'}
int latitude_degrees(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/turn_rpt_230.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/turn_rpt_230.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Turnrpt230::Turnrpt230() {}
const int32_t Turnrpt230::ID = 0x230;
void Turnrpt230::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_turn_rpt_230()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_turn_rpt_230()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_turn_rpt_230()->set_override_active(
override_active(bytes, length));
chassis->mutable_turn_rpt_230()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_turn_rpt_230()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_turn_rpt_230()->set_enabled(
enabled(bytes, length));
chassis->mutable_turn_rpt_230()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_turn_rpt_230()->set_manual_input(
manual_input(bytes, length));
chassis->mutable_turn_rpt_230()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_turn_rpt_230()->set_output_value(
output_value(bytes, length));
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::pacmod_fault(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::enabled(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnrpt230::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'manual_input', 'enum': {0: 'MANUAL_INPUT_RIGHT', 1:
// 'MANUAL_INPUT_NONE', 2: 'MANUAL_INPUT_LEFT', 3: 'MANUAL_INPUT_HAZARD'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|3]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
// 'physical_unit': ''}
Turn_rpt_230::Manual_inputType Turnrpt230::manual_input(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Turn_rpt_230::Manual_inputType ret =
static_cast<Turn_rpt_230::Manual_inputType>(x);
return ret;
}
// config detail: {'name': 'commanded_value', 'enum': {0:
// 'COMMANDED_VALUE_RIGHT', 1: 'COMMANDED_VALUE_NONE', 2:
// 'COMMANDED_VALUE_LEFT', 3: 'COMMANDED_VALUE_HAZARD'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
// 'bit': 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Turn_rpt_230::Commanded_valueType Turnrpt230::commanded_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Turn_rpt_230::Commanded_valueType ret =
static_cast<Turn_rpt_230::Commanded_valueType>(x);
return ret;
}
// config detail: {'name': 'output_value', 'enum': {0: 'OUTPUT_VALUE_RIGHT', 1:
// 'OUTPUT_VALUE_NONE', 2: 'OUTPUT_VALUE_LEFT', 3: 'OUTPUT_VALUE_HAZARD'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|3]', 'bit': 31, 'type': 'enum', 'order': 'motorola',
// 'physical_unit': ''}
Turn_rpt_230::Output_valueType Turnrpt230::output_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Turn_rpt_230::Output_valueType ret =
static_cast<Turn_rpt_230::Output_valueType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/dash_controls_right_cmd_110.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Dashcontrolsrightcmd110 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Dashcontrolsrightcmd110();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool ignore_overrides(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enable(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_override(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_faults(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DASH_CONTROLS_BUTTON', 'enum': {0:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE', 1:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_OK', 2:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT', 3:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT', 4:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_UP', 5:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Dash_controls_right_cmd_110::Dash_controls_buttonType dash_controls_button(
const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/wiper_cmd_134.cc
|
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/wiper_cmd_134.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Wipercmd134::ID = 0x134;
// public
Wipercmd134::Wipercmd134() { Reset(); }
uint32_t Wipercmd134::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Wipercmd134::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_wiper_cmd(data, wiper_cmd_);
set_p_clear_faults(data, clear_faults_);
}
void Wipercmd134::Reset() {
// TODO(QiL) you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
wiper_cmd_ = Wiper_cmd_134::WIPER_CMD_WIPERS_OFF;
clear_faults_ = false;
}
Wipercmd134* Wipercmd134::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Wipercmd134::set_p_ignore_overrides(uint8_t* data, bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(x, 1, 1);
}
Wipercmd134* Wipercmd134::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Wipercmd134::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(x, 0, 1);
}
Wipercmd134* Wipercmd134::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Wipercmd134::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(x, 2, 1);
}
Wipercmd134* Wipercmd134::set_wiper_cmd(
Wiper_cmd_134::Wiper_cmdType wiper_cmd) {
wiper_cmd_ = wiper_cmd;
return this;
}
// config detail: {'name': 'WIPER_CMD', 'enum': {0: 'WIPER_CMD_WIPERS_OFF', 1:
// 'WIPER_CMD_INTERMITTENT_1', 2: 'WIPER_CMD_INTERMITTENT_2', 3:
// 'WIPER_CMD_INTERMITTENT_3', 4: 'WIPER_CMD_INTERMITTENT_4', 5:
// 'WIPER_CMD_INTERMITTENT_5', 6: 'WIPER_CMD_LOW', 7: 'WIPER_CMD_HIGH'},
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|7]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
// 'physical_unit': ''}
void Wipercmd134::set_p_wiper_cmd(uint8_t* data,
Wiper_cmd_134::Wiper_cmdType wiper_cmd) {
uint8_t x = wiper_cmd;
Byte to_set(data + 1);
to_set.set_value(x, 0, 8);
}
Wipercmd134* Wipercmd134::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Wipercmd134::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(x, 3, 1);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_2_402.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_2_402.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Brakemotorrpt2402::Brakemotorrpt2402() {}
const int32_t Brakemotorrpt2402::ID = 0x402;
void Brakemotorrpt2402::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_brake_motor_rpt_2_402()->set_encoder_temperature(
encoder_temperature(bytes, length));
chassis->mutable_brake_motor_rpt_2_402()->set_motor_temperature(
motor_temperature(bytes, length));
chassis->mutable_brake_motor_rpt_2_402()->set_angular_speed(
angular_speed(bytes, length));
}
// config detail: {'name': 'encoder_temperature', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 7, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int Brakemotorrpt2402::encoder_temperature(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
int ret = static_cast<int>(x + -40.000000);
return ret;
}
// config detail: {'name': 'motor_temperature', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 23, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int Brakemotorrpt2402::motor_temperature(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 3);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
int ret = static_cast<int>(x + -40.000000);
return ret;
}
// config detail: {'name': 'angular_speed', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 39, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rev/s'}
double Brakemotorrpt2402::angular_speed(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 6);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 7);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/turn_aux_rpt_330.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/turn_aux_rpt_330.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Turnauxrpt330::Turnauxrpt330() {}
const int32_t Turnauxrpt330::ID = 0x330;
void Turnauxrpt330::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_turn_aux_rpt_330()->set_pass_blinker_bulb_on_is_valid(
pass_blinker_bulb_on_is_valid(bytes, length));
chassis->mutable_turn_aux_rpt_330()->set_pass_blinker_bulb_on(
pass_blinker_bulb_on(bytes, length));
chassis->mutable_turn_aux_rpt_330()->set_driver_blinker_bulb_on_is_valid(
driver_blinker_bulb_on_is_valid(bytes, length));
chassis->mutable_turn_aux_rpt_330()->set_driver_blinker_bulb_on(
driver_blinker_bulb_on(bytes, length));
}
// config detail: {'name': 'pass_blinker_bulb_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnauxrpt330::pass_blinker_bulb_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pass_blinker_bulb_on', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnauxrpt330::pass_blinker_bulb_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'driver_blinker_bulb_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnauxrpt330::driver_blinker_bulb_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'driver_blinker_bulb_on', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Turnauxrpt330::driver_blinker_bulb_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/hazard_lights_cmd_114.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Hazardlightscmd114 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Hazardlightscmd114();
uint32_t GetPeriod() const override;
void UpdateData(uint8_t* data) override;
void Reset() override;
// config detail: {'name': 'HAZARD_LIGHTS_CMD', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Hazardlightscmd114* set_hazard_lights_cmd(bool hazard_lights_cmd);
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
Hazardlightscmd114* set_ignore_overrides(bool ignore_overrides);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Hazardlightscmd114* set_clear_override(bool clear_override);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
Hazardlightscmd114* set_enable(bool enable);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
Hazardlightscmd114* set_clear_faults(bool clear_faults);
private:
// config detail: {'name': 'HAZARD_LIGHTS_CMD', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_hazard_lights_cmd(uint8_t* data, bool hazard_lights_cmd);
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
void set_p_ignore_overrides(uint8_t* data, bool ignore_overrides);
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_override(uint8_t* data, bool clear_override);
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_enable(uint8_t* data, bool enable);
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void set_p_clear_faults(uint8_t* data, bool clear_faults);
private:
bool hazard_lights_cmd_;
bool ignore_overrides_;
bool clear_override_;
bool enable_;
bool clear_faults_;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/headlight_rpt_218.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Headlightrpt218 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Headlightrpt218();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0:
// 'OUTPUT_VALUE_HEADLIGHTS_OFF', 1: 'OUTPUT_VALUE_LOW_BEAMS', 2:
// 'OUTPUT_VALUE_HIGH_BEAMS'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|2]', 'bit': 31, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Headlight_rpt_218::Output_valueType output_value(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0:
// 'MANUAL_INPUT_HEADLIGHTS_OFF', 1: 'MANUAL_INPUT_LOW_BEAMS', 2:
// 'MANUAL_INPUT_HIGH_BEAMS'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|2]', 'bit': 15, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Headlight_rpt_218::Manual_inputType manual_input(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_HEADLIGHTS_OFF', 1: 'COMMANDED_VALUE_LOW_BEAMS', 2:
// 'COMMANDED_VALUE_HIGH_BEAMS'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|2]', 'bit': 23, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Headlight_rpt_218::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/wheel_speed_rpt_407.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Wheelspeedrpt407 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Wheelspeedrpt407();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'WHEEL_SPD_REAR_RIGHT', 'offset': 0.0, 'precision':
// 0.01, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-327.68|327.67]', 'bit': 55, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'rad/s'}
double wheel_spd_rear_right(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'WHEEL_SPD_REAR_LEFT', 'offset': 0.0, 'precision':
// 0.01, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-327.68|327.67]', 'bit': 39, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'rad/s'}
double wheel_spd_rear_left(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'WHEEL_SPD_FRONT_RIGHT', 'offset': 0.0,
// 'precision': 0.01, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-327.68|327.67]', 'bit': 23, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'rad/s'}
double wheel_spd_front_right(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'WHEEL_SPD_FRONT_LEFT', 'offset': 0.0, 'precision':
// 0.01, 'len': 16, 'is_signed_var': False, 'physical_range':
// '[-327.68|327.67]', 'bit': 7, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'rad/s'}
double wheel_spd_front_left(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/detected_object_rpt_411.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/detected_object_rpt_411.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Detectedobjectrpt411::Detectedobjectrpt411() {}
const int32_t Detectedobjectrpt411::ID = 0x411;
void Detectedobjectrpt411::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_detected_object_rpt_411()
->set_front_object_distance_high_res(
front_object_distance_high_res(bytes, length));
chassis->mutable_detected_object_rpt_411()->set_front_object_distance_low_res(
front_object_distance_low_res(bytes, length));
}
// config detail: {'name': 'front_object_distance_high_res', 'offset': 0.0,
// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
// '[0|16777.215]', 'bit': 31, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'm'}
double Detectedobjectrpt411::front_object_distance_high_res(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 4);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 5);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'front_object_distance_low_res', 'offset': 0.0,
// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
// '[0|16777.215]', 'bit': 7, 'type': 'double', 'order': 'motorola',
// 'physical_unit': 'm'}
double Detectedobjectrpt411::front_object_distance_low_res(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 2);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/turn_aux_rpt_330.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Turnauxrpt330 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Turnauxrpt330();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'PASS_BLINKER_BULB_ON_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool pass_blinker_bulb_on_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'PASS_BLINKER_BULB_ON', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool pass_blinker_bulb_on(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'DRIVER_BLINKER_BULB_ON_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool driver_blinker_bulb_on_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'DRIVER_BLINKER_BULB_ON', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool driver_blinker_bulb_on(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_cmd_12c.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/steering_cmd_12c.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Steeringcmd12c::ID = 0x12C;
// public
Steeringcmd12c::Steeringcmd12c() { Reset(); }
uint32_t Steeringcmd12c::GetPeriod() const {
// TODO(QiL) : modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Steeringcmd12c::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_clear_faults(data, clear_faults_);
set_p_position(data, position_);
set_p_rotation_rate(data, rotation_rate_);
}
void Steeringcmd12c::Reset() {
// TODO(QiL) : you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
clear_faults_ = false;
position_ = 0.0;
rotation_rate_ = 0.0;
}
Steeringcmd12c* Steeringcmd12c::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Steeringcmd12c::set_p_ignore_overrides(uint8_t* data,
bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Steeringcmd12c* Steeringcmd12c::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Steeringcmd12c::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Steeringcmd12c* Steeringcmd12c::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Steeringcmd12c::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Steeringcmd12c* Steeringcmd12c::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Steeringcmd12c::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
Steeringcmd12c* Steeringcmd12c::set_position(double position) {
// TODO(AS): fix this direction and scaling.
position_ = position;
return this;
}
// config detail: {'name': 'POSITION', 'offset': 0.0, 'precision': 0.001, 'len':
// 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
void Steeringcmd12c::set_p_position(uint8_t* data, double position) {
position = ProtocolData::BoundedValue(-32.768, 32.767, position);
int x = static_cast<int>(position / -0.001000);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set0(data + 2);
to_set0.set_value(t, 0, 8);
x >>= 8;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set1(data + 1);
to_set1.set_value(t, 0, 8);
}
Steeringcmd12c* Steeringcmd12c::set_rotation_rate(double rotation_rate) {
rotation_rate_ = rotation_rate;
return this;
}
// config detail: {'name': 'ROTATION_RATE', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65.535]', 'bit': 31,
// 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad/s'}
void Steeringcmd12c::set_p_rotation_rate(uint8_t* data, double rotation_rate) {
rotation_rate = ProtocolData::BoundedValue(0.0, 65.535, rotation_rate);
int x = static_cast<int>(rotation_rate / 0.001000);
uint8_t t = 0;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set0(data + 4);
to_set0.set_value(t, 0, 8);
x >>= 8;
t = static_cast<uint8_t>(x & 0xFF);
Byte to_set1(data + 3);
to_set1.set_value(t, 0, 8);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/horn_cmd_11c.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/horn_cmd_11c.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Horncmd11c::ID = 0x11C;
// public
Horncmd11c::Horncmd11c() { Reset(); }
uint32_t Horncmd11c::GetPeriod() const {
// TODO(QiL) : modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Horncmd11c::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_clear_faults(data, clear_faults_);
set_p_horn_cmd(data, horn_cmd_);
}
void Horncmd11c::Reset() {
// TODO(QiL) : you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
clear_faults_ = false;
horn_cmd_ = Horn_cmd_11c::HORN_CMD_OFF;
}
Horncmd11c* Horncmd11c::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Horncmd11c::set_p_ignore_overrides(uint8_t* data, bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Horncmd11c* Horncmd11c::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Horncmd11c::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Horncmd11c* Horncmd11c::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Horncmd11c::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Horncmd11c* Horncmd11c::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Horncmd11c::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
Horncmd11c* Horncmd11c::set_horn_cmd(Horn_cmd_11c::Horn_cmdType horn_cmd) {
horn_cmd_ = horn_cmd;
return this;
}
// config detail: {'name': 'HORN_CMD', 'enum': {0: 'HORN_CMD_OFF', 1:
// 'HORN_CMD_ON'}, 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset':
// 0.0, 'physical_range': '[0|1]', 'bit': 8, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
void Horncmd11c::set_p_horn_cmd(uint8_t* data,
Horn_cmd_11c::Horn_cmdType horn_cmd) {
uint8_t x = horn_cmd;
Byte to_set(data + 1);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_2_405.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_2_405.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Steeringmotorrpt2405::Steeringmotorrpt2405() {}
const int32_t Steeringmotorrpt2405::ID = 0x405;
void Steeringmotorrpt2405::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_steering_motor_rpt_2_405()->set_encoder_temperature(
encoder_temperature(bytes, length));
chassis->mutable_steering_motor_rpt_2_405()->set_motor_temperature(
motor_temperature(bytes, length));
chassis->mutable_steering_motor_rpt_2_405()->set_angular_speed(
angular_speed(bytes, length));
}
// config detail: {'name': 'encoder_temperature', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 7, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int Steeringmotorrpt2405::encoder_temperature(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
int ret = x + -40;
return ret;
}
// config detail: {'name': 'motor_temperature', 'offset': -40.0,
// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32808|32727]', 'bit': 23, 'type': 'int', 'order': 'motorola',
// 'physical_unit': 'deg C'}
int Steeringmotorrpt2405::motor_temperature(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 3);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
int ret = x + -40;
return ret;
}
// config detail: {'name': 'angular_speed', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'rev/s'}
double Steeringmotorrpt2405::angular_speed(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t2(bytes + 6);
t = t2.get_byte(0, 8);
x <<= 8;
x |= t;
Byte t3(bytes + 7);
t = t3.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 0;
x >>= 0;
double ret = static_cast<double>(x * 0.001000);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_aux_rpt_32c.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/steering_aux_rpt_32c.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Steeringauxrpt32c::Steeringauxrpt32c() {}
const int32_t Steeringauxrpt32c::ID = 0x32C;
void Steeringauxrpt32c::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_steering_aux_rpt_32c()->set_user_interaction_is_valid(
user_interaction_is_valid(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_user_interaction(
user_interaction(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_rotation_rate_is_valid(
rotation_rate_is_valid(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_rotation_rate(
rotation_rate(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_raw_torque_is_valid(
raw_torque_is_valid(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_raw_torque(
raw_torque(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_raw_position_is_valid(
raw_position_is_valid(bytes, length));
chassis->mutable_steering_aux_rpt_32c()->set_raw_position(
raw_position(bytes, length));
}
// config detail: {'name': 'user_interaction_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 59, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Steeringauxrpt32c::user_interaction_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'user_interaction', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 48,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Steeringauxrpt32c::user_interaction(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 6);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rotation_rate_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 58, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Steeringauxrpt32c::rotation_rate_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'rotation_rate', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65.535]', 'bit': 39,
// 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad/s'}
double Steeringauxrpt32c::rotation_rate(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'raw_torque_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 57, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Steeringauxrpt32c::raw_torque_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'raw_torque', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 23, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Steeringauxrpt32c::raw_torque(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 3);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'raw_position_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 56, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Steeringauxrpt32c::raw_position_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'raw_position', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Steeringauxrpt32c::raw_position(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/shift_rpt_228.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/shift_rpt_228.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Shiftrpt228::Shiftrpt228() {}
const int32_t Shiftrpt228::ID = 0x228;
void Shiftrpt228::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_shift_rpt_228()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_shift_rpt_228()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_shift_rpt_228()->set_override_active(
override_active(bytes, length));
chassis->mutable_shift_rpt_228()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_shift_rpt_228()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_shift_rpt_228()->set_enabled(
enabled(bytes, length));
chassis->mutable_shift_rpt_228()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_shift_rpt_228()->set_manual_input(
manual_input(bytes, length));
chassis->mutable_shift_rpt_228()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_shift_rpt_228()->set_output_value(
output_value(bytes, length));
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::enabled(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Shiftrpt228::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'manual_input', 'enum': {0: 'MANUAL_INPUT_PARK', 1:
// 'MANUAL_INPUT_REVERSE', 2: 'MANUAL_INPUT_NEUTRAL', 3:
// 'MANUAL_INPUT_FORWARD_HIGH', 4: 'MANUAL_INPUT_LOW', 5:
// 'MANUAL_INPUT_BETWEEN_GEARS', 6: 'MANUAL_INPUT_ERROR', 7:
// 'MANUAL_INPUT_NONE'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|4]', 'bit': 15, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
Shift_rpt_228::Manual_inputType Shiftrpt228::manual_input(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
// TODO(Snehagn) : temporary fix until AS to fix in the firmware
if (x == 255) {
x = 0;
}
Shift_rpt_228::Manual_inputType ret =
static_cast<Shift_rpt_228::Manual_inputType>(x);
return ret;
}
// config detail: {'name': 'commanded_value', 'enum': {0:
// 'COMMANDED_VALUE_PARK', 1: 'COMMANDED_VALUE_REVERSE', 2:
// 'COMMANDED_VALUE_NEUTRAL', 3: 'COMMANDED_VALUE_FORWARD_HIGH', 4:
// 'COMMANDED_VALUE_LOW', 7: 'COMMANDED_VALUE_NONE'}, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|4]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Shift_rpt_228::Commanded_valueType Shiftrpt228::commanded_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Shift_rpt_228::Commanded_valueType ret =
static_cast<Shift_rpt_228::Commanded_valueType>(x);
return ret;
}
// config detail: {'name': 'output_value', 'enum': {0: 'OUTPUT_VALUE_PARK', 1:
// 'OUTPUT_VALUE_REVERSE', 2: 'OUTPUT_VALUE_NEUTRAL', 3:
// 'OUTPUT_VALUE_FORWARD_HIGH', 4: 'OUTPUT_VALUE_LOW', 5:
// 'OUTPUT_VALUE_BETWEEN_GEARS', 6: 'OUTPUT_VALUE_ERROR', 7:
// 'OUTPUT_VALUE_NONE'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|4]', 'bit': 31, 'type': 'enum', 'order':
// 'motorola', 'physical_unit': ''}
Shift_rpt_228::Output_valueType Shiftrpt228::output_value(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Shift_rpt_228::Output_valueType ret =
static_cast<Shift_rpt_228::Output_valueType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/dash_controls_left_cmd_10c.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_left_cmd_10c.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Dashcontrolsleftcmd10c::Dashcontrolsleftcmd10c() {}
const int32_t Dashcontrolsleftcmd10c::ID = 0x10C;
void Dashcontrolsleftcmd10c::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_dash_controls_left_cmd_10c()->set_ignore_overrides(
ignore_overrides(bytes, length));
chassis->mutable_dash_controls_left_cmd_10c()->set_enable(
enable(bytes, length));
chassis->mutable_dash_controls_left_cmd_10c()->set_clear_override(
clear_override(bytes, length));
chassis->mutable_dash_controls_left_cmd_10c()->set_clear_faults(
clear_faults(bytes, length));
chassis->mutable_dash_controls_left_cmd_10c()->set_dash_controls_button(
dash_controls_button(bytes, length));
}
// config detail: {'name': 'ignore_overrides', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsleftcmd10c::ignore_overrides(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enable', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsleftcmd10c::enable(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_override', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsleftcmd10c::clear_override(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_faults', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsleftcmd10c::clear_faults(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'dash_controls_button', 'enum': {0:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE', 1:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_OK', 2:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT', 3:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT', 4:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_UP', 5:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Dash_controls_left_cmd_10c::Dash_controls_buttonType
Dashcontrolsleftcmd10c::dash_controls_button(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Dash_controls_left_cmd_10c::Dash_controls_buttonType ret =
static_cast<Dash_controls_left_cmd_10c::Dash_controls_buttonType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_rpt_208.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Cruisecontrolbuttonsrpt208
: public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Cruisecontrolbuttonsrpt208();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0:
// 'OUTPUT_VALUE_CRUISE_CONTROL_NONE', 1: 'OUTPUT_VALUE_CRUISE_CONTROL_CNCL',
// 2: 'OUTPUT_VALUE_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'OUTPUT_VALUE_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'OUTPUT_VALUE_CRUISE_CONTROL_SET_DEC', 5:
// 'OUTPUT_VALUE_CRUISE_CONTROL_RES_INC', 6:
// 'OUTPUT_VALUE_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 31, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Cruise_control_buttons_rpt_208::Output_valueType output_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0:
// 'MANUAL_INPUT_CRUISE_CONTROL_NONE', 1: 'MANUAL_INPUT_CRUISE_CONTROL_CNCL',
// 2: 'MANUAL_INPUT_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'MANUAL_INPUT_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'MANUAL_INPUT_CRUISE_CONTROL_SET_DEC', 5:
// 'MANUAL_INPUT_CRUISE_CONTROL_RES_INC', 6:
// 'MANUAL_INPUT_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Cruise_control_buttons_rpt_208::Manual_inputType manual_input(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_CRUISE_CONTROL_NONE', 1:
// 'COMMANDED_VALUE_CRUISE_CONTROL_CNCL', 2:
// 'COMMANDED_VALUE_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'COMMANDED_VALUE_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'COMMANDED_VALUE_CRUISE_CONTROL_SET_DEC', 5:
// 'COMMANDED_VALUE_CRUISE_CONTROL_RES_INC', 6:
// 'COMMANDED_VALUE_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Cruise_control_buttons_rpt_208::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/dash_controls_right_cmd_110.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/dash_controls_right_cmd_110.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Dashcontrolsrightcmd110::Dashcontrolsrightcmd110() {}
const int32_t Dashcontrolsrightcmd110::ID = 0x110;
void Dashcontrolsrightcmd110::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_dash_controls_right_cmd_110()->set_ignore_overrides(
ignore_overrides(bytes, length));
chassis->mutable_dash_controls_right_cmd_110()->set_enable(
enable(bytes, length));
chassis->mutable_dash_controls_right_cmd_110()->set_clear_override(
clear_override(bytes, length));
chassis->mutable_dash_controls_right_cmd_110()->set_clear_faults(
clear_faults(bytes, length));
chassis->mutable_dash_controls_right_cmd_110()->set_dash_controls_button(
dash_controls_button(bytes, length));
}
// config detail: {'name': 'ignore_overrides', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsrightcmd110::ignore_overrides(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enable', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsrightcmd110::enable(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_override', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsrightcmd110::clear_override(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'clear_faults', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Dashcontrolsrightcmd110::clear_faults(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'dash_controls_button', 'enum': {0:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE', 1:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_OK', 2:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT', 3:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT', 4:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_UP', 5:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Dash_controls_right_cmd_110::Dash_controls_buttonType
Dashcontrolsrightcmd110::dash_controls_button(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Dash_controls_right_cmd_110::Dash_controls_buttonType ret =
static_cast<Dash_controls_right_cmd_110::Dash_controls_buttonType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/rear_lights_rpt_418.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/rear_lights_rpt_418.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Rearlightsrpt418::Rearlightsrpt418() {}
const int32_t Rearlightsrpt418::ID = 0x418;
void Rearlightsrpt418::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_rear_lights_rpt_418()->set_reverse_lights_on_is_valid(
reverse_lights_on_is_valid(bytes, length));
chassis->mutable_rear_lights_rpt_418()->set_brake_lights_on_is_valid(
brake_lights_on_is_valid(bytes, length));
chassis->mutable_rear_lights_rpt_418()->set_reverse_lights_on(
reverse_lights_on(bytes, length));
chassis->mutable_rear_lights_rpt_418()->set_brake_lights_on(
brake_lights_on(bytes, length));
}
// config detail: {'name': 'reverse_lights_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Rearlightsrpt418::reverse_lights_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'brake_lights_on_is_valid', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Rearlightsrpt418::brake_lights_on_is_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'reverse_lights_on', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Rearlightsrpt418::reverse_lights_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'brake_lights_on', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Rearlightsrpt418::brake_lights_on(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/interior_lights_rpt_416.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Interiorlightsrpt416 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Interiorlightsrpt416();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'DIM_LEVEL_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 19, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool dim_level_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MOOD_LIGHTS_ON_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 18, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool mood_lights_on_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_DOME_LIGHTS_ON_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 17, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_dome_lights_on_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FRONT_DOME_LIGHTS_ON_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 16, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool front_dome_lights_on_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'DIM_LEVEL', 'enum': {0: 'DIM_LEVEL_DIM_LEVEL_MIN',
// 1: 'DIM_LEVEL_DIM_LEVEL_1', 2: 'DIM_LEVEL_DIM_LEVEL_2', 3:
// 'DIM_LEVEL_DIM_LEVEL_3', 4: 'DIM_LEVEL_DIM_LEVEL_4', 5:
// 'DIM_LEVEL_DIM_LEVEL_5', 6: 'DIM_LEVEL_DIM_LEVEL_6', 7:
// 'DIM_LEVEL_DIM_LEVEL_7', 8: 'DIM_LEVEL_DIM_LEVEL_8', 9:
// 'DIM_LEVEL_DIM_LEVEL_9', 10: 'DIM_LEVEL_DIM_LEVEL_10', 11:
// 'DIM_LEVEL_DIM_LEVEL_11', 12: 'DIM_LEVEL_DIM_LEVEL_MAX'}, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range':
// '[0|12]', 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit':
// ''}
Interior_lights_rpt_416::Dim_levelType dim_level(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MOOD_LIGHTS_ON', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool mood_lights_on(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'REAR_DOME_LIGHTS_ON', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_dome_lights_on(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FRONT_DOME_LIGHTS_ON', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool front_dome_lights_on(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/parking_brake_rpt_224.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Parkingbrakerpt224 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Parkingbrakerpt224();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 24,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool output_value(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 16,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool commanded_value(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool manual_input(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_cmd_108.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/cruise_control_buttons_cmd_108.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Cruisecontrolbuttonscmd108::ID = 0x108;
// public
Cruisecontrolbuttonscmd108::Cruisecontrolbuttonscmd108() { Reset(); }
uint32_t Cruisecontrolbuttonscmd108::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Cruisecontrolbuttonscmd108::UpdateData(uint8_t* data) {
set_p_cruise_control_button(data, cruise_control_button_);
set_p_ignore_overrides(data, ignore_overrides_);
set_p_clear_override(data, clear_override_);
set_p_enable(data, enable_);
set_p_clear_faults(data, clear_faults_);
}
void Cruisecontrolbuttonscmd108::Reset() {
// TODO(QiL) you should check this manually
cruise_control_button_ =
Cruise_control_buttons_cmd_108::CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE;
ignore_overrides_ = false;
clear_override_ = false;
enable_ = false;
clear_faults_ = false;
}
Cruisecontrolbuttonscmd108*
Cruisecontrolbuttonscmd108::set_cruise_control_button(
Cruise_control_buttons_cmd_108::Cruise_control_buttonType
cruise_control_button) {
cruise_control_button_ = cruise_control_button;
return this;
}
// config detail: {'name': 'CRUISE_CONTROL_BUTTON', 'enum': {0:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE', 1:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_CNCL', 2:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_FURTHER', 3:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_CLOSER', 4:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_SET_DEC', 5:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_RES_INC', 6:
// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
void Cruisecontrolbuttonscmd108::set_p_cruise_control_button(
uint8_t* data, Cruise_control_buttons_cmd_108::Cruise_control_buttonType
cruise_control_button) {
uint8_t x = cruise_control_button;
Byte to_set(data + 1);
to_set.set_value(static_cast<uint8_t>(x), 0, 8);
}
Cruisecontrolbuttonscmd108* Cruisecontrolbuttonscmd108::set_ignore_overrides(
bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Cruisecontrolbuttonscmd108::set_p_ignore_overrides(uint8_t* data,
bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Cruisecontrolbuttonscmd108* Cruisecontrolbuttonscmd108::set_clear_override(
bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Cruisecontrolbuttonscmd108::set_p_clear_override(uint8_t* data,
bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Cruisecontrolbuttonscmd108* Cruisecontrolbuttonscmd108::set_enable(
bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Cruisecontrolbuttonscmd108::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Cruisecontrolbuttonscmd108* Cruisecontrolbuttonscmd108::set_clear_faults(
bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Cruisecontrolbuttonscmd108::set_p_clear_faults(uint8_t* data,
bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/accel_rpt_200.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/accel_rpt_200.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Accelrpt200::Accelrpt200() {}
const int32_t Accelrpt200::ID = 0x200;
void Accelrpt200::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_accel_rpt_200()->set_vehicle_fault(
vehicle_fault(bytes, length));
chassis->mutable_accel_rpt_200()->set_pacmod_fault(
pacmod_fault(bytes, length));
chassis->mutable_accel_rpt_200()->set_output_reported_fault(
output_reported_fault(bytes, length));
chassis->mutable_accel_rpt_200()->set_input_output_fault(
input_output_fault(bytes, length));
chassis->mutable_accel_rpt_200()->set_command_output_fault(
command_output_fault(bytes, length));
chassis->mutable_accel_rpt_200()->set_override_active(
override_active(bytes, length));
chassis->mutable_accel_rpt_200()->set_enabled(
enabled(bytes, length));
chassis->mutable_accel_rpt_200()->set_manual_input(
manual_input(bytes, length));
chassis->mutable_accel_rpt_200()->set_commanded_value(
commanded_value(bytes, length));
chassis->mutable_accel_rpt_200()->set_output_value(
output_value(bytes, length));
}
// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::vehicle_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(6, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::pacmod_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(5, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::output_reported_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(4, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'input_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::input_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(3, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'command_output_fault', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::command_output_fault(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(2, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::override_active(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(1, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
bool Accelrpt200::enabled(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 1);
bool ret = x;
return ret;
}
// config detail: {'name': 'manual_input', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Accelrpt200::manual_input(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 1);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 2);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'commanded_value', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 31,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Accelrpt200::commanded_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 3);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 4);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
// config detail: {'name': 'output_value', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 47,
// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double Accelrpt200::output_value(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 5);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 6);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.001000;
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/media_controls_rpt_220.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Mediacontrolsrpt220 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Mediacontrolsrpt220();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0:
// 'OUTPUT_VALUE_MEDIA_CONTROL_NONE', 1:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'OUTPUT_VALUE_MEDIA_CONTROL_MUTE', 3:
// 'OUTPUT_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'OUTPUT_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOL_UP', 6:
// 'OUTPUT_VALUE_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 31, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Output_valueType output_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_MEDIA_CONTROL_NONE', 1:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'COMMANDED_VALUE_MEDIA_CONTROL_MUTE', 3:
// 'COMMANDED_VALUE_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'COMMANDED_VALUE_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOL_UP', 6:
// 'COMMANDED_VALUE_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Commanded_valueType commanded_value(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0:
// 'MANUAL_INPUT_MEDIA_CONTROL_NONE', 1:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOICE_COMMAND', 2:
// 'MANUAL_INPUT_MEDIA_CONTROL_MUTE', 3:
// 'MANUAL_INPUT_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
// 'MANUAL_INPUT_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOL_UP', 6:
// 'MANUAL_INPUT_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Media_controls_rpt_220::Manual_inputType manual_input(
const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/vehicle_speed_rpt_400.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/vehicle_speed_rpt_400.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
Vehiclespeedrpt400::Vehiclespeedrpt400() {}
const int32_t Vehiclespeedrpt400::ID = 0x400;
void Vehiclespeedrpt400::Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const {
chassis->mutable_vehicle_speed_rpt_400()->set_vehicle_speed(
vehicle_speed(bytes, length));
chassis->mutable_vehicle_speed_rpt_400()->set_vehicle_speed_valid(
vehicle_speed_valid(bytes, length));
}
// config detail: {'name': 'vehicle_speed', 'offset': 0.0, 'precision': 0.01,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-327.68|327.67]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'm/s'}
double Vehiclespeedrpt400::vehicle_speed(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
x <<= 16;
x >>= 16;
double ret = x * 0.010000;
return ret;
}
// config detail: {'name': 'vehicle_speed_valid', 'enum': {0:
// 'VEHICLE_SPEED_VALID_INVALID', 1: 'VEHICLE_SPEED_VALID_VALID'},
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0,
// 'physical_range': '[0|1]', 'bit': 16, 'type': 'enum', 'order': 'motorola',
// 'physical_unit': ''}
Vehicle_speed_rpt_400::Vehicle_speed_validType
Vehiclespeedrpt400::vehicle_speed_valid(const std::uint8_t* bytes,
int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 1);
Vehicle_speed_rpt_400::Vehicle_speed_validType ret =
static_cast<Vehicle_speed_rpt_400::Vehicle_speed_validType>(x);
return ret;
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/accel_aux_rpt_300.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Accelauxrpt300 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Accelauxrpt300();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'USER_INTERACTION_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 42, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool user_interaction_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'USER_INTERACTION', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 32, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool user_interaction(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_FORCE_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 41, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool raw_pedal_force_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_FORCE', 'offset': 0.0, 'precision':
// 0.001, 'len': 16, 'is_signed_var': True, 'physical_range':
// '[-32.768|32.767]', 'bit': 23, 'type': 'double', 'order': 'motorola',
// 'physical_unit': ''}
double raw_pedal_force(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_POS_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 40, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool raw_pedal_pos_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'RAW_PEDAL_POS', 'offset': 0.0, 'precision': 0.001,
// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
double raw_pedal_pos(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/headlight_cmd_118.cc
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus_vehicle/lexus/protocol/headlight_cmd_118.h"
#include "modules/drivers/canbus/common/byte.h"
namespace apollo {
namespace canbus {
namespace lexus {
using ::apollo::drivers::canbus::Byte;
const int32_t Headlightcmd118::ID = 0x118;
// public
Headlightcmd118::Headlightcmd118() { Reset(); }
uint32_t Headlightcmd118::GetPeriod() const {
// TODO(QiL) modify every protocol's period manually
static const uint32_t PERIOD = 20 * 1000;
return PERIOD;
}
void Headlightcmd118::UpdateData(uint8_t* data) {
set_p_ignore_overrides(data, ignore_overrides_);
set_p_enable(data, enable_);
set_p_clear_override(data, clear_override_);
set_p_clear_faults(data, clear_faults_);
set_p_headlight_cmd(data, headlight_cmd_);
}
void Headlightcmd118::Reset() {
// TODO(QiL) you should check this manually
ignore_overrides_ = false;
enable_ = false;
clear_override_ = false;
clear_faults_ = false;
headlight_cmd_ = Headlight_cmd_118::HEADLIGHT_CMD_HEADLIGHTS_OFF;
}
Headlightcmd118* Headlightcmd118::set_ignore_overrides(bool ignore_overrides) {
ignore_overrides_ = ignore_overrides;
return this;
}
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Headlightcmd118::set_p_ignore_overrides(uint8_t* data,
bool ignore_overrides) {
uint8_t x = ignore_overrides;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 1, 1);
}
Headlightcmd118* Headlightcmd118::set_enable(bool enable) {
enable_ = enable;
return this;
}
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
// 'order': 'motorola', 'physical_unit': ''}
void Headlightcmd118::set_p_enable(uint8_t* data, bool enable) {
uint8_t x = enable;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 0, 1);
}
Headlightcmd118* Headlightcmd118::set_clear_override(bool clear_override) {
clear_override_ = clear_override;
return this;
}
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Headlightcmd118::set_p_clear_override(uint8_t* data, bool clear_override) {
uint8_t x = clear_override;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 2, 1);
}
Headlightcmd118* Headlightcmd118::set_clear_faults(bool clear_faults) {
clear_faults_ = clear_faults;
return this;
}
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
void Headlightcmd118::set_p_clear_faults(uint8_t* data, bool clear_faults) {
uint8_t x = clear_faults;
Byte to_set(data + 0);
to_set.set_value(static_cast<uint8_t>(x), 3, 1);
}
Headlightcmd118* Headlightcmd118::set_headlight_cmd(
Headlight_cmd_118::Headlight_cmdType headlight_cmd) {
headlight_cmd_ = headlight_cmd;
return this;
}
// config detail: {'name': 'HEADLIGHT_CMD', 'enum': {0:
// 'HEADLIGHT_CMD_HEADLIGHTS_OFF', 1: 'HEADLIGHT_CMD_LOW_BEAMS', 2:
// 'HEADLIGHT_CMD_HIGH_BEAMS'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
// False, 'offset': 0.0, 'physical_range': '[0|2]', 'bit': 15, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
void Headlightcmd118::set_p_headlight_cmd(
uint8_t* data, Headlight_cmd_118::Headlight_cmdType headlight_cmd) {
uint8_t x = headlight_cmd;
Byte to_set(data + 1);
to_set.set_value(static_cast<uint8_t>(x), 0, 8);
}
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/dash_controls_left_cmd_10c.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Dashcontrolsleftcmd10c : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Dashcontrolsleftcmd10c();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool ignore_overrides(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enable(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_override(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool clear_faults(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DASH_CONTROLS_BUTTON', 'enum': {0:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_NONE', 1:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_OK', 2:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_LEFT', 3:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_RIGHT', 4:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_UP', 5:
// 'DASH_CONTROLS_BUTTON_DASH_CONTROL_DOWN'}, 'precision': 1.0, 'len': 8,
// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Dash_controls_left_cmd_10c::Dash_controls_buttonType dash_controls_button(
const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/brake_motor_rpt_3_403.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Brakemotorrpt3403 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Brakemotorrpt3403();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'TORQUE_OUTPUT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 7, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'N-m'}
double torque_output(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'TORQUE_INPUT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'N-m'}
double torque_input(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/horn_rpt_21c.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Hornrpt21c : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Hornrpt21c();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'VEHICLE_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool vehicle_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'PACMOD_FAULT', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pacmod_fault(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OVERRIDE_ACTIVE', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool override_active(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'OUTPUT_REPORTED_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool output_reported_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'INPUT_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool input_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'ENABLED', 'offset': 0.0, 'precision': 1.0, 'len':
// 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type':
// 'bool', 'order': 'motorola', 'physical_unit': ''}
bool enabled(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'COMMAND_OUTPUT_FAULT', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool command_output_fault(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'OUTPUT_VALUE', 'enum': {0: 'OUTPUT_VALUE_OFF', 1:
// 'OUTPUT_VALUE_ON'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 31, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Horn_rpt_21c::Output_valueType output_value(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'COMMANDED_VALUE', 'enum': {0:
// 'COMMANDED_VALUE_OFF', 1: 'COMMANDED_VALUE_ON'}, 'precision': 1.0, 'len':
// 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit':
// 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
Horn_rpt_21c::Commanded_valueType commanded_value(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'MANUAL_INPUT', 'enum': {0: 'MANUAL_INPUT_OFF', 1:
// 'MANUAL_INPUT_ON'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 15, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Horn_rpt_21c::Manual_inputType manual_input(const std::uint8_t* bytes,
const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/steering_motor_rpt_1_404.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Steeringmotorrpt1404 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Steeringmotorrpt1404();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'MOTOR_CURRENT', 'offset': 0.0, 'precision': 0.001,
// 'len': 32, 'is_signed_var': False, 'physical_range': '[0|4294967.295]',
// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'amps'}
double motor_current(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'SHAFT_POSITION', 'offset': 0.0, 'precision':
// 0.001, 'len': 32, 'is_signed_var': True, 'physical_range':
// '[-2147483.648|2147483.647]', 'bit': 39, 'type': 'double', 'order':
// 'motorola', 'physical_unit': 'amps'}
double shaft_position(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus
|
apollo_public_repos/apollo/modules/canbus_vehicle/lexus/protocol/door_rpt_417.h
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include "modules/canbus_vehicle/lexus/proto/lexus.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"
namespace apollo {
namespace canbus {
namespace lexus {
class Doorrpt417 : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::Lexus> {
public:
static const int32_t ID;
Doorrpt417();
void Parse(const std::uint8_t* bytes, int32_t length,
Lexus* chassis) const override;
private:
// config detail: {'name': 'FUEL_DOOR_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 14, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool fuel_door_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'TRUNK_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 13, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool trunk_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'HOOD_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 12, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool hood_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_PASS_DOOR_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 11, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_pass_door_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_DRIVER_DOOR_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 10, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_driver_door_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'PASS_DOOR_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool pass_door_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'DRIVER_DOOR_OPEN_IS_VALID', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool driver_door_open_is_valid(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'FUEL_DOOR_OPEN', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool fuel_door_open(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'TRUNK_OPEN', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool trunk_open(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'HOOD_OPEN', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 4,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool hood_open(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'REAR_PASS_DOOR_OPEN', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_pass_door_open(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'REAR_DRIVER_DOOR_OPEN', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool rear_driver_door_open(const std::uint8_t* bytes,
const int32_t length) const;
// config detail: {'name': 'PASS_DOOR_OPEN', 'offset': 0.0, 'precision': 1.0,
// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
bool pass_door_open(const std::uint8_t* bytes, const int32_t length) const;
// config detail: {'name': 'DRIVER_DOOR_OPEN', 'offset': 0.0,
// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'motorola', 'physical_unit':
// ''}
bool driver_door_open(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace lexus
} // namespace canbus
} // namespace apollo
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.