当前位置: 首页>>代码示例>>Python>>正文


Python Odometry.pose方法代码示例

本文整理汇总了Python中nav_msgs.msg.Odometry.pose方法的典型用法代码示例。如果您正苦于以下问题:Python Odometry.pose方法的具体用法?Python Odometry.pose怎么用?Python Odometry.pose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nav_msgs.msg.Odometry的用法示例。


在下文中一共展示了Odometry.pose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: publish_odometry

# 需要导入模块: from nav_msgs.msg import Odometry [as 别名]
# 或者: from nav_msgs.msg.Odometry import pose [as 别名]
    def publish_odometry(self, odom_combined):
        """
            use current pose, along with delta from last pose to publish 
            the current Odometry on the /odom topic
        """

        if not self.last_time:
            # set up initial times and pose
            rospy.loginfo("Setting up initial position")
            self.last_time, self.last_x, y, self.last_theta = self.current_pose(odom_combined)
            return

        # publish to the /odom topic
        odom = Odometry()
        odom.header.stamp = rospy.Time.now()
        odom.header.frame_id = "/base_link"
        odom.pose = odom_combined.pose

        current_time, x, y, theta = self.current_pose(odom_combined)
        dt = current_time - self.last_time
        dt = dt.to_sec()
        d_x = x - self.last_x
        d_theta = theta - self.last_theta
        odom.twist.twist = Twist(Vector3(d_x/dt, 0, 0), Vector3(0, 0, d_theta/dt))

        self.odom_publisher.publish(odom)

        self.last_time, self.last_x, self.last_theta = current_time, x, theta
开发者ID:billmania,项目名称:nomad,代码行数:30,代码来源:odom_publisher.py

示例2: pub_ekf_odom

# 需要导入模块: from nav_msgs.msg import Odometry [as 别名]
# 或者: from nav_msgs.msg.Odometry import pose [as 别名]
 def pub_ekf_odom(self, msg):
     odom = Odometry()
     odom.header = msg.header
     odom.child_frame_id = 'base_footprint'
     odom.pose = msg.pose
     
     self.ekf_pub.publish(odom)
开发者ID:cambyse,项目名称:robot_ping,代码行数:9,代码来源:odom_ekf.py

示例3: __update_odometry

# 需要导入模块: from nav_msgs.msg import Odometry [as 别名]
# 或者: from nav_msgs.msg.Odometry import pose [as 别名]
	def __update_odometry(self, linear_offset, angular_offset, tf_delay):
		self.__heading = (self.__heading + angular_offset) % 360
		
		q = tf.transformations.quaternion_from_euler(0, 0, math.radians(self.__heading))
		self.__pose.position.x += math.cos(math.radians(self.__heading)) * self.__distance_per_cycle * self.__twist.linear.x
		self.__pose.position.y += math.sin(math.radians(self.__heading)) * self.__distance_per_cycle * self.__twist.linear.x
		self.__pose.position.z = 0.33
		self.__pose.orientation = Quaternion(q[0], q[1], q[2], q[3])

		now = rospy.Time.now() + rospy.Duration(tf_delay)

		self.__tfb.sendTransform(
			(self.__pose.position.x, self.__pose.position.y, self.__pose.position.z),
			q,
			now,
			'base_link',
			'odom')

		o = Odometry()
		o.header.stamp = now
		o.header.frame_id = 'odom'
		o.child_frame_id = 'base_link'
		o.pose = PoseWithCovariance(self.__pose, None)

		o.twist = TwistWithCovariance()
		o.twist.twist.linear.x = self.__distance_per_second * self.__twist.linear.x
		o.twist.twist.angular.z = math.radians(self.__rotation_per_second) * self.__twist.angular.z
开发者ID:Knifa,项目名称:HexapodKit,代码行数:29,代码来源:walk_controller.py

示例4: callback

# 需要导入模块: from nav_msgs.msg import Odometry [as 别名]
# 或者: from nav_msgs.msg.Odometry import pose [as 别名]
def callback(data):
    print data
    odom = Odometry()
    odom.pose = data.pose
    odom.header.stamp = rospy.Time.now()
    odom.header.frame_id = "/odom"
    global pub
    pub.publish(odom)
开发者ID:clubcapra,项目名称:Ibex,代码行数:10,代码来源:bbb.py

示例5: callback

# 需要导入模块: from nav_msgs.msg import Odometry [as 别名]
# 或者: from nav_msgs.msg.Odometry import pose [as 别名]
def callback(data):
    odom = Odometry()
    odom.header = data.header
    odom.child_frame_id = child_frame_id
    odom.pose = data.pose
    pub.publish(odom)
开发者ID:introlab,项目名称:rtabmap_ros,代码行数:8,代码来源:pose_to_odom.py


注:本文中的nav_msgs.msg.Odometry.pose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。