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: Remove need to specify vehicle type param #88

Merged
merged 8 commits into from
Sep 13, 2021

Conversation

icolwell-as
Copy link
Member

Resolves #85 by adding pub/sub groups specific to each PACMod module. They are simply initialized if CAN reports are sent from the PACMod module, otherwise they are not initialized. This removes the need to specify which vehicle platform you are using, since the driver will conform automatically.

There is probably some better way to code this using templates, but this works for now. Further simplification can be explored later.

Tested today with Lexus.

void PACMod3Node::initializeBrakeMotorRptApi()
{
can_pubs_[BrakeMotorRpt1Msg::CAN_ID] =
this->create_publisher<pacmod_msgs::msg::MotorRpt1>("parsed_tx/brake_rpt_detail_1", 20);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Jilin on the other pull request, consider adding 'using namespace pacmod_msgs::msg' in this file and then not having to repeat pacmod_msgs::msg here and in all other similar locations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See discussion in other PR.

initializeVehicle4SpecificApi();
break;
}
}
Copy link

@shan-as shan-as Sep 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a default to catch any mismatching CAN_ID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no functional need, as the callback_can_tx function will just skip/drop the CAN_ID that doesn't have a matching publisher. I don't want to add a ROS_WARN or anything either in case the customer is using a newer DBC or something, which could possibly result in constant ROS_WARN spam for CAN messages the driver doesn't support yet.

dvangeyn-as
dvangeyn-as previously approved these changes Sep 13, 2021
@@ -80,6 +80,26 @@ class PACMod3Node final
LNI::CallbackReturn on_error(const lc::State & state) override;

private:
void initializeBrakeMotorRptApi();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~PACMod3Node();
the destructor should be virtual.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See pacmod3_node.cpp, there is an explicit destructor since a thread needs to be joined.

@icolwell-as icolwell-as merged commit a8eebcf into ros2_master Sep 13, 2021
@icolwell-as icolwell-as deleted the 85_remove_vehicle_type_param branch September 13, 2021 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants