Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Andrew Ealovega <[email protected]>
  • Loading branch information
andyblarblar and ahcorde committed Jul 8, 2022
1 parent 66338f9 commit 8be4744
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ build_*

.ycm_extra_conf.py
*.orig

# clangd index
.cache
19 changes: 15 additions & 4 deletions src/systems/ackermann_steering/AckermannSteering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,21 @@ void AckermannSteering::Configure(const Entity &_entity,
this->dataPtr->odomPub = this->dataPtr->node.Advertise<msgs::Odometry>(
odomTopic);

std::string tfTopic{"/model/" + this->dataPtr->model.Name(_ecm) +
"/tf"};
if (_sdf->HasElement("tf_topic"))
tfTopic = _sdf->Get<std::string>("tf_topic");
std::vector<std::string> tfTopics;
if (_sdf->HasElement("tf_topic"))
{
tfTopics.push_back(_sdf->Get<std::string>("tf_topic"));
}
tfTopics.push_back("/model/" + this->dataPtr->model.Name(_ecm) +
"/tf");
auto tfTopic = validTopic(tfTopics);
if (tfTopic.empty())
{
ignerr << "AckermannSteering plugin invalid tf topic name "
<< "Failed to initialize." << std::endl;
return;
}

this->dataPtr->tfPub = this->dataPtr->node.Advertise<msgs::Pose_V>(
tfTopic);

Expand Down
4 changes: 2 additions & 2 deletions src/systems/ackermann_steering/AckermannSteering.hh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace systems
///
/// `<tf_topic>`: Custom topic on which this system will publish the
/// transform from `frame_id` to `child_frame_id`. This element is optional,
/// and the default value is `/model/{name_of_model}/tf`.
/// and the default value is `/model/{name_of_model}/tf`.
///
/// `<frame_id>`: Custom `frame_id` field that this system will use as the
/// origin of the odometry transform in both the `<tf_topic>`
Expand All @@ -104,7 +104,7 @@ namespace systems
/// the target of the odometry transform in both the `<tf_topic>`
/// `ignition.msgs.Pose_V` message and the `<odom_topic>`
/// `ignition.msgs.Odometry` message. This element if optional,
/// and the default value is `{name_of_model}/{name_of_link}`.
/// and the default value is `{name_of_model}/{name_of_link}`.
///
/// A robot with rear drive and front steering would have one each
/// of left_joint, right_joint, left_steering_joint and
Expand Down

0 comments on commit 8be4744

Please sign in to comment.