From 0c7d464eb1f12d4fe7f2ca512ac6f6fe6b26ea59 Mon Sep 17 00:00:00 2001 From: "thvhauwe riderots Ubuntu 16.04 Final PC" Date: Tue, 27 Apr 2021 16:08:25 +0200 Subject: [PATCH 1/2] remove tf_prefix from urdf_visualizer.h; legacy function call from tf1 --- robots/xpp_hyq/rviz/xpp_hyq.rviz | 10 +++++----- robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc | 3 +-- robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc | 3 +-- robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc | 3 +-- .../xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc | 2 +- xpp_examples/rviz/xpp_monoped.rviz | 2 +- xpp_vis/include/xpp_vis/urdf_visualizer.h | 6 +----- xpp_vis/src/urdf_visualizer.cc | 10 ++++------ 8 files changed, 15 insertions(+), 24 deletions(-) diff --git a/robots/xpp_hyq/rviz/xpp_hyq.rviz b/robots/xpp_hyq/rviz/xpp_hyq.rviz index 27ec58b..89fd8d3 100644 --- a/robots/xpp_hyq/rviz/xpp_hyq.rviz +++ b/robots/xpp_hyq/rviz/xpp_hyq.rviz @@ -101,9 +101,9 @@ Visualization Manager: Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order - Name: Monoped + Name: Monoped [thvhauwe] Robot Description: /monoped_rviz_urdf_robot_description - TF Prefix: monoped + TF Prefix: Update Interval: 0 Value: false Visual Enabled: true @@ -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 @@ -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 @@ -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 diff --git a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc index 716ad43..803b46b 100644 --- a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc +++ b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq1.cc @@ -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(); diff --git a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc index 8f0b4c4..0e7abb0 100644 --- a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc +++ b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq2.cc @@ -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(); diff --git a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc index 5a3d641..317f7b8 100644 --- a/robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc +++ b/robots/xpp_hyq/src/exe/urdf_visualizer_hyq4.cc @@ -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(); diff --git a/robots/xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc b/robots/xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc index f64a644..d9c00ae 100644 --- a/robots/xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc +++ b/robots/xpp_quadrotor/src/exe/urdf_visualizer_quadrotor.cc @@ -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(); diff --git a/xpp_examples/rviz/xpp_monoped.rviz b/xpp_examples/rviz/xpp_monoped.rviz index 4fa4d78..368efbb 100644 --- a/xpp_examples/rviz/xpp_monoped.rviz +++ b/xpp_examples/rviz/xpp_monoped.rviz @@ -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 diff --git a/xpp_vis/include/xpp_vis/urdf_visualizer.h b/xpp_vis/include/xpp_vis/urdf_visualizer.h index da09a37..18f5240 100644 --- a/xpp_vis/include/xpp_vis/urdf_visualizer.h +++ b/xpp_vis/include/xpp_vis/urdf_visualizer.h @@ -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& 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: @@ -99,7 +96,6 @@ class UrdfVisualizer { std::string state_msg_name_; std::string rviz_fixed_frame_; - std::string tf_prefix_; }; } // namespace xpp diff --git a/xpp_vis/src/urdf_visualizer.cc b/xpp_vis/src/urdf_visualizer.cc index 62f6a8c..08891d6 100644 --- a/xpp_vis/src/urdf_visualizer.cc +++ b/xpp_vis/src/urdf_visualizer.cc @@ -35,13 +35,11 @@ UrdfVisualizer::UrdfVisualizer(const std::string& urdf_name, const std::vector& 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); @@ -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 @@ -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; From 0fb10b06c78b88e6840554f91492cd41c6fe0bbf Mon Sep 17 00:00:00 2001 From: "thvhauwe riderots Ubuntu 16.04 Final PC" Date: Tue, 27 Apr 2021 16:26:30 +0200 Subject: [PATCH 2/2] correction --- robots/xpp_hyq/rviz/xpp_hyq.rviz | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robots/xpp_hyq/rviz/xpp_hyq.rviz b/robots/xpp_hyq/rviz/xpp_hyq.rviz index 89fd8d3..025082e 100644 --- a/robots/xpp_hyq/rviz/xpp_hyq.rviz +++ b/robots/xpp_hyq/rviz/xpp_hyq.rviz @@ -101,7 +101,7 @@ Visualization Manager: Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order - Name: Monoped [thvhauwe] + Name: Monoped Robot Description: /monoped_rviz_urdf_robot_description TF Prefix: Update Interval: 0