From 2176f3c73ebd5ac7e82784a6a3ad700d65dc1e7f Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Tue, 22 Jun 2021 15:30:17 +0300 Subject: [PATCH 1/3] Fix gazebo error --- stretch_gazebo/launch/gazebo.launch | 2 +- stretch_gazebo/package.xml | 1 + .../scripts/publish_ground_truth_odom.py | 21 ++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/stretch_gazebo/launch/gazebo.launch b/stretch_gazebo/launch/gazebo.launch index 87530b0..ddf6a02 100644 --- a/stretch_gazebo/launch/gazebo.launch +++ b/stretch_gazebo/launch/gazebo.launch @@ -49,6 +49,6 @@ - + diff --git a/stretch_gazebo/package.xml b/stretch_gazebo/package.xml index c40d3b8..a7de4be 100644 --- a/stretch_gazebo/package.xml +++ b/stretch_gazebo/package.xml @@ -24,6 +24,7 @@ rospy rviz std_msgs + teleop_twist_joy xacro diff --git a/stretch_gazebo/scripts/publish_ground_truth_odom.py b/stretch_gazebo/scripts/publish_ground_truth_odom.py index 43bfd4a..549e6b3 100755 --- a/stretch_gazebo/scripts/publish_ground_truth_odom.py +++ b/stretch_gazebo/scripts/publish_ground_truth_odom.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -from gazebo_msgs.srv import GetModelState, GetModelStateRequest +from gazebo_msgs.srv import GetModelState, GetModelStateRequest, GetWorldProperties from nav_msgs.msg import Odometry from std_msgs.msg import Header import rospy @@ -10,20 +10,25 @@ odom_pub=rospy.Publisher('ground_truth', Odometry, queue_size=10) rospy.wait_for_service ('/gazebo/get_model_state') get_model_srv = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState) +get_world_properties = rospy.ServiceProxy('/gazebo/get_world_properties', GetWorldProperties) odom=Odometry() header = Header() header.frame_id='/ground_truth' model = GetModelStateRequest() model.model_name='robot' - +models = [] r = rospy.Rate(20) while not rospy.is_shutdown(): - result = get_model_srv(model) - odom.pose.pose = result.pose - odom.twist.twist = result.twist - header.stamp = rospy.Time.now() - odom.header = header - odom_pub.publish(odom) + if model.model_name not in models: + models = get_world_properties().model_names + rospy.logwarn("Waiting for %s to spawn to publish ground truth odometry", model.model_name) + else: + result = get_model_srv(model) + odom.pose.pose = result.pose + odom.twist.twist = result.twist + header.stamp = rospy.Time.now() + odom.header = header + odom_pub.publish(odom) r.sleep() From 878fc72d8263490a0752c4b541bd4cf5b2d568f7 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Tue, 22 Jun 2021 15:41:37 +0300 Subject: [PATCH 2/3] Fix dependencies --- stretch_gazebo/package.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stretch_gazebo/package.xml b/stretch_gazebo/package.xml index a7de4be..1debea1 100644 --- a/stretch_gazebo/package.xml +++ b/stretch_gazebo/package.xml @@ -15,12 +15,14 @@ controller_manager gazebo_msgs gazebo_plugins + gazebo_ros_control gazebo_ros nav_msgs realsense_gazebo_plugin realsense2_camera realsense2_description robot_state_publisher + ros_controllers rospy rviz std_msgs From 0370468fc1e9f0110c2232804ee95463d1e7bcf2 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Wed, 23 Jun 2021 01:58:33 +0300 Subject: [PATCH 3/3] Update package.xml --- stretch_moveit_config/package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/stretch_moveit_config/package.xml b/stretch_moveit_config/package.xml index 6e3e179..99abf10 100644 --- a/stretch_moveit_config/package.xml +++ b/stretch_moveit_config/package.xml @@ -24,6 +24,7 @@ moveit_ros_move_group moveit_ros_visualization moveit_setup_assistant + moveit_simple_controller_manager robot_state_publisher stretch_description tf2_ros