Rover doesn't behave properly when controlling with an xbox controller


Below is the route a command takes to get from the Xbox controller to controlling the robot.



In order to debug issues with controlling the robot with the Xbox controller we suggest starting at the top. 


Performing rostopic echo /joystick will show you the raw commands coming out of the xbox linux driver. This topic is published by a node called joy. Moving the left joystick while echoing this topic should cause the array[1] to approach 1 when pressed forward and -1 when pulled back. Moving the right stick should cause array[2] to approach 1 when moved left and -1 when moved right. If this topic does not exist than there is a problem with the joy node. If the topic exists but is not being published too then there is probably and issue with Xboxdrv, the OS level driver that we use. (http://wiki.ros.org/joy) (https://xboxdrv.gitlab.io/)


If the /joystick outputs looks correct, next perform rostopic echo /cmd_vel/jostick. This topic requests that the robot move at a certain linear and angular speed in m/s and rad/s respectively. Note that the robot may not listen if a higher priority command is active or if the system is e-stopped. 0.5m/s and 1rad/s are pretty slow values good for testing. Max speed of the robot is 4m/s and 9rad/s. 


If the /cmd_vel/jostick output looks correct next perform rostopic echo /cmd_vel/managed. This topic is the result of combining multiple control sources together an taking the highest priority one and sending that to the robot. The frame_id is set to report which input source is currently commanding the robot. If this reads "soft-estopped" that means the A button on the xbox controller was pressed to stop the robot. The B button must be pressed to resume motion. When controlling the robot with the joystick the frame_id should read "joystick". Otherwise the rest of the values should be identical to /cmd_vel/joystick.


The last topic in the chain is /rr_openrover_basic/motor_speeds_commanded and is purely a debugging topic. It reports the serial values sent to the robot which range from 0-250. 0 is full reverse, 250 is full speed forward, and 125 is stopped. If you see values other that 125 being reported on this topic and the robot is not moving then try power cycling the system. If that still does not work there is either a problem with the connection to the robot, or a problem with the firmware of the robot.