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

ROS2: Add parameter for PACMod DBC version #87

Merged
merged 2 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ commands:
source /opt/ros/*/setup.bash
cd ..
colcon test --packages-select $CIRCLE_PROJECT_REPONAME
colcon test-result
colcon test-result --verbose

jobs:
foxy:
Expand Down
1 change: 1 addition & 0 deletions include/pacmod3/pacmod3_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class PACMod3Node final

VehicleType vehicle_type_;
std::string frame_id_;
unsigned int dbc_major_version_;
jilinzhouas marked this conversation as resolved.
Show resolved Hide resolved
Pacmod3TxRosMsgHandler tx_handler_;
std::map<unsigned int, std::tuple<bool, bool, bool>> system_statuses;

Expand Down
13 changes: 11 additions & 2 deletions src/pacmod3_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ PACMod3Node::PACMod3Node(rclcpp::NodeOptions options)
{
std::string vehicle_type_string = this->declare_parameter("vehicle_type", "POLARIS_GEM");
frame_id_ = this->declare_parameter("frame_id", "pacmod");
dbc_major_version_ = this->declare_parameter("dbc_major_version", 3);

if (vehicle_type_string == "INTERNATIONAL_PROSTAR_122") {
vehicle_type_ = VehicleType::INTERNATIONAL_PROSTAR_122;
Expand All @@ -70,8 +71,16 @@ PACMod3Node::PACMod3Node(rclcpp::NodeOptions options)
"An invalid vehicle type was entered. Defaulting to POLARIS_GEM.");
}

RCLCPP_INFO(this->get_logger(), "Got vehicle type: %s", vehicle_type_string.c_str());
RCLCPP_INFO(this->get_logger(), "Got frame id: %s", frame_id_.c_str());
RCLCPP_INFO(this->get_logger(), "vehicle_type: %s", vehicle_type_string.c_str());
RCLCPP_INFO(this->get_logger(), "frame_id: %s", frame_id_.c_str());
RCLCPP_INFO(this->get_logger(), "dbc_major_version: %d", dbc_major_version_);

if (dbc_major_version_ != 3) {
RCLCPP_ERROR(
this->get_logger(),
"This driver currently only supports PACMod DBC version 3");
rclcpp::shutdown();
}
}

PACMod3Node::~PACMod3Node()
Expand Down