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

remove tf_prefix from urdf_visualizer.h; legacy function call from tf1 #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions robots/xpp_hyq/rviz/xpp_hyq.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Visualization Manager:
Link Tree Style: Links in Alphabetic Order
Name: Monoped
Robot Description: /monoped_rviz_urdf_robot_description
TF Prefix: monoped
TF Prefix:
Update Interval: 0
Value: false
Visual Enabled: true
Expand All @@ -119,7 +119,7 @@ Visualization Manager:
Link Tree Style: Links in Alphabetic Order
Name: Biped
Robot Description: /biped_rviz_urdf_robot_description
TF Prefix: biped
TF Prefix:
Update Interval: 0
Value: false
Visual Enabled: true
Expand Down Expand Up @@ -221,7 +221,7 @@ Visualization Manager:
Value: true
Name: Hyq
Robot Description: /hyq_rviz_urdf_robot_description
TF Prefix: hyq_des
TF Prefix:
Update Interval: 0
Value: true
Visual Enabled: true
Expand All @@ -237,7 +237,7 @@ Visualization Manager:
Link Tree Style: Links in Alphabetic Order
Name: ANYmal (proprietary)
Robot Description: /anymal_rviz_urdf_robot_description
TF Prefix: anymal_des
TF Prefix:
Update Interval: 0
Value: false
Visual Enabled: true
Expand Down
3 changes: 1 addition & 2 deletions robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ int main(int argc, char *argv[])
joint_names.at(KFE) = "kfe_joint";

std::string urdf = "monoped_rviz_urdf_robot_description";
UrdfVisualizer node_des(urdf, joint_names, "base", "world",
joint_desired_mono, "monoped");
UrdfVisualizer node_des(urdf, joint_names, "base", "world", joint_desired_mono);

::ros::spin();

Expand Down
3 changes: 1 addition & 2 deletions robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ int main(int argc, char *argv[])
joint_names.at(n_j*R + KFE) = "R_kfe_joint";

std::string urdf = "biped_rviz_urdf_robot_description";
UrdfVisualizer node(urdf, joint_names, "base", "world",
joint_desired_biped, "biped");
UrdfVisualizer node(urdf, joint_names, "base", "world", joint_desired_biped);

::ros::spin();

Expand Down
3 changes: 1 addition & 2 deletions robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ int main(int argc, char *argv[])
joint_names.at(n_j*RH + KFE) = "rh_kfe_joint";

std::string urdf = "hyq_rviz_urdf_robot_description";
UrdfVisualizer hyq_desired(urdf, joint_names, "base", "world",
joint_desired_hyq, "hyq_des");
UrdfVisualizer hyq_desired(urdf, joint_names, "base", "world", joint_desired_hyq);

::ros::spin();

Expand Down
2 changes: 1 addition & 1 deletion robots/xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main(int argc, char *argv[])

// publish base state to RVIZ
std::string urdf = "quadrotor_rviz_urdf_robot_description";
UrdfVisualizer node_des(urdf, {}, "base", "world", joint_quadrotor, "quadrotor");
UrdfVisualizer node_des(urdf, {}, "base", "world", joint_quadrotor);

::ros::spin();

Expand Down
2 changes: 1 addition & 1 deletion xpp_examples/rviz/xpp_monoped.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Visualization Manager:
Value: true
Name: Monoped
Robot Description: /monoped_rviz_urdf_robot_description
TF Prefix: monoped
TF Prefix:
Update Interval: 0
Value: true
Visual Enabled: true
Expand Down
6 changes: 1 addition & 5 deletions xpp_vis/include/xpp_vis/urdf_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,12 @@ class UrdfVisualizer {
* @param rviz_fixed_frame The Fixed Frame name specified in RVIZ.
* @param state_topic The topic of the xpp_msgs::RobotStateJoint ROS message
* to subscribe to.
* @param tf_prefix In case multiple URDFS are loaded, each can be given a
* unique tf_prefix in RIVZ to visualize different states simultaneously.
*/
UrdfVisualizer(const std::string& urdf_name,
const std::vector<URDFName>& joint_names_in_urdf,
const URDFName& base_link_in_urdf,
const std::string& rviz_fixed_frame,
const std::string& state_topic,
const std::string& tf_prefix = "");
const std::string& state_topic);
virtual ~UrdfVisualizer() = default;

private:
Expand All @@ -99,7 +96,6 @@ class UrdfVisualizer {

std::string state_msg_name_;
std::string rviz_fixed_frame_;
std::string tf_prefix_;
};

} // namespace xpp
Expand Down
10 changes: 4 additions & 6 deletions xpp_vis/src/urdf_visualizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ UrdfVisualizer::UrdfVisualizer(const std::string& urdf_name,
const std::vector<URDFName>& joint_names_in_urdf,
const URDFName& base_joint_in_urdf,
const std::string& fixed_frame,
const std::string& state_topic,
const std::string& tf_prefix)
const std::string& state_topic)
{
joint_names_in_urdf_ = joint_names_in_urdf;
base_joint_in_urdf_ = base_joint_in_urdf;
rviz_fixed_frame_ = fixed_frame;
tf_prefix_ = tf_prefix;

::ros::NodeHandle nh;
state_sub_des_ = nh.subscribe(state_topic, 1, &UrdfVisualizer::StateCallback, this);
Expand Down Expand Up @@ -70,8 +68,8 @@ UrdfVisualizer::StateCallback(const xpp_msgs::RobotStateJoint& msg)
auto W_X_B_message = GetBaseFromRos(::ros::Time::now(), msg.base.pose);

tf_broadcaster_.sendTransform(W_X_B_message);
robot_publisher->publishTransforms(joint_positions, ::ros::Time::now(), tf_prefix_);
robot_publisher->publishFixedTransforms(tf_prefix_);
robot_publisher->publishTransforms(joint_positions, ::ros::Time::now());
robot_publisher->publishFixedTransforms();
}

UrdfVisualizer::UrdfnameToJointAngle
Expand All @@ -93,7 +91,7 @@ UrdfVisualizer::GetBaseFromRos(const ::ros::Time& stamp,
geometry_msgs::TransformStamped W_X_B_message;
W_X_B_message.header.stamp = stamp;
W_X_B_message.header.frame_id = rviz_fixed_frame_;
W_X_B_message.child_frame_id = tf_prefix_ + "/" + base_joint_in_urdf_;
W_X_B_message.child_frame_id = "/" + base_joint_in_urdf_;

W_X_B_message.transform.translation.x = msg.position.x;
W_X_B_message.transform.translation.y = msg.position.y;
Expand Down