def tj_callback(data):
# start publisher of cmd_vel to control Turtlesim
pub = rospy.Publisher("turtle1/cmd_vel", Twist, queue_size=1)
# Create Twist message & add linear x and angular z from left joystick
twist = Twist()
twist.linear.x = data.axes[1]
twist.angular.z = data.axes[0]
# record values to log file and screen
rospy.loginfo("twist.linear: %f ; angular %f", twist.linear.x, twist.angular.z)
# process joystick buttons
if data.buttons[0] == 1: # green button on xbox controller
move_circle()
# publish cmd_vel move command to Turtlesim
pub.publish(twist)
turtlesim_joy.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录