def capture_sample():
""" Captures a PointCloud2 using the sensor stick RGBD camera
Args: None
Returns:
PointCloud2: a single point cloud from the RGBD camrea
"""
get_model_state_prox = rospy.ServiceProxy('gazebo/get_model_state',GetModelState)
model_state = get_model_state_prox('training_model','world')
set_model_state_prox = rospy.ServiceProxy('gazebo/set_model_state', SetModelState)
roll = random.uniform(0, 2*math.pi)
pitch = random.uniform(0, 2*math.pi)
yaw = random.uniform(0, 2*math.pi)
quaternion = tf.transformations.quaternion_from_euler(roll, pitch, yaw)
model_state.pose.orientation.x = quaternion[0]
model_state.pose.orientation.y = quaternion[1]
model_state.pose.orientation.z = quaternion[2]
model_state.pose.orientation.w = quaternion[3]
sms_req = SetModelStateRequest()
sms_req.model_state.pose = model_state.pose
sms_req.model_state.twist = model_state.twist
sms_req.model_state.model_name = 'training_model'
sms_req.model_state.reference_frame = 'world'
set_model_state_prox(sms_req)
return rospy.wait_for_message('/sensor_stick/point_cloud', PointCloud2)
training_helper.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录