Skip to content

Commit

Permalink
Merge pull request #14 from trainman419/fix_frame_id
Browse files Browse the repository at this point in the history
Use configured frame IDs
  • Loading branch information
mikeferguson committed Jun 11, 2014
2 parents 82c8ea1 + 9308c2f commit 5bb48b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/graft_ukf_absolute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ nav_msgs::Odometry odom_;
bool publish_tf_;
boost::shared_ptr<tf::TransformBroadcaster> broadcaster_;

std::string parent_frame_id_;
std::string child_frame_id_;

void publishTF(const nav_msgs::Odometry& msg){
geometry_msgs::TransformStamped tf;
tf.header.stamp = msg.header.stamp;
Expand All @@ -76,8 +79,8 @@ void timer_callback(const ros::TimerEvent& event){

// Update Odometry
odom_.header.stamp = ros::Time::now();
odom_.header.frame_id = "map";
odom_.child_frame_id = "base_link";
odom_.header.frame_id = parent_frame_id_;
odom_.child_frame_id = child_frame_id_;
odom_.pose.pose = state.pose;
odom_.twist.twist = state.twist;
odom_pub.publish(odom_);
Expand All @@ -102,6 +105,9 @@ int main(int argc, char **argv)

publish_tf_ = manager.getPublishTF();

parent_frame_id_ = manager.getParentFrameID();
child_frame_id_ = manager.getChildFrameID();

// Set up the E
std::vector<double> initial_covariance = manager.getInitialCovariance();
std::vector<double> Q = manager.getProcessNoise();
Expand Down Expand Up @@ -136,4 +142,4 @@ int main(int argc, char **argv)

// Spin
ros::spin();
}
}
12 changes: 9 additions & 3 deletions src/graft_ukf_attitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ nav_msgs::Odometry odom_;
bool publish_tf_;
boost::shared_ptr<tf::TransformBroadcaster> broadcaster_;

std::string parent_frame_id_;
std::string child_frame_id_;

void publishTF(const nav_msgs::Odometry& msg){
geometry_msgs::TransformStamped tf;
tf.header.stamp = msg.header.stamp;
Expand All @@ -75,8 +78,8 @@ void timer_callback(const ros::TimerEvent& event){
state_pub.publish(state);

odom_.header.stamp = ros::Time::now();
odom_.header.frame_id = "odom_fused_ukfv";
odom_.child_frame_id = "base_link";
odom_.header.frame_id = parent_frame_id_;
odom_.child_frame_id = child_frame_id_;
odom_.pose.pose.orientation = state.pose.orientation;
odom_.twist.twist.angular = state.twist.angular;

Expand All @@ -102,6 +105,9 @@ int main(int argc, char **argv)

publish_tf_ = manager.getPublishTF();

parent_frame_id_ = manager.getParentFrameID();
child_frame_id_ = manager.getChildFrameID();

// Set up the E
std::vector<double> initial_covariance = manager.getInitialCovariance();
std::vector<double> Q = manager.getProcessNoise();
Expand Down Expand Up @@ -136,4 +142,4 @@ int main(int argc, char **argv)

// Spin
ros::spin();
}
}
12 changes: 9 additions & 3 deletions src/graft_ukf_velocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ nav_msgs::Odometry odom_;
bool publish_tf_;
boost::shared_ptr<tf::TransformBroadcaster> broadcaster_;

std::string parent_frame_id_;
std::string child_frame_id_;

void publishTF(const nav_msgs::Odometry& msg){
geometry_msgs::TransformStamped tf;
tf.header.stamp = msg.header.stamp;
Expand All @@ -75,8 +78,8 @@ void timer_callback(const ros::TimerEvent& event){
state_pub.publish(state);

odom_.header.stamp = ros::Time::now();
odom_.header.frame_id = "odom_fused_ukfv";
odom_.child_frame_id = "base_link";
odom_.header.frame_id = parent_frame_id_;
odom_.child_frame_id = child_frame_id_;
odom_.twist.twist.linear.x = state.twist.linear.x;
odom_.twist.twist.linear.y = state.twist.linear.y;
odom_.twist.twist.angular.z = state.twist.angular.z;
Expand Down Expand Up @@ -123,6 +126,9 @@ int main(int argc, char **argv)

publish_tf_ = manager.getPublishTF();

parent_frame_id_ = manager.getParentFrameID();
child_frame_id_ = manager.getChildFrameID();

// Set up the E
std::vector<double> initial_covariance = manager.getInitialCovariance();
std::vector<double> Q = manager.getProcessNoise();
Expand Down Expand Up @@ -157,4 +163,4 @@ int main(int argc, char **argv)

// Spin
ros::spin();
}
}

0 comments on commit 5bb48b2

Please sign in to comment.