本文整理汇总了Python中std_msgs.msg.Header类的典型用法代码示例。如果您正苦于以下问题:Python Header类的具体用法?Python Header怎么用?Python Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Header类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createRandomGrasps
def createRandomGrasps(grasp_pose, num_grasps=1):
""" Returns a list of num_grasps Grasp's around grasp_pose """
list_grasps = []
for grasp_num in range(num_grasps):
my_pre_grasp_approach = createGripperTranslation(Vector3(1.0, 0.0, 0.0)) # rotate over here?
my_post_grasp_retreat = createGripperTranslation(Vector3(0.0, 0.0, 1.0))
header = Header()
header.frame_id = "base_link"
header.stamp = rospy.Time.now()
grasp_pose_copy = copy.deepcopy(grasp_pose)
modified_grasp_pose = PoseStamped(header, grasp_pose_copy)
#modified_grasp_pose.pose.position.x -= random.random() * 0.25 # randomize entrance to grasp in 25cm in x
#modified_grasp_pose.pose.position.y -= random.random() * 0.10 # randomize entrance to grasp in 10cm in y
#modified_grasp_pose.pose.orientation.z = -1.0
grasp = createGrasp(modified_grasp_pose, # change grasp pose?
allowed_touch_objects=["part"],
pre_grasp_posture=getPreGraspPosture(),
grasp_posture=getPreGraspPosture(),
pre_grasp_approach=my_pre_grasp_approach,
post_grasp_retreat=my_post_grasp_retreat,
id_grasp="random_grasp_" + str(grasp_num)
)
list_grasps.append(grasp)
return list_grasps
开发者ID:jon-weisz,项目名称:moveit_grasping_testing,代码行数:25,代码来源:pick_as_moveit.py
示例2: _cloud_cb
def _cloud_cb(self, cloud):
points = np.array(list(read_points(cloud, skip_nans=True)))
if points.shape[0] == 0:
return
# Get 4x4 matrix which transforms point cloud co-ords to odometry frame
try:
points_to_map = self.tf.asMatrix('/odom', cloud.header)
except tf.ExtrapolationException:
return
transformed_points = points_to_map.dot(np.vstack((points.T, np.ones((1, points.shape[0])))))
transformed_points = transformed_points[:3,:].T
if self.fused is None:
self.fused = transformed_points
else:
self.fused = np.vstack((self.fused, transformed_points))
self.seq += 1
header = Header()
header.seq = self.seq
header.stamp = rospy.Time.now()
header.frame_id = '/odom'
output_cloud = create_cloud(header, cloud.fields, self.fused)
rospy.loginfo('Publishing new cloud')
self.cloud_pub.publish(output_cloud)
开发者ID:sigproc,项目名称:qbo_sigproc,代码行数:29,代码来源:pointcloud_accumulate.py
示例3: fvToMsg
def fvToMsg(fv, now):
global seq
fvMsg = PersonFVMsg()
header = Header()
header.seq = seq
header.stamp = now
header.frame_id = frameID
rhv = Vector3()
rev = Vector3()
lhv = Vector3()
lev = Vector3()
setV3(rhv, fv, 0)
setV3(lhv, fv, 3)
setV3(rev, fv, 6)
setV3(lev, fv, 9)
fvMsg.header = header
fvMsg.rh = rhv
fvMsg.re = rev
fvMsg.lh = lhv
fvMsg.le = lev
fvMsg.distance = fv[12]
return fvMsg
开发者ID:h2r,项目名称:baxter_h2r_dev,代码行数:30,代码来源:parseTFToFV.py
示例4: execute
def execute(self, userdata):
header = Header()
header.frame_id = "base_link"
header.stamp = rospy.Time.now()
userdata.move_it_joint_goal = MoveGroupGoal()
goal_c = Constraints()
for name, value in zip(userdata.manip_joint_names, userdata.manip_goal_joint_pose):
joint_c = JointConstraint()
joint_c.joint_name = name
joint_c.position = value
joint_c.tolerance_above = 0.01
joint_c.tolerance_below = 0.01
joint_c.weight = 1.0
goal_c.joint_constraints.append(joint_c)
userdata.move_it_joint_goal.request.goal_constraints.append(goal_c)
userdata.move_it_joint_goal.request.num_planning_attempts = 5
userdata.move_it_joint_goal.request.allowed_planning_time = 5.0
userdata.move_it_joint_goal.planning_options.plan_only = False # False = Plan + Execute ; True = Plan only
userdata.move_it_joint_goal.planning_options.planning_scene_diff.is_diff = True
userdata.move_it_joint_goal.request.group_name = userdata.manip_joint_group
rospy.loginfo("Group Name: " + userdata.manip_joint_group)
rospy.loginfo("Joints name: " + str(userdata.manip_joint_names))
rospy.loginfo("Joints Values: " + str(userdata.manip_goal_joint_pose))
rospy.loginfo("GOAL TO SEND IS:... " + str(userdata.move_it_joint_goal))
return "succeeded"
开发者ID:karla3jo,项目名称:robocup2014,代码行数:27,代码来源:manip_to_joint_pose.py
示例5: test_AG_remote
def test_AG_remote(self):
self.assertEqual(self.AlarmListener.is_cleared(), True,
msg='current state of kill signal is raised')
# publishing msg to network
pub = rospy.Publisher('/network', Header, queue_size=10)
rate = rospy.Rate(10)
t_end = rospy.Time.now() + rospy.Duration(3)
while rospy.Time.now() < t_end:
hello_header = Header()
hello_header.stamp = rospy.Time.now()
rospy.loginfo(hello_header)
pub.publish(hello_header)
rate.sleep()
self.assertEqual(
self.AlarmListener.is_cleared(),
True,
msg='REMOTE shutdown not worked. State = {}'.format(
self._current_alarm_state))
# stop sending the msg, the remote alarm will raise when stop recieving
# the msg for 8 secs
rospy.sleep(8.2)
self.assertEqual(
self.AlarmListener.is_raised(),
True,
msg='REMOTE raised not worked. State = {}'.format(
self._current_alarm_state))
开发者ID:jnez71,项目名称:Navigator,代码行数:29,代码来源:kill_board_test.py
示例6: HeaderGenerater
def HeaderGenerater(self):
self.seq += 1
header = Header()
header.seq = self.seq
header.stamp = rospy.Time.now()
header.frame_id = self.GoalFrame
return header
开发者ID:DinnerHowe,项目名称:cafe_robot_single,代码行数:7,代码来源:GoalManager.py
示例7: publish_poses_grasps
def publish_poses_grasps(grasps):
rospy.loginfo("Publishing PoseArray on /grasp_pose_from_block_bla for grasp_pose")
grasp_publisher = rospy.Publisher("grasp_pose_from_block_bla", PoseArray)
graspmsg = Grasp()
grasp_PA = PoseArray()
header = Header()
header.frame_id = "base_link"
header.stamp = rospy.Time.now()
grasp_PA.header = header
for graspmsg in grasps:
print graspmsg
print type(graspmsg)
p = Pose(graspmsg.grasp_pose.pose.position, graspmsg.grasp_pose.pose.orientation)
grasp_PA.poses.append(p)
grasp_publisher.publish(grasp_PA)
rospy.loginfo("Press a to continue...")
while True:
choice = raw_input("> ")
if choice == 'a' :
print "Continuing, a pressed"
break
else:
grasp_publisher.publish(grasp_PA)
rospy.sleep(0.1)
开发者ID:jon-weisz,项目名称:moveit_grasping_testing,代码行数:25,代码来源:pick_as_moveit.py
示例8: talker
def talker():
#Initial Pose Set Up
pub_init = rospy.Publisher('initialpose', PoseWithCovarianceStamped)
rospy.init_node('Initial_Pose_Publish')
initial=PoseWithCovarianceStamped()
initial_pose=PoseWithCovariance()
initial_pose.pose=Pose(Point(0.100,0.100,0.100),Quaternion(0.000,0.000,-0.0149,0.999))
initial_pose.covariance=\
[1.0,0.0,0.0,0.0,0.0,0.0,\
0.0,1.0,0.0,0.0,0.0,0.0,\
0.0,0.0,1.0,0.0,0.0,0.0,\
0.0,0.0,0.0,1.0,0.0,0.0,\
0.0,0.0,0.0,0.0,1.0,0.0,\
0.0,0.0,0.0,0.0,0.0,1.0]
initial.pose=initial_pose
initial_info=Header()
initial_info.frame_id="map"
initial_info.stamp=rospy.Time.now()
initial.header=initial_info
pub_init.publish(initial)
r=rospy.Rate(1)
ans=str("y")
#publishing the goal
while not rospy.is_shutdown():
rospy.loginfo("Setting Initial Pose")
pub_init.publish(initial)
ans=raw_input("Enter to continue")
rospy.loginfo("Setting Goal")
开发者ID:knickels,项目名称:OLDNickelsLab,代码行数:30,代码来源:initialPoseWCovariance.py
示例9: __init__
def __init__(self):
#Setup subscriber for combined searched image
frontierMarkerSub = rospy.Subscriber('frontierMarkers',Marker,self.markerCallback,queue_size = 1)
#Get Number of Robots
self.numRobots = rospy.get_param('/num_robots')
#Initialize Goal Publishers
self.goalPub = []
for i in range(0, self.numRobots):
#Setup Subscribers to individual robot searched grids
topicName = 'robot_' + `i` +'/move_base_simple/goal'
self.goalPub.append(rospy.Publisher(topicName,PoseStamped))
#Setup start/stop time publishers
self.startPub = rospy.Publisher('startTime', Header)
self.stopPub = rospy.Publisher('stopTime', Header)
#Get simulation start time
rospy.sleep(0.01) #Without this line, get_rostime always returns 0
self.start_time = rospy.get_rostime()
rospy.loginfo("SIMULATION STARTED AT: %i %i", self.start_time.secs, self.start_time.nsecs)
#Publish Start TIme
startMsg = Header()
startMsg.stamp = self.start_time
startMsg.frame_id = '0'
self.startPub.publish(startMsg)
#Wait for subscribed messages to start arriving
rospy.spin()
开发者ID:bripappas,项目名称:Gen2_Platforms,代码行数:31,代码来源:frontierPlanner.py
示例10: create_move_group_pose_goal
def create_move_group_pose_goal(self, goal_pose=Pose(), group="manipulator", end_link_name=None, plan_only=True):
header = Header()
header.frame_id = 'torso_base_link'
header.stamp = rospy.Time.now()
moveit_goal = MoveGroupGoal()
goal_c = Constraints()
position_c = PositionConstraint()
position_c.header = header
if end_link_name != None:
position_c.link_name = end_link_name
position_c.constraint_region.primitives.append(SolidPrimitive(type=SolidPrimitive.SPHERE, dimensions=[0.01]))
position_c.constraint_region.primitive_poses.append(goal_pose)
position_c.weight = 1.0
goal_c.position_constraints.append(position_c)
orientation_c = OrientationConstraint()
orientation_c.header = header
if end_link_name != None:
orientation_c.link_name = end_link_name
orientation_c.orientation = goal_pose.orientation
orientation_c.absolute_x_axis_tolerance = 0.01
orientation_c.absolute_y_axis_tolerance = 0.01
orientation_c.absolute_z_axis_tolerance = 0.01
orientation_c.weight = 1.0
goal_c.orientation_constraints.append(orientation_c)
moveit_goal.request.goal_constraints.append(goal_c)
moveit_goal.request.num_planning_attempts = 5
moveit_goal.request.allowed_planning_time = 5.0
moveit_goal.planning_options.plan_only = plan_only
moveit_goal.planning_options.planning_scene_diff.is_diff = True # Necessary
moveit_goal.request.group_name = group
return moveit_goal
开发者ID:MorS25,项目名称:dasl-ros-pkg,代码行数:34,代码来源:move_mk2_ik.py
示例11: retreat_move
def retreat_move(self, height, velocity, forced=False):
if forced:
self.is_forced_retreat = True
cart_pos, cart_quat = self.current_ee_pose(self.ee_frame, '/ellipse_frame')
ell_pos, ell_quat = self.ellipsoid.pose_to_ellipsoidal((cart_pos, cart_quat))
#print "Retreat EP:", ell_pos
latitude = ell_pos[0]
if self.trim_retreat:
latitude = min(latitude, TRIM_RETREAT_LATITUDE)
#rospy.loginfo("[face_adls_manager] Retreating from current location.")
retreat_pos = [latitude, ell_pos[1], height]
retreat_pos = self.ellipsoid.enforce_bounds(retreat_pos)
retreat_quat = [0,0,0,1]
if forced:
cart_path = self.ellipsoid.ellipsoidal_to_pose((retreat_pos, retreat_quat))
cart_msg = [PoseConv.to_pose_msg(cart_path)]
else:
ell_path = self.ellipsoid.create_ellipsoidal_path(ell_pos,
ell_quat,
retreat_pos,
retreat_quat,
velocity=0.01,
min_jerk=True)
cart_path = [self.ellipsoid.ellipsoidal_to_pose(ell_pose) for ell_pose in ell_path]
cart_msg = [PoseConv.to_pose_msg(pose) for pose in cart_path]
head = Header()
head.frame_id = '/ellipse_frame'
head.stamp = rospy.Time.now()
pose_array = PoseArray(head, cart_msg)
self.pose_traj_pub.publish(pose_array)
self.is_forced_retreat = False
开发者ID:gt-ros-pkg,项目名称:hrl-assistive,代码行数:34,代码来源:face_adls_manager.py
示例12: get_ros_header
def get_ros_header(self):
header = Header()
header.stamp = rospy.Time.now()
header.seq = self.sequence
# http://www.ros.org/wiki/geometry/CoordinateFrameConventions#Multi_Robot_Support
header.frame_id = self.frame_id
return header
开发者ID:matrixchan,项目名称:morse,代码行数:7,代码来源:abstract_ros.py
示例13: test_4_remote
def test_4_remote(self):
'''
Tests remote kill by publishing hearbeat, stopping and checking alarm is raised, then
publishing hearbeat again to ensure alarm gets cleared.
'''
# publishing msg to network
pub = rospy.Publisher('/network', Header, queue_size=10)
rate = rospy.Rate(10)
t_end = rospy.Time.now() + rospy.Duration(1)
while rospy.Time.now() < t_end:
h = Header()
h.stamp = rospy.Time.now()
pub.publish(h)
rate.sleep()
self.reset_update()
rospy.sleep(8.5) # Wait slighly longer then the timeout on killboard
self.assert_raised()
self.reset_update()
t_end = rospy.Time.now() + rospy.Duration(1)
while rospy.Time.now() < t_end:
h = Header()
h.stamp = rospy.Time.now()
pub.publish(h)
rate.sleep()
self.AlarmBroadcaster.clear_alarm()
self.assert_cleared()
开发者ID:ironmig,项目名称:Navigator,代码行数:28,代码来源:kill_board_test.py
示例14: _cloud_cb
def _cloud_cb(self, cloud):
points = np.array(list(read_points(cloud)))
if points.shape[0] == 0:
return
pos = points[:,0:3]
cor = np.reshape(points[:,-1], (points.shape[0], 1))
# Get 4x4 matrix which transforms point cloud co-ords to odometry frame
try:
points_to_map = self.tf.asMatrix('/lasths', cloud.header)
except tf.ExtrapolationException:
return
transformed_points = points_to_map.dot(np.vstack((pos.T, np.ones((1, pos.shape[0])))))
transformed_points = transformed_points[:3,:].T
self.seq += 1
header = Header()
header.seq = self.seq
header.stamp = rospy.Time.now()
header.frame_id = '/lasths'
self.cloud = np.vstack((self.cloud, np.hstack((transformed_points, cor))))
if self.seq % 30 == 0:
print "plup!"
self.cloud = np.zeros((0, 4))
output_cloud = create_cloud(header, cloud.fields, self.cloud)
self.cloud_pub.publish(output_cloud)
开发者ID:garamizo,项目名称:gaitest,代码行数:30,代码来源:stitcher.py
示例15: make_header
def make_header(frame_id, stamp=None):
if stamp == None:
stamp = rospy.Time.now()
header = Header()
header.stamp = stamp
header.frame_id = frame_id
return header
开发者ID:mikemwang,项目名称:obstacle,代码行数:7,代码来源:utils.py
示例16: create_move_group_joints_goal
def create_move_group_joints_goal(joint_names, joint_values, group="right_arm_torso", plan_only=True):
""" Creates a move_group goal based on pose.
@arg joint_names list of strings of the joint names
@arg joint_values list of digits with the joint values
@arg group string representing the move_group group to use
@arg plan_only bool to for only planning or planning and executing
@return MoveGroupGoal with the desired contents"""
header = Header()
header.frame_id = 'base_link'
header.stamp = rospy.Time.now()
moveit_goal = MoveGroupGoal()
goal_c = Constraints()
for name, value in zip(joint_names, joint_values):
joint_c = JointConstraint()
joint_c.joint_name = name
joint_c.position = value
joint_c.tolerance_above = 0.01
joint_c.tolerance_below = 0.01
joint_c.weight = 1.0
goal_c.joint_constraints.append(joint_c)
moveit_goal.request.goal_constraints.append(goal_c)
moveit_goal.request.num_planning_attempts = 1
moveit_goal.request.allowed_planning_time = 5.0
moveit_goal.planning_options.plan_only = plan_only
moveit_goal.planning_options.planning_scene_diff.is_diff = True
moveit_goal.request.group_name = group
return moveit_goal
开发者ID:Robobench,项目名称:reem_snippets,代码行数:30,代码来源:moveit_joints_goal.py
示例17: poseStampedToLabeledSphereMarker
def poseStampedToLabeledSphereMarker(cls, psdata, label, fmt="{label} %Y-%m-%d %H:%M:%S", zoffset=0.05):
"[poseStamped, meta] -> sphereMarker"
ps, meta = psdata
res = []
h = Header()
h.stamp = rospy.Time.now()
h.frame_id = ps.header.frame_id
sphere = Marker(type=Marker.SPHERE,
action=Marker.ADD,
header=h,
id=cls.marker_id)
sphere.scale.x = 0.07
sphere.scale.y = 0.07
sphere.scale.z = 0.07
sphere.pose = ps.pose
sphere.color = ColorRGBA(1.0,0,0,1.0)
sphere.ns = "db_play"
sphere.lifetime = rospy.Time(3)
cls.marker_id += 1
res.append(sphere)
text = Marker(type=Marker.TEXT_VIEW_FACING,
action=Marker.ADD,
header=h,
id=cls.marker_id)
text.scale.z = 0.1
text.pose = deepcopy(ps.pose)
text.pose.position.z += zoffset
text.color = ColorRGBA(1.0,1.0,1.0,1.0)
text.text = meta["inserted_at"].strftime(fmt).format(label=label)
text.ns = "db_play_text"
text.lifetime = rospy.Time(300)
cls.marker_id += 1
res.append(text)
return res
开发者ID:YoheiKakiuchi,项目名称:jsk_robot,代码行数:35,代码来源:visualization_utils.py
示例18: computeICPBetweenScans
def computeICPBetweenScans(no1,no2, init_x = 0 , init_y = 0, init_yaw = 0):
header = Header()
header.stamp = rospy.Time.now()
header.frame_id = 'ibeo'
example = cython_catkin_example.PyCCExample()
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_'+str(no1)+'.txt')
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_filtered_'+str(no1)+'.txt')
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_direct_'+str(no1)+'.txt')
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_lm_filtered_'+str(no1)+'.txt')
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/onenorth/20150821-114839_sss/scan_filtered_'+str(no1)+'.txt')
if opts.use_accumulated:
test_cloud = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_lm_filtered_'+str(no1)+'.txt'))
if opts.icp_use_filtered_data:
test_cloud = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_filtered_'+str(no1)+'.txt'))
else:
test_cloud = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_'+str(no1)+'.txt'))
H_points = [[p[0], p[1],1] for p in test_cloud]
# H_points = [[np.float32(p[0]), np.float32(p[1]),1] for p in test_cloud]
pc_point_t1 = pc2.create_cloud_xyz32(header, H_points)
# print 'text1: ',len(test_cloud)
# print test_cloud
# example.load_2d_array('ref_map',np.array(test_cloud, np.float32))
# test_cloud2 = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_'+str(no2)+'.txt')
# test_cloud2 = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_filtered_'+str(no2)+'.txt')
# test_cloud = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_direct_'+str(no2)+'.txt')
# test_cloud2 = read2DPointsFromTextFile('/home/avavav/avdata/alphard/medialink/20150918-180619/scan_lm_filtered_'+str(no2)+'.txt')
# test_cloud2 = read2DPointsFromTextFile('/home/avavav/avdata/alphard/onenorth/20150821-114839_sss/scan_filtered_'+str(no2)+'.txt')
if opts.use_accumulated:
test_cloud = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_lm_filtered_'+str(no2)+'.txt'))
if opts.icp_use_filtered_data:
test_cloud2 = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_filtered_'+str(no2)+'.txt'))
else:
test_cloud2 = read2DPointsFromTextFile(os.path.join(dir_prefix,'scan_'+str(no2)+'.txt'))
H_points = [[p[0], p[1],1] for p in test_cloud2]
# H_points = [[np.float32(p[0]), np.float32(p[1]),1] for p in test_cloud]
pc_point_t2 = pc2.create_cloud_xyz32(header, H_points)
# print 'text2: ',len(test_cloud)
# example.load_2d_array('que_map',np.array(test_cloud, np.float32))
# names = example.get_point_xyz_clouds_names()
# print("Current point clouds: " + ",".join(names))
# icp_ros_result = g_processICP_srv(pc_point_t1, pc_point_t2)
# print icp_ros_result
# cython_icp_result = example.processICP(np.array(test_cloud, np.float32),np.array(test_cloud2, np.float32))
cython_icp_result = example.processICP(np.array([x[0] for x in test_cloud], np.float32),np.array([x[1] for x in test_cloud], np.float32),np.array([x[0] for x in test_cloud2], np.float32),np.array([x[1] for x in test_cloud2], np.float32), init_x, init_y, init_yaw)
# print cython_icp_result
return cython_icp_result
开发者ID:vbillys,项目名称:icp_test,代码行数:60,代码来源:process_icp_poses_to_graph.py
示例19: Publish
def Publish(self):
imu_data = self._hal_proxy.GetImu()
imu_msg = Imu()
h = Header()
h.stamp = rospy.Time.now()
h.frame_id = self._frame_id
imu_msg.header = h
imu_msg.orientation_covariance = (-1., )*9
imu_msg.linear_acceleration_covariance = (-1., )*9
imu_msg.angular_velocity_covariance = (-1., )*9
imu_msg.orientation.w = imu_data['orientation']['w']
imu_msg.orientation.x = imu_data['orientation']['x']
imu_msg.orientation.y = imu_data['orientation']['y']
imu_msg.orientation.z = imu_data['orientation']['z']
imu_msg.linear_acceleration.x = imu_data['linear_accel']['x']
imu_msg.linear_acceleration.y = imu_data['linear_accel']['y']
imu_msg.linear_acceleration.z = imu_data['linear_accel']['z']
imu_msg.angular_velocity.x = imu_data['angular_velocity']['x']
imu_msg.angular_velocity.y = imu_data['angular_velocity']['y']
imu_msg.angular_velocity.z = imu_data['angular_velocity']['z']
# Read the x, y, z and heading
self._publisher.publish(imu_msg)
开发者ID:tslator,项目名称:arlobot_rpi,代码行数:28,代码来源:imu_sensor.py
示例20: main
def main():
rospy.init_node("pose2d_to_odometry")
own_num = rospy.get_param('~own_num', 0)
global odom, head
head = Header()
head.stamp = rospy.Time.now()
head.frame_id = "robot_{}/odom_combined".format(own_num)
odom = Odometry()
odom.child_frame_id = "robot_{}/base_footprint".format(own_num)
o = 10**-9 # zero
odom.pose.covariance = [1, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0,
0, 0, o, 0, 0, 0, # z doesn't change
0, 0, 0, o, 0, 0, # constant roll
0, 0, 0, 0, o, 0, # constant pitch
0, 0, 0, 0, 0, o] # guess - .3 radians rotation cov
odom.twist.covariance = [100, 0, 0, 0, 0, 0,
0, 100, 0, 0, 0, 0,
0, 0, 100, 0, 0, 0, # large covariances - no data
0, 0, 0, 100, 0, 0,
0, 0, 0, 0, 100, 0,
0, 0, 0, 0, 0, 100]
global odom_pub
odom_topic = rospy.get_param('~odometry_publish_topic', 'vo')
pose2D_topic = rospy.get_param('~pose2D_topic', 'pose2D')
odom_pub = rospy.Publisher(odom_topic, Odometry)
rospy.Subscriber(pose2D_topic, Pose2D, on_pose)
rospy.spin()
开发者ID:ajayjain,项目名称:husky_pursuit,代码行数:35,代码来源:pose2d_to_odometry.py
注:本文中的std_msgs.msg.Header类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论