本文整理汇总了Python中sensor_msgs.msg.Joy.axes[6]方法的典型用法代码示例。如果您正苦于以下问题:Python Joy.axes[6]方法的具体用法?Python Joy.axes[6]怎么用?Python Joy.axes[6]使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensor_msgs.msg.Joy
的用法示例。
在下文中一共展示了Joy.axes[6]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toPS3Msg
# 需要导入模块: from sensor_msgs.msg import Joy [as 别名]
# 或者: from sensor_msgs.msg.Joy import axes[6] [as 别名]
def toPS3Msg(self):
joy = Joy()
joy.header = self.orig_msg.header
joy.buttons = [0] * 17
joy.axes = [0] * 20
if self.center:
joy.buttons[16] = 1
if self.select:
joy.buttons[0] = 1
if self.start:
joy.buttons[3] = 1
if self.L3:
joy.buttons[1] = 1
if self.R3:
joy.buttons[2] = 1
if self.square:
joy.axes[15] = -1.0
joy.buttons[15] = 1
if self.up:
joy.axes[4] = -1.0
joy.buttons[4] = 1
if self.down:
joy.axes[6] = -1.0
joy.buttons[6] = 1
if self.left:
joy.axes[7] = -1.0
joy.buttons[7] = 1
if self.right:
joy.axes[5] = -1.0
joy.buttons[5] = 1
if self.triangle:
joy.axes[12] = -1.0
joy.buttons[12] = 1
if self.cross:
joy.axes[14] = -1.0
joy.buttons[14] = 1
if self.circle:
joy.axes[13] = -1.0
joy.buttons[13] = 1
if self.L1:
joy.axes[10] = -1.0
joy.buttons[10] = 1
if self.R1:
joy.axes[11] = -1.0
joy.buttons[11] = 1
if self.L2:
joy.axes[8] = -1.0
joy.buttons[8] = 1
if self.R2:
joy.axes[9] = -1.0
joy.buttons[9] = 1
joy.axes[0] = self.left_analog_x
joy.axes[1] = self.left_analog_y
joy.axes[2] = self.right_analog_x
joy.axes[3] = self.right_analog_y
return joy
示例2: main
# 需要导入模块: from sensor_msgs.msg import Joy [as 别名]
# 或者: from sensor_msgs.msg.Joy import axes[6] [as 别名]
def main():
print "Started"
rospy.init_node("mock_server", anonymous=True)
joy_pub = rospy.Publisher("/joy", Joy)
joy_msg = Joy()
for i in range(7):
joy_msg.axes.append(0.0)
for j in range(12):
joy_msg.buttons.append(0)
joy_msg.axes[6] = 1
# rospy.loginfo('joystick vehicle controller starting')
print "Setting Host"
# myHost = '192.168.88.202'
# myPort = 1234
myHost = rospy.get_param("/ip", "192.168.88.202")
myPort = rospy.get_param("/port", 8080)
print "My Host : " + myHost
print "My Port : " + str(myPort)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # create a TCP socket
try:
s.bind((myHost, myPort))
except socket.error, msg:
print "Bind failed. Error Code : " + str(msg[0]) + " Message " + msg[1] # bind it to the server port