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


Python msg.Header方法代码示例

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


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

示例1: navigation

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def navigation():
    pub = rospy.Publisher('usv_position_setpoint', Odometry, queue_size=10) # only create a rostopic, navigation system TODO
    rospy.init_node('navigation_publisher')
    rate = rospy.Rate(60) # 10h

    x = -20.0
    y = -20.0

    msg = Odometry()
   # msg.header = Header()
    msg.header.stamp = rospy.Time.now()
    msg.header.frame_id = "navigation"
    msg.pose.pose.position = Point(x, y, 0.)
 
    while not rospy.is_shutdown():
            pub.publish(msg)
            rate.sleep() 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:19,代码来源:navigation_pub.py

示例2: thruster_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def thruster_ctrl_msg():
    global actuator_vel
    global left
    global right
    global Kp
    msg = JointState()
    msg.header = Header()
    msg.name = ['fwd_left', 'fwd_right']
    aux = rudder_ctrl()

    left = aux + 100.
    right = -aux + 100.
    if (left < 0):
        left = 0
    if (right < 0):
        right  = 0  

    msg.position = [left, right]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:23,代码来源:diff_control_heading.py

示例3: get_msg_header

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def get_msg_header(self, frame_id=None, timestamp=None):
        """
        Get a filled ROS message header
        :return: ROS message header
        :rtype: std_msgs.msg.Header
        """
        header = Header()
        if frame_id:
            header.frame_id = frame_id
        else:
            header.frame_id = self.get_prefix()
        if timestamp:
            header.stamp = rospy.Time.from_sec(timestamp)
        else:
            header.stamp = self.communication.get_current_ros_time()
        return header 
开发者ID:carla-simulator,项目名称:ros-bridge,代码行数:18,代码来源:pseudo_actor.py

示例4: rudder_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def rudder_ctrl_msg(sail_ctrl):
    msg = JointState()
    msg.header = Header()
    msg.name = ['rudder_joint', 'sail_joint']
    msg.position = [0, sail_ctrl]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:10,代码来源:sail_polar_diagram.py

示例5: thruster_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def thruster_ctrl_msg():
    global actuator_vel
    msg = JointState()
    msg.header = Header()
    msg.name = ['fwd']
    msg.position = [actuator_vel]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:11,代码来源:rudder_control_heading.py

示例6: rudder_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def rudder_ctrl_msg():
    msg = JointState()
    msg.header = Header()
    msg.name = ['rudder_joint']
    msg.position = [rudder_ctrl()]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:10,代码来源:rudder_control_heading.py

示例7: talker

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def talker():
    pub = rospy.Publisher('/barco_auv/thruster_command', JointState, queue_size=10)
    rospy.init_node('ctrl_jointState_publisher', anonymous=True)
    rate = rospy.Rate(10) # 10hz
    hello_str = JointState()
    hello_str.header = Header()
    hello_str.name = ['fwd_left']
    hello_str.position = [10]
    hello_str.velocity = []
    hello_str.effort = []

    while not rospy.is_shutdown():
        rospy.loginfo(hello_str)
        pub.publish(hello_str)
        rate.sleep() 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:17,代码来源:control_simplepub.py

示例8: sail_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def sail_ctrl_msg():
    global actuator_vel
    msg = JointState()
    msg.header = Header()
    msg.name = ['fwd']
    msg.position = [sail_ctrl()]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:11,代码来源:sailboat_control_heading.py

示例9: __init__

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def __init__(self):
        rospy.init_node('usv_vel_ctrl', anonymous=False)
        self.rate = 10
        r = rospy.Rate(self.rate) # 10hertz

        self.usv_vel = Odometry()
        self.usv_vel_ant = Odometry()
        self.target_vel = Twist()
        self.target_vel_ant = Twist()
        self.thruster_msg = JointState()
        self.rudder_msg = JointState()
        self.thruster_msg.header = Header()
        self.rudder_msg.header = Header()
        self.kp_lin = 80
        self.ki_lin = 200
        thruster_name = 'fwd'
        rudder_name = 'rudder_joint'
        self.I_ant_lin = 0
        self.I_ant_ang = 0
        self.lin_vel = 0
        self.lin_vel_ang = 0
        self.ang_vel = 0
        self.kp_ang = 2 
        self.ki_ang = 4
        self.rudder_max = 70
        self.thruster_max = 30

        self.pub_motor = rospy.Publisher('thruster_command', JointState, queue_size=10)
        self.pub_rudder = rospy.Publisher('joint_setpoint', JointState, queue_size=10)

        rospy.Subscriber("state", Odometry, self.get_usv_vel)  
        rospy.Subscriber("cmd_vel", Twist, self.get_target_vel)

        while not rospy.is_shutdown():
            self.pub_rudder.publish(self.rudder_ctrl_msg(self.ang_vel_ctrl(), rudder_name))
            self.pub_motor.publish(self.thruster_ctrl_msg(self.lin_vel_ctrl(), thruster_name))
            r.sleep() 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:39,代码来源:boat_rudder_vel_ctrl.py

示例10: __init__

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def __init__(self):
        rospy.init_node('usv_vel_ctrl', anonymous=False)
        self.rate = 10
        r = rospy.Rate(self.rate) # 10hertz

        self.usv_vel = Odometry()
        self.usv_vel_ant = Odometry()
        self.target_vel = Twist()
        self.target_vel_ant = Twist()
        self.thruster_msg = JointState()
        self.thruster_msg.header = Header()
        self.kp_lin = 80
        self.ki_lin = 200
        thruster_name = 'fwd_left, fwd_right'
        self.I_ant_lin = 0
        self.I_ant_ang = 0
        self.lin_vel = 0
        self.lin_vel_ang = 0
        self.ang_vel = 0
        self.kp_ang = 80 
        self.ki_ang = 100
        self.thruster_max = 30
        self.vel_left = 0
        self.vel_right = 0
        self.thruster_command = numpy.array([0, 0])
        self.erro = 0

        self.pub_motor = rospy.Publisher('thruster_command', JointState, queue_size=10)

        rospy.Subscriber("state", Odometry, self.get_usv_vel)  
        rospy.Subscriber("cmd_vel", Twist, self.get_target_vel)

        while not rospy.is_shutdown():
            self.pub_motor.publish(self.thruster_ctrl_msg(self.vel_ctrl(), thruster_name))
            r.sleep() 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:37,代码来源:boat_diff_vel_ctrl.py

示例11: thruster_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def thruster_ctrl_msg():
    msg = JointState()
    msg.header = Header()
    msg.name = ['fwd_left']
    msg.position = [actuator_ctrl()]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:10,代码来源:simple_control_1.py

示例12: rudder_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def rudder_ctrl_msg():
    msg = JointState()
    msg.header = Header()
    msg.name = ['rudder_joint']
    msg.position = [math.radians(rudder_ctrl())]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:10,代码来源:simple_control_1.py

示例13: rudder_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def rudder_ctrl_msg():
    msg = JointState()
    msg.header = Header()
    msg.name = ['rudder_joint', 'sail_joint']
    msg.position = [0.0, sail_ctrl()]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:10,代码来源:sailboat_polar_diagram_control.py

示例14: thruster_ctrl_msg

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def thruster_ctrl_msg():
    global actuator_vel
    msg = JointState()
    msg.header = Header()
    msg.header.stamp = rospy.Time.now()
    msg.name = ['fwd']
    msg.position = [actuator_vel]
    msg.velocity = []
    msg.effort = []
    return msg 
开发者ID:disaster-robotics-proalertas,项目名称:usv_sim_lsa,代码行数:12,代码来源:airboat_control_heading.py

示例15: get_header

# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Header [as 别名]
def get_header(self):
        """
        Returns ROS message header
        """
        header = Header()
        header.stamp = rospy.Time.from_sec(self.timestamp)
        return header 
开发者ID:carla-simulator,项目名称:scenario_runner,代码行数:9,代码来源:ros_agent.py


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