Browse Source

Merge pull request #26 from PickNikRobotics/pr-gazebo_deps_and_gt_fix

[melodic] Gazebo Dependency and GetModel Fixes
pull/32/head
Binit Shah 3 years ago
committed by GitHub
parent
commit
63ea6833d4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 9 deletions
  1. +1
    -1
      stretch_gazebo/launch/gazebo.launch
  2. +3
    -0
      stretch_gazebo/package.xml
  3. +13
    -8
      stretch_gazebo/scripts/publish_ground_truth_odom.py
  4. +1
    -0
      stretch_moveit_config/package.xml

+ 1
- 1
stretch_gazebo/launch/gazebo.launch View File

@ -49,6 +49,6 @@
<node name="stretch_controller_spawner" pkg="controller_manager" type="spawner"
args="stretch_joint_state_controller stretch_diff_drive_controller stretch_arm_controller stretch_head_controller stretch_gripper_controller"/>
<node name="publish_ground_truth_odom" pkg="stretch_gazebo" type="publish_ground_truth_odom.py" />
<node name="publish_ground_truth_odom" pkg="stretch_gazebo" type="publish_ground_truth_odom.py" output="screen"/>
</launch>

+ 3
- 0
stretch_gazebo/package.xml View File

@ -15,15 +15,18 @@
<depend>controller_manager</depend>
<depend>gazebo_msgs</depend>
<depend>gazebo_plugins</depend>
<depend>gazebo_ros_control</depend>
<depend>gazebo_ros</depend>
<depend>nav_msgs</depend>
<depend>realsense_gazebo_plugin</depend>
<depend>realsense2_camera</depend>
<depend>realsense2_description</depend>
<depend>robot_state_publisher</depend>
<depend>ros_controllers</depend>
<depend>rospy</depend>
<depend>rviz</depend>
<depend>std_msgs</depend>
<depend>teleop_twist_joy</depend>
<depend>xacro</depend>
</package>

+ 13
- 8
stretch_gazebo/scripts/publish_ground_truth_odom.py View File

@ -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()

+ 1
- 0
stretch_moveit_config/package.xml View File

@ -24,6 +24,7 @@
<run_depend>moveit_ros_move_group</run_depend>
<run_depend>moveit_ros_visualization</run_depend>
<run_depend>moveit_setup_assistant</run_depend>
<run_depend>moveit_simple_controller_manager</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>stretch_description</run_depend>
<run_depend>tf2_ros</run_depend>

Loading…
Cancel
Save