forked from Autonomous-Vehicles/adas-api
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'main' of github.coventry.ac.uk:ac0745/adas-api into main
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,51 @@ | ||
#include "status/brake_frame.h" | ||
|
||
const float BrakeFrame::front_hydrolic_brake() const | ||
{ | ||
return candata_vcu2_ai_brake_hyd_press_f_pct_decode( data.hyd_press_f_pct ); | ||
|
||
} | ||
|
||
const float BrakeFrame::front_hydrolic_brake_request() const | ||
{ | ||
return candata_vcu2_ai_brake_hyd_press_f_req_pct_decode( data.hyd_press_f_req_pct ); | ||
} | ||
|
||
const float BrakeFrame::rear_hydrolic_brake() const | ||
{ | ||
return candata_vcu2_ai_brake_hyd_press_r_pct_decode( data.hyd_press_r_pct ); | ||
} | ||
|
||
const float BrakeFrame::rear_hydrolic_brake_request() const | ||
{ | ||
return candata_vcu2_ai_brake_hyd_press_r_req_pct_decode( data.hyd_press_r_req_pct ); | ||
} | ||
|
||
const BrakeFrame::BrakeState BrakeFrame::brake_state() const | ||
{ | ||
return static_cast<BrakeState>( candata_vcu2_ai_brake_status_brk_decode( data.status_brk) ); | ||
} | ||
|
||
const BrakeFrame::EbsState BrakeFrame::ebs_state() const | ||
{ | ||
return static_cast<EbsState> (candata_vcu2_ai_brake_status_ebs_decode(data.status_ebs)); | ||
} | ||
|
||
void BrakeFrame::_process( const can_frame& frame ) | ||
{ | ||
if( candata_vcu2_ai_brake_unpack( &data, frame.data, frame.can_dlc ) ) | ||
{ | ||
throw std::runtime_error( "Failed to unpack brake frame" ); | ||
} | ||
} | ||
|
||
void BrakeFrame::_print( std::ostream& os ) const | ||
{ | ||
// TODO Meaningfull message | ||
os << "Brake Frame: " ; | ||
} | ||
|
||
BrakeFrame::BrakeFrame() : | ||
ProcessFrame( CANDATA_VCU2_AI_BRAKE_FRAME_ID ) | ||
{ | ||
} |