Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented power mode frame and ROS callbacks send data to CAN #428

Merged
merged 48 commits into from
Sep 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0537543
trying to fix desired heading
lross03 Jun 8, 2024
b7c265a
finished rudder data frame and modified tests for old can frames
lross03 Jun 15, 2024
d72fe08
trying to fix desired heading
lross03 Jun 8, 2024
380a4d5
finished rudder data frame and modified tests for old can frames
lross03 Jun 15, 2024
2c6361f
Finished tests for new frames except power mode
lross03 Jun 29, 2024
2459e0f
Finished tests for new frames except power mode
lross03 Jun 29, 2024
608e94b
Merge branch 'user/lross03/can_frame_parser' of https://github.com/UB…
lross03 Jun 29, 2024
6633930
Minor change in test
lross03 Jun 29, 2024
be1c3ca
Power mode and tests complete
lross03 Jun 29, 2024
55b5a03
Removed TODO comment
lross03 Jun 29, 2024
b32ba23
rebasing with main
lross03 Jun 8, 2024
45b48a3
finished rudder data frame and modified tests for old can frames
lross03 Jun 15, 2024
79f21a1
rebasing to main
lross03 Jun 29, 2024
f0f54a9
Finished tests for new frames except power mode
lross03 Jun 29, 2024
e62caaf
rebasing with main
lross03 Jun 8, 2024
1a16790
rebasing with main
lross03 Jun 15, 2024
7cc341d
Minor change in test
lross03 Jun 29, 2024
2c93fa9
fixing merge conflicts again
lross03 Jul 13, 2024
d833c17
replaced old CAN frame names in ros interface with new names
lross03 Jul 13, 2024
ed4d1b6
Power mode can frame parsing and ros interface functionality implemented
lross03 Jul 13, 2024
af4ad32
Added power mode condition where it will only return to normal mode o…
lross03 Jul 13, 2024
679e7d8
Addresed PR comments
lross03 Jul 20, 2024
cb582fb
Minor changes
lross03 Jul 20, 2024
2e61987
Merge branch 'main' into user/lross03/can_frame_parser
lross03 Jul 20, 2024
54ae95f
trying to fix desired heading
lross03 Jun 8, 2024
4b4809c
finished rudder data frame and modified tests for old can frames
lross03 Jun 15, 2024
e263ac6
Finished tests for new frames except power mode
lross03 Jun 29, 2024
af21eaa
Finished tests for new frames except power mode
lross03 Jun 29, 2024
74a3c3d
trying to fix desired heading
lross03 Jun 8, 2024
cd6a7d3
finished rudder data frame and modified tests for old can frames
lross03 Jun 15, 2024
62057a8
Minor change in test
lross03 Jun 29, 2024
a4d5cc4
Power mode and tests complete
lross03 Jun 29, 2024
6ebfec3
Removed TODO comment
lross03 Jun 29, 2024
66dbab1
Power mode can frame parsing and ros interface functionality implemented
lross03 Jul 13, 2024
6dfd83c
Added power mode condition where it will only return to normal mode o…
lross03 Jul 13, 2024
691c9f0
trying to rebase main
lross03 Jul 27, 2024
10f0846
fixing merge conflicts
lross03 Jul 27, 2024
638a597
removed duplicate test
lross03 Jul 27, 2024
8813a8e
Merge branch 'main' into user/lross03/can_frame_parser
lross03 Jul 27, 2024
ae9d79c
Implemented sending to CAN for sail commands and desired heading
lross03 Jul 27, 2024
d9c49e1
added tests for callbacks
lross03 Jul 27, 2024
087b552
merging power mode changes
lross03 Jul 27, 2024
4d83cfc
Fixed merge issues
lross03 Jul 27, 2024
14d1a1b
Merge branch 'main' into user/lross03/can_transceiver_ros
lross03 Aug 10, 2024
8c44d53
Merged with main
lross03 Aug 10, 2024
cd5c134
Removed duplicate line
lross03 Aug 29, 2024
992c329
merge from main
samdai01 Sep 28, 2024
67c979d
Merge branch 'main' into user/lross03/can_transceiver_ros
samdai01 Sep 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finished rudder data frame and modified tests for old can frames
lross03 committed Jun 29, 2024
commit 380a4d5271520874e5ec23a049b50200117d8bb5
2 changes: 1 addition & 1 deletion src/custom_interfaces/msg/HelperAISShip.msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AIS identifier (MMSI)
int32 id
uint32 id
HelperLatLon lat_lon
# The ship's course over ground
HelperHeading cog
108 changes: 82 additions & 26 deletions src/network_systems/projects/can_transceiver/inc/can_frame_parser.h
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@
#include <array>
#include <custom_interfaces/msg/ais_ships.hpp>
#include <custom_interfaces/msg/batteries.hpp>
#include <custom_interfaces/msg/desired_heading.hpp>
#include <custom_interfaces/msg/gps.hpp>
#include <custom_interfaces/msg/helper_ais_ship.hpp>
#include <custom_interfaces/msg/sail_cmd.hpp>
#include <custom_interfaces/msg/wind_sensor.hpp>
#include <custom_interfases/msg/desired_heading.hpp>
#include <map>
#include <optional>
#include <span>
@@ -33,9 +33,11 @@ enum class CanId : canid_t {
PWR_MODE = 0x00,
MAIN_HEADING = 0x01,
MAIN_TR_TAB = 0x02,
RESERVED = 0x29,
BMS_DATA_FRAME = 0x30,
SAIL_WIND = 0x40,
DATA_WIND = 0x41,
RUDDER_DATA_FRAME = 0x50,
SAIL_AIS = 0x60,
PATH_GPS_DATA_FRAME = 0x70,
GENERIC_SENSOR_START = 0x100,
@@ -51,10 +53,11 @@ static const std::map<CanId, std::string> CAN_DESC{
{CanId::MAIN_HEADING, "MAIN_HEADING (Main heading for rudder)"},
{CanId::MAIN_TR_TAB, "MAIN_TR_TAB (Trim tab for sail)"},
{CanId::BMS_DATA_FRAME, "BMS_P_DATA_FRAME_1 (Battery 1 data)"},
{CanId::RESERVED, "Reserved for mainframe (0x0 - 0x29)"},
{CanId::SAIL_AIS, "SAIL_AIS (AIS ship data)"},
{CanId::MAIN_TR_TAB, "MAIN_TR_TAB (Main sail command)"},
{CanId::MAIN_HEADING, "MAIN_HEADING (Main rudder command)"},
{CanId::SAIL_WIND, "SAIL_WIND (Mast wind sensor)"},
{CanId::RUDDER_DATA_FRAME, "RUDDER_DATA_FRAME (Rudder data from ecompass)"},
{CanId::PATH_GPS_DATA_FRAME, "PATH_GPS_DATA_FRAME (GPS latitude)"},
{CanId::DATA_WIND, "DATA_WIND (Hull wind sensor)"}};

@@ -164,7 +167,7 @@ class Battery final : public BaseFrame
* @brief Construct a Battery object from a custom_interfaces ROS msg representation
*
* @param ros_bat custom_interfaces representation of a Battery
* @param id CanId of the battery (use the rosIdxToCanId() method if unknown)
* @param id CanId of the battery
*/
explicit Battery(msg::HelperBattery ros_bat, CanId id);

@@ -230,7 +233,7 @@ class SailCmd final : public BaseFrame
* @brief Construct a SailCmd object from a custom_interfaces ROS msg representation
*
* @param ros_sail_cmd custom_interfaces representation of a SailCmd
* @param id CanId of the SailCmd (use the rosIdxToCanId() method if unknown)
* @param id CanId of the SailCmd
*/
explicit SailCmd(msg::SailCmd ros_sail_cmd, CanId id);

@@ -376,7 +379,7 @@ class GPS final : public BaseFrame
* @brief Construct a GPS object from a custom_interfaces ROS msg representation
*
* @param ros_gps custom_interfaces representation of a GPS
* @param id CanId of the GPS (use the rosIdxToCanId() method if unknown)
* @param id CanId of the GPS
*/
explicit GPS(msg::GPS ros_gps, CanId id);

@@ -395,15 +398,6 @@ class GPS final : public BaseFrame
*/
std::string debugStr() const override;

/**
* @brief Factory method to convert the index of a GPS in the custom_interfaces ROS representation
* into a CanId if valid.
*
* @param gps_idx idx of the GPS in a custom_interfaces::msg::GPS array
* @return CanId if valid, std::nullopt if invalid
*/
static std::optional<CanId> rosIdxToCanId(size_t gps_idx);

private:
/**
* @brief Private helper constructor for GPS objects
@@ -598,17 +592,16 @@ class PwrMode final : public BaseFrame
uint8_t mode_;
};

//TODO: Create MAIN_HEADING frame
/**
* @brief A rudder class derived from the BaseFrame. Represents a rudder command.
* @brief A DesiredHeading class derived from the BaseFrame. Represents a desired heading for the rudder.
*
*/
class DesiredHeading final : public BaseFrame
{
public:
static constexpr std::array<CanId, 1> RUDDER_CMD_IDS = {CanId::MAIN_HEADING};
static constexpr uint8_t CAN_BYTE_DLEN_ = 2;
static constexpr uint8_t BYTE_OFF_HEADING = 0;
static constexpr std::array<CanId, 1> DESIRED_HEADING_IDS = {CanId::MAIN_HEADING};
static constexpr uint8_t CAN_BYTE_DLEN_ = 4;
static constexpr uint8_t BYTE_OFF_HEADING = 0;

/**
* @brief Explicitly deleted no-argument constructor
@@ -617,7 +610,7 @@ class DesiredHeading final : public BaseFrame
DesiredHeading() = delete;

/**
* @brief Construct a SailCmd object from a Linux CanFrame representation
* @brief Construct a Desiredheading object from a Linux CanFrame representation
*
* @param cf Linux CanFrame
*/
@@ -626,15 +619,15 @@ class DesiredHeading final : public BaseFrame
/**
* @brief Construct a DesiredHeading object from a custom_interfaces ROS msg representation
*
* @param ros_sail_cmd custom_interfaces representation of a DesiredHeading
* @param id CanId of the DesiredHeading (use the rosIdxToCanId() method if unknown)
* @param ros_desired_heading custom_interfaces representation of a DesiredHeading
* @param id CanId of the DesiredHeading
*/
explicit DesiredHeading(msg::DesiredHeading ros_rudder_cmd, CanId id);
explicit DesiredHeading(msg::DesiredHeading ros_desired_heading, CanId id);

/**
* @return the custom_interfaces ROS representation of the DesiredHeading object
*/
//msg::DesiredHeading toRosMsg() const;
msg::DesiredHeading toRosMsg() const;

/**
* @return the Linux CanFrame representation of the DesiredHeading object
@@ -663,8 +656,71 @@ class DesiredHeading final : public BaseFrame
float heading_; // Angle specified by the command
};

//TODO: Create MAIN_TR_TAB frame
/**
* @brief A Rudder Data class derived from the BaseFrame. Represents data of rudder's position.
*
*/
class RudderData final : public BaseFrame
{
public:
static constexpr std::array<CanId, 1> RUDDER_DATA_IDS = {CanId::RUDDER_DATA_FRAME};
static constexpr uint8_t CAN_BYTE_DLEN_ = 2;
static constexpr uint8_t BYTE_OFF_HEADING = 0;

/**
* @brief Explicitly deleted no-argument constructor
*
*/
RudderData() = delete;

/**
* @brief Construct a RudderData object from a Linux CanFrame representation
*
* @param cf Linux CanFrame
*/
explicit RudderData(const CanFrame & cf);

/**
* @brief Construct a HelperHeading object from a custom_interfaces ROS msg representation
*
* @param ros_rudder_heading custom_interfaces representation of a HelperHeading
* @param id CanId of the HelperHeading
*/
explicit RudderData(msg::HelperHeading ros_rudder_data, CanId id);

/**
* @return the custom_interfaces ROS representation of the DesiredHeading object
*/
msg::HelperHeading toRosMsg() const;

/**
* @return the Linux CanFrame representation of the RudderData object
*/
CanFrame toLinuxCan() const override;

/**
* @return A string that can be printed or logged to debug a RudderData object
*/
std::string debugStr() const override;

private:
/**
* @brief Private helper constructor for DesiredHeading objects
*
* @param id CanId of the RudderData
*/
explicit RudderData(CanId id);

/**
* @brief Check if the assigned fields after constructing a DesiredHeading object are within bounds.
* @throws std::out_of_range if any assigned fields are outside of expected bounds
*/
void checkBounds() const;

float heading_;
};

//TODO: Create RUDDER_DATA_FRAME frame
//TODO: update tests for sail
//TODO: write tests for desired heading and rudder data

} // namespace CAN_FP
Original file line number Diff line number Diff line change
@@ -150,11 +150,11 @@ void Battery::checkBounds() const

SailCmd::SailCmd(const CanFrame & cf) : SailCmd(static_cast<CanId>(cf.can_id))
{
int16_t raw_angle;
uint32_t raw_angle;

std::memcpy(&raw_angle, cf.data + BYTE_OFF_ANGLE, sizeof(int16_t));
std::memcpy(&raw_angle, cf.data + BYTE_OFF_ANGLE, sizeof(uint32_t));

angle_ = static_cast<float>(raw_angle);
angle_ = static_cast<float>(raw_angle) / 1000; //NOLINT(readability-magic-numbers)

checkBounds();
}
@@ -174,10 +174,10 @@ msg::SailCmd SailCmd::toRosMsg() const

CanFrame SailCmd::toLinuxCan() const
{
int16_t raw_angle = static_cast<int16_t>(angle_);
uint32_t raw_angle = static_cast<uint32_t>(angle_) * 1000; //NOLINT(readability-magic-numbers)

CanFrame cf = BaseFrame::toLinuxCan();
std::memcpy(cf.data + BYTE_OFF_ANGLE, &raw_angle, sizeof(int16_t));
std::memcpy(cf.data + BYTE_OFF_ANGLE, &raw_angle, sizeof(uint32_t));

return cf;
}
@@ -675,66 +675,129 @@ void PwrMode::checkBounds() const
// PwrMode private END
// PwrMode END

// MAIN_HEADING START
// MAIN_HEADING public START
// DesiredHeading START
// DesiredHeading public START

RudderCmd::RudderCmd(const CanFrame & cf) : RudderCmd(static_cast<CanId>(cf.can_id))
DesiredHeading::DesiredHeading(const CanFrame & cf) : DesiredHeading(static_cast<CanId>(cf.can_id))
{
int16_t raw_heading;
uint32_t raw_heading;

std::memcpy(&raw_heading, cf.data + BYTE_OFF_HEADING, sizeof(int16_t));
std::memcpy(&raw_heading, cf.data + BYTE_OFF_HEADING, sizeof(uint32_t));

heading_ = static_cast<float>();
heading_ = static_cast<float>(raw_heading) / 1000; //NOLINT(readability-magic-numbers)

checkBounds();
}

SailCmd::SailCmd(msg::SailCmd ros_sail_cmd, CanId id)
: BaseFrame(id, CAN_BYTE_DLEN_), angle_(ros_sail_cmd.trim_tab_angle_degrees)
DesiredHeading::DesiredHeading(msg::DesiredHeading ros_desired_heading, CanId id)
: BaseFrame(id, CAN_BYTE_DLEN_), heading_(ros_desired_heading.heading.heading)
{
checkBounds();
}

msg::SailCmd SailCmd::toRosMsg() const
msg::DesiredHeading DesiredHeading::toRosMsg() const
{
msg::SailCmd msg;
msg.set__trim_tab_angle_degrees(angle_);
msg::HelperHeading helper_msg;
helper_msg.set__heading(heading_);
msg::DesiredHeading msg;
msg.set__heading(helper_msg);
return msg;
}

CanFrame SailCmd::toLinuxCan() const
CanFrame DesiredHeading::toLinuxCan() const
{
int16_t raw_angle = static_cast<int16_t>(angle_);
uint32_t raw_heading = static_cast<uint32_t>(heading_) * 1000; //NOLINT(readability-magic-numbers)

CanFrame cf = BaseFrame::toLinuxCan();
std::memcpy(cf.data + BYTE_OFF_ANGLE, &raw_angle, sizeof(int16_t));
std::memcpy(cf.data + BYTE_OFF_HEADING, &raw_heading, sizeof(uint32_t));

return cf;
}

std::string SailCmd::debugStr() const
std::string DesiredHeading::debugStr() const
{
std::stringstream ss;
ss << BaseFrame::debugStr() << "\n"
<< "Trim tab angle (degrees): " << angle_;
<< "Desired heading: " << heading_;
return ss.str();
}

// SailCmd public END
// SailCmd private START
// DesiredHeading public END
// DesiredHeading private START

SailCmd::SailCmd(CanId id) : BaseFrame(std::span{SAIL_CMD_IDS}, id, CAN_BYTE_DLEN_) {}
DesiredHeading::DesiredHeading(CanId id) : BaseFrame(std::span{DESIRED_HEADING_IDS}, id, CAN_BYTE_DLEN_) {}

void SailCmd::checkBounds() const
void DesiredHeading::checkBounds() const
{
auto err = utils::isOutOfBounds<float>(angle_, HEADING_LBND, HEADING_UBND);
auto err = utils::isOutOfBounds<float>(heading_, HEADING_LBND, HEADING_UBND);
if (err) {
std::string err_msg = err.value();
throw std::out_of_range("Sail angle is out of bounds!\n" + debugStr() + "\n" + err_msg);
throw std::out_of_range("Desired heading is out of bounds!\n" + debugStr() + "\n" + err_msg);
}
}

// SailCmd private END
// SailCmd END
// DesiredHeading private END
// DesiredHeading END

// RudderData START
// RudderData public START

RudderData::RudderData(const CanFrame & cf) : RudderData(static_cast<CanId>(cf.can_id))
{
uint32_t raw_heading;

std::memcpy(&raw_heading, cf.data + BYTE_OFF_HEADING, sizeof(uint32_t));

heading_ = static_cast<float>(raw_heading) / 1000; //NOLINT(readability-magic-numbers)

checkBounds();
}

RudderData::RudderData(msg::HelperHeading ros_rudder_data, CanId id)
: BaseFrame(id, CAN_BYTE_DLEN_), heading_(ros_rudder_data.heading)
{
checkBounds();
}

msg::HelperHeading RudderData::toRosMsg() const
{
msg::HelperHeading msg;
msg.set__heading(heading_);
return msg;
}

CanFrame RudderData::toLinuxCan() const
{
uint32_t raw_heading = static_cast<uint32_t>(heading_) * 1000; //NOLINT(readability-magic-numbers)

CanFrame cf = BaseFrame::toLinuxCan();
std::memcpy(cf.data + BYTE_OFF_HEADING, &raw_heading, sizeof(uint32_t));

return cf;
}

std::string RudderData::debugStr() const
{
std::stringstream ss;
ss << BaseFrame::debugStr() << "\n"
<< "Rudder heading: " << heading_;
return ss.str();
}

// DesiredHeading public END
// DesiredHeading private START

RudderData::RudderData(CanId id) : BaseFrame(std::span{RUDDER_DATA_IDS}, id, CAN_BYTE_DLEN_) {}

void RudderData::checkBounds() const
{
auto err = utils::isOutOfBounds<float>(heading_, HEADING_LBND, HEADING_UBND);
if (err) {
std::string err_msg = err.value();
throw std::out_of_range("Rudder heading is out of bounds!\n" + debugStr() + "\n" + err_msg);
}

// DesiredHeading private END
// DesiredHeading END
}
} // namespace CAN_FP
Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@ class TestCanFrameParser : public ::testing::Test
};

/**
* @brief Test ROS<->CAN Battery translations work as expected for valid input values
*
* @brief Test ROS<->CAN Battery translations work as expected for valid input values.
* Treat both batteries as one combined battery.
*/
TEST_F(TestCanFrameParser, BatteryTestValid)
{
@@ -43,11 +43,7 @@ TEST_F(TestCanFrameParser, BatteryTestValid)
constexpr std::array<int16_t, NUM_BATTERIES> expected_raw_expected_currs{250, -100};

for (size_t i = 0; i < NUM_BATTERIES; i++) {
auto optId = CAN_FP::Battery::rosIdxToCanId(i);

ASSERT_TRUE(optId.has_value());

CAN_FP::CanId id = optId.value();
CAN_FP::CanId id = CAN_FP::CanId::BMS_DATA_FRAME;
float expected_volt = expected_volts[i];
float expected_curr = expected_currs[i];
msg::HelperBattery msg;
@@ -84,9 +80,6 @@ TEST_F(TestCanFrameParser, BatteryTestValid)
*/
TEST_F(TestCanFrameParser, TestBatteryInvalid)
{
auto optId = CAN_FP::Battery::rosIdxToCanId(NUM_BATTERIES);
EXPECT_FALSE(optId.has_value());

CAN_FP::CanId invalid_id = CAN_FP::CanId::RESERVED;

CAN_FP::CanFrame cf{.can_id = static_cast<canid_t>(invalid_id)};
@@ -96,10 +89,7 @@ TEST_F(TestCanFrameParser, TestBatteryInvalid)
std::vector<float> invalid_volts{BATT_VOLT_LBND - 1, BATT_VOLT_UBND + 1};
std::vector<float> invalid_currs{BATT_CURR_LBND - 1, BATT_CURR_UBND + 1};

optId = CAN_FP::Battery::rosIdxToCanId(0);
ASSERT_TRUE(optId.has_value());

CAN_FP::CanId valid_id = optId.value();
CAN_FP::CanId valid_id = CAN_FP::CanId::BMS_DATA_FRAME;
msg::HelperBattery msg;

// Set a valid current for this portion
@@ -118,7 +108,7 @@ TEST_F(TestCanFrameParser, TestBatteryInvalid)
EXPECT_THROW(CAN_FP::Battery tmp(msg, valid_id), std::out_of_range);
};

cf.can_id = static_cast<canid_t>(CAN_FP::CanId::BMS_P_DATA_FRAME_1);
cf.can_id = static_cast<canid_t>(CAN_FP::CanId::BMS_DATA_FRAME);
std::copy(std::begin(GARBAGE_DATA), std::end(GARBAGE_DATA), cf.data);

EXPECT_THROW(CAN_FP::Battery tmp(cf), std::out_of_range);
@@ -130,13 +120,12 @@ TEST_F(TestCanFrameParser, TestBatteryInvalid)
*/
TEST_F(TestCanFrameParser, SailCmdTestValid)
{
constexpr std::uint8_t NUM_SAILS = CAN_FP::SailCmd::SAIL_CMD_IDS.size();
constexpr std::array<float, NUM_SAILS> expected_angles{12, 128};
constexpr std::array<float, 2> expected_angles{12, 128};
CAN_FP::CanId id = CAN_FP::SailCmd::SAIL_CMD_IDS[0];

for (size_t i = 0; i < NUM_SAILS; i++) {
CAN_FP::CanId id = CAN_FP::SailCmd::SAIL_CMD_IDS[i];
float expected_angle = expected_angles[i];
msg::SailCmd msg;
for (size_t i = 0; i < 2; i++) {
float expected_angle = expected_angles[i];
msg::SailCmd msg;
msg.set__trim_tab_angle_degrees(expected_angle);
CAN_FP::SailCmd sail_from_ros = CAN_FP::SailCmd(msg, id);
CAN_FP::CanFrame cf = sail_from_ros.toLinuxCan();
@@ -173,7 +162,7 @@ TEST_F(TestCanFrameParser, TestSailCmdInvalid)

std::vector<float> invalid_angles{HEADING_LBND - 1, HEADING_UBND + 1};

CAN_FP::CanId valid_id = CAN_FP::CanId::SAIL_WSM_CMD_FRAME_1;
CAN_FP::CanId valid_id = CAN_FP::CanId::MAIN_TR_TAB;
msg::SailCmd msg;

for (float invalid_angle : invalid_angles) {
@@ -182,7 +171,7 @@ TEST_F(TestCanFrameParser, TestSailCmdInvalid)
EXPECT_THROW(CAN_FP::SailCmd tmp(msg, valid_id), std::out_of_range);
};

cf.can_id = static_cast<canid_t>(CAN_FP::CanId::SAIL_WSM_CMD_FRAME_1);
cf.can_id = static_cast<canid_t>(CAN_FP::CanId::MAIN_TR_TAB);
std::copy(std::begin(GARBAGE_DATA), std::end(GARBAGE_DATA), cf.data);

EXPECT_THROW(CAN_FP::SailCmd tmp(cf), std::out_of_range);
@@ -299,7 +288,7 @@ TEST_F(TestCanFrameParser, GPSTestValid)
constexpr std::array<int32_t, 4> expected_raw_headings{100400, 43200};

for (size_t i = 0; i < 2; i++) {
CAN_FP::CanId id = CAN_FP::CanId::PATH_GPS_DATA_FRAME_1;
CAN_FP::CanId id = CAN_FP::CanId::PATH_GPS_DATA_FRAME;
float expected_lat = expected_lats[i];
float expected_lon = expected_lons[i];
float expected_speed = expected_speeds[i];
@@ -369,7 +358,7 @@ TEST_F(TestCanFrameParser, TestGPSInvalid)
std::vector<float> invalid_speeds{SPEED_LBND - 1, SPEED_UBND + 1};
std::vector<float> invalid_headings{HEADING_LBND - 1, HEADING_UBND + 1};

CAN_FP::CanId valid_id = CAN_FP::CanId::PATH_GPS_DATA_FRAME_1;
CAN_FP::CanId valid_id = CAN_FP::CanId::PATH_GPS_DATA_FRAME;
msg::GPS msg;

// Set a valid speed for this portion
@@ -473,11 +462,11 @@ TEST_F(TestCanTransceiver, TestNewDataValid)
is_cb_called = true;
};
canbus_t_->registerCanCbs({{
std::make_pair(CAN_FP::CanId::BMS_P_DATA_FRAME_1, test_cb),
std::make_pair(CAN_FP::CanId::BMS_DATA_FRAME, test_cb),
}});

// just need a valid and matching ID for this test
CAN_FP::CanFrame dummy_frame{.can_id = static_cast<canid_t>(CAN_FP::CanId::BMS_P_DATA_FRAME_1)};
CAN_FP::CanFrame dummy_frame{.can_id = static_cast<canid_t>(CAN_FP::CanId::BMS_DATA_FRAME)};

canbus_t_->send(dummy_frame);

@@ -498,7 +487,7 @@ TEST_F(TestCanTransceiver, TestNewDataIgnore)
is_cb_called = true;
};
canbus_t_->registerCanCbs({{
std::make_pair(CAN_FP::CanId::BMS_P_DATA_FRAME_1, test_cb),
std::make_pair(CAN_FP::CanId::BMS_DATA_FRAME, test_cb),
}});

// just need a valid and ignored ID for this test