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

Fix ground truth Tf changing parent frame #81

Merged
merged 1 commit into from
May 3, 2022
Merged
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
7 changes: 6 additions & 1 deletion flatland_plugins/src/diff_drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ void DiffDrive::OnInitialize(const YAML::Node& config) {
enable_twist_pub_ = reader.Get<bool>("enable_twist_pub", true);
std::string body_name = reader.Get<std::string>("body");
std::string odom_frame_id = reader.Get<std::string>("odom_frame_id", "odom");
std::string ground_truth_frame_id =
reader.Get<std::string>("ground_truth_frame_id", odom_frame_id);

std::string twist_topic = reader.Get<std::string>("twist_sub", "cmd_vel");
std::string odom_topic =
Expand Down Expand Up @@ -127,12 +129,15 @@ void DiffDrive::OnInitialize(const YAML::Node& config) {
}

// init the values for the messages
ground_truth_msg_.header.frame_id = odom_frame_id;
ground_truth_msg_.header.frame_id = ground_truth_frame_id;
ground_truth_msg_.child_frame_id =
tf::resolve("", GetModel()->NameSpaceTF(body_->name_));
ground_truth_msg_.twist.covariance.fill(0);
ground_truth_msg_.pose.covariance.fill(0);
// Odometry message initially is similar to ground truth except for the
// parent frame ID
odom_msg_ = ground_truth_msg_;
odom_msg_.header.frame_id = odom_frame_id;

// copy from std::array to boost array
for (unsigned int i = 0; i < 36; i++) {
Expand Down