ps3 controller lag
Hello everyone, I am writing some code to do some basic bluetooth teleop control of a robot, and for some reason when I try to move forward for an extended period of time it does cuts out until the controller is updated. is this a timeout problem? If so how could I change the timeout?
#!/usr/bin/env python
#
# Simple Joystick Control Node
#
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy
from actionlib_msgs.msg import GoalID
def joyCB(msg):
rospy.logdebug("Joy Recieved: [Vx:%f, Wz:%f]"%(msg.axes[linear_axis],
msg.axes[rotation_axis]))
cmd_vel_msg = Twist()
cmd_vel_msg.linear.x = msg.axes[linear_axis] * linear_scale
cmd_vel_msg.angular.z = msg.axes[rotation_axis] * rotation_scale
cmd_vel_pub.publish(cmd_vel_msg)
# PS3 Triangle Button (12) - abort navigation command
if msg.buttons[12]:
nav_abort_pub = rospy.Publisher("/Pioneer3AT/move_base/cancel", GoalID)
abort_msg = GoalID()
#abort_msg.stamp = rospy.Time.now()
#abort_msg.id = ""
nav_abort_pub.publish(abort_msg)
if __name__ == '__main__':
rospy.init_node('teleop_joy')
global cmd_vel_pub
global linear_axis
global linear_scale
global rotation_axis
global rotation_scale
linear_axis = rospy.get_param('linear_axis' , 1)
linear_scale = rospy.get_param('linear_scale' , 1.0)
rotation_axis = rospy.get_param('rotation_axis' , 2)
rotation_scale = rospy.get_param('rotation_scale', 1.5)
cmd_vel_pub = rospy.Publisher("cmd_vel", Twist)
rospy.Subscriber("joy", Joy, joyCB)
rospy.spin()