Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
2602397c
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2602397c
编写于
10月 28, 2020
作者:
C
Chao Ma
提交者:
GitHub
10月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
canbus: add the new battery soc protocol in chassis for vehicle dev_kit (#12866)
上级
fa7e766e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
34 deletion
+14
-34
modules/canbus/proto/chassis.proto
modules/canbus/proto/chassis.proto
+2
-0
modules/canbus/proto/devkit.proto
modules/canbus/proto/devkit.proto
+1
-1
modules/canbus/vehicle/devkit/devkit_controller.cc
modules/canbus/vehicle/devkit/devkit_controller.cc
+4
-26
modules/canbus/vehicle/devkit/protocol/vcu_report_505.cc
modules/canbus/vehicle/devkit/protocol/vcu_report_505.cc
+4
-4
modules/canbus/vehicle/devkit/protocol/vcu_report_505.h
modules/canbus/vehicle/devkit/protocol/vcu_report_505.h
+2
-2
modules/canbus/vehicle/devkit/protocol/vcu_report_505_test.cc
...les/canbus/vehicle/devkit/protocol/vcu_report_505_test.cc
+1
-1
未找到文件。
modules/canbus/proto/chassis.proto
浏览文件 @
2602397c
...
...
@@ -124,6 +124,8 @@ message Chassis {
// replace this [id 23]
optional
apollo.common.VehicleID
vehicle_id
=
33
;
optional
int32
battery_soc
=
34
;
}
message
ChassisGPS
{
...
...
modules/canbus/proto/devkit.proto
浏览文件 @
2602397c
...
...
@@ -220,7 +220,7 @@ message Vcu_report_505 {
// [m/s] [0|65.535]
optional
double
speed
=
6
;
// [%] [0|100]
optional
int32
batt
a
ry_soc
=
7
;
optional
int32
batt
e
ry_soc
=
7
;
}
message
Steering_report_502
{
...
...
modules/canbus/vehicle/devkit/devkit_controller.cc
浏览文件 @
2602397c
...
...
@@ -184,8 +184,11 @@ Chassis DevkitController::chassis() {
chassis_detail
.
devkit
().
vcu_report_505
().
has_speed
())
{
chassis_
.
set_speed_mps
(
static_cast
<
float
>
(
chassis_detail
.
devkit
().
vcu_report_505
().
speed
()));
chassis_
.
set_battery_soc
(
chassis_detail
.
devkit
().
vcu_report_505
().
battery_soc
());
}
else
{
chassis_
.
set_speed_mps
(
0
);
chassis_
.
set_battery_soc
(
0
);
}
// 7 no odometer
// chassis_.set_odometer_m(0);
...
...
@@ -480,10 +483,6 @@ bool DevkitController::CheckChassisError() {
devkit
.
steering_report_502
().
steer_flt1
())
{
return
true
;
}
if
(
Steering_report_502
::
STEER_FLT2_STEER_SYSTEM_COMUNICATION_FAULT
==
devkit
.
steering_report_502
().
steer_flt2
())
{
return
true
;
}
}
// drive fault
if
(
devkit
.
has_throttle_report_500
())
{
...
...
@@ -491,10 +490,6 @@ bool DevkitController::CheckChassisError() {
devkit
.
throttle_report_500
().
throttle_flt1
())
{
return
true
;
}
if
(
Throttle_report_500
::
THROTTLE_FLT2_DRIVE_SYSTEM_COMUNICATION_FAULT
==
devkit
.
throttle_report_500
().
throttle_flt2
())
{
return
true
;
}
}
// brake fault
if
(
devkit
.
has_brake_report_501
())
{
...
...
@@ -502,25 +497,8 @@ bool DevkitController::CheckChassisError() {
devkit
.
brake_report_501
().
brake_flt1
())
{
return
true
;
}
if
(
Brake_report_501
::
BRAKE_FLT2_BRAKE_SYSTEM_COMUNICATION_FAULT
==
devkit
.
brake_report_501
().
brake_flt2
())
{
return
true
;
}
}
// gear fault
if
(
devkit
.
has_gear_report_503
())
{
if
(
Gear_report_503
::
GEAR_FLT_FAULT
==
devkit
.
gear_report_503
().
gear_flt
())
{
return
true
;
}
}
// park fault
if
(
devkit
.
has_park_report_504
())
{
if
(
Park_report_504
::
PARK_FLT_FAULT
==
devkit
.
park_report_504
().
park_flt
())
{
return
true
;
}
}
return
false
;
}
...
...
modules/canbus/vehicle/devkit/protocol/vcu_report_505.cc
浏览文件 @
2602397c
...
...
@@ -31,8 +31,8 @@ const int32_t Vcureport505::ID = 0x505;
void
Vcureport505
::
Parse
(
const
std
::
uint8_t
*
bytes
,
int32_t
length
,
ChassisDetail
*
chassis
)
const
{
chassis
->
mutable_devkit
()
->
mutable_vcu_report_505
()
->
set_batt
a
ry_soc
(
batt
a
ry_soc
(
bytes
,
length
));
chassis
->
mutable_devkit
()
->
mutable_vcu_report_505
()
->
set_batt
e
ry_soc
(
batt
e
ry_soc
(
bytes
,
length
));
chassis
->
mutable_devkit
()
->
mutable_vcu_report_505
()
->
set_vehicle_mode_state
(
vehicle_mode_state
(
bytes
,
length
));
chassis
->
mutable_devkit
()
->
mutable_vcu_report_505
()
->
set_frontcrash_state
(
...
...
@@ -47,10 +47,10 @@ void Vcureport505::Parse(const std::uint8_t* bytes, int32_t length,
speed
(
bytes
,
length
));
}
// config detail: {'name': 'batt
a
ry_soc', 'offset': 0.0, 'precision': 1.0,
// config detail: {'name': 'batt
e
ry_soc', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|100]', 'bit': 47,
// 'type': 'int', 'order': 'motorola', 'physical_unit': '%'}
int
Vcureport505
::
batt
a
ry_soc
(
const
std
::
uint8_t
*
bytes
,
int32_t
length
)
const
{
int
Vcureport505
::
batt
e
ry_soc
(
const
std
::
uint8_t
*
bytes
,
int32_t
length
)
const
{
Byte
t0
(
bytes
+
5
);
int32_t
x
=
t0
.
get_byte
(
0
,
8
);
...
...
modules/canbus/vehicle/devkit/protocol/vcu_report_505.h
浏览文件 @
2602397c
...
...
@@ -32,10 +32,10 @@ class Vcureport505 : public ::apollo::drivers::canbus::ProtocolData<
ChassisDetail
*
chassis
)
const
override
;
private:
// config detail: {'name': 'Batt
a
ry_Soc', 'offset': 0.0, 'precision': 1.0,
// config detail: {'name': 'Batt
e
ry_Soc', 'offset': 0.0, 'precision': 1.0,
// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|100]', 'bit': 47,
// 'type': 'int', 'order': 'motorola', 'physical_unit': '%'}
int
batt
a
ry_soc
(
const
std
::
uint8_t
*
bytes
,
const
int32_t
length
)
const
;
int
batt
e
ry_soc
(
const
std
::
uint8_t
*
bytes
,
const
int32_t
length
)
const
;
// config detail: {'name': 'Vehicle_Mode_State', 'enum': {0:
// 'VEHICLE_MODE_STATE_MANUAL_REMOTE_MODE', 1: 'VEHICLE_MODE_STATE_AUTO_MODE',
...
...
modules/canbus/vehicle/devkit/protocol/vcu_report_505_test.cc
浏览文件 @
2602397c
...
...
@@ -42,7 +42,7 @@ TEST_F(Vcureport505Test, General) {
EXPECT_EQ
(
data
[
6
],
0b00000100
);
EXPECT_EQ
(
data
[
7
],
0b00000101
);
EXPECT_EQ
(
cd
.
devkit
().
vcu_report_505
().
batt
a
ry_soc
(),
3
);
EXPECT_EQ
(
cd
.
devkit
().
vcu_report_505
().
batt
e
ry_soc
(),
3
);
EXPECT_EQ
(
cd
.
devkit
().
vcu_report_505
().
vehicle_mode_state
(),
1
);
EXPECT_EQ
(
cd
.
devkit
().
vcu_report_505
().
frontcrash_state
(),
1
);
EXPECT_EQ
(
cd
.
devkit
().
vcu_report_505
().
backcrash_state
(),
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录