Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joystick driver does not kill motors kill switch released. #4

Open
kegilbert opened this issue Mar 4, 2014 · 7 comments
Open

Joystick driver does not kill motors kill switch released. #4

kegilbert opened this issue Mar 4, 2014 · 7 comments

Comments

@kegilbert
Copy link
Contributor

Joystick controller uses button 5 for a dead man's switch. When released though it retains the latest motor values (if you were going full speed forward and let go of the controller, it will continue going forward). Line 38/39 in the node resets to zero if not right state, but that line is only reached through the preceding if-statement that checks right_state. At least that's what I seemed to notice through my limited usage of it and cursory glance of the node, let me know if there is no actual problem and I can't science.

@robz
Copy link
Contributor

robz commented Mar 6, 2014

Yeah, that's about what I experienced when driving it around at ExploreUT.

That if-statement that checks the right_state also guards against publishing messages. The logic is a little difficult to interpret because I don't know what each byte in a packet means, but I believe the node will not publish anything unless 5 is held down. When nothing is published to /vel_cmd, no commands should be sent to the ucontroller. With granny, the PSoC had a timeout to stop the motors if it stopped receiving data from the computer. Does the launchpad or launchpad driver have similar behavior?

@robz
Copy link
Contributor

robz commented Mar 6, 2014

By the way, we might want to look into using a ROS driver for the joystick instead of our own: https://github.com/turtlebot/turtlebot_apps/blob/hydro/turtlebot_teleop/launch/logitech.launch

@weng-frank
Copy link

Immediate recommended fixes:

  1. in output()
    rate = rospy.Rate(rospy.get_param('~ouput_rate',10.0))
    while...:
    ....
    rate.sleep()
    (Instead of time.sleep)
  2. In init()
    t.daemon = True
    (Before t.start(). This is to help the program die properly.)
  3. Alternatively to 1+2, use a rospy.Timer http://wiki.ros.org/rospy/Overview/Time
  4. Use python struct to interpret the incoming data http://docs.python.org/2/library/struct.html

@weng-frank
Copy link

That package will be quite a bit more bulky, but also complete and easier to interface to.

@weng-frank
Copy link

As for other fixes, a watchdog on the embedded is fairly crucial. This drive itself can also have something like: on the event of key5 release- publish a 0 velocity message. Also, rather than having some arbitrary math function to deal with acceleration, have a simple acceleration scheme like: Joystick input controls the velocity setpoint; use a fixed max_acceleration; each control loop, move the output velocity towards the velocity setpoint at max_acceleration or setpoint-output, whichever is less.

By the way, I'm not making these changes myself, since I'd have no way of testing.

@kegilbert
Copy link
Contributor Author

That's cool, thanks for the pointers! I can add a watchdog, and will look into the acceleration.

@robz
Copy link
Contributor

robz commented Jun 3, 2014

so for a while, this issue was fixed by adding a watchdog to the lm4f. now it is back. the lm4f requires something to be sent to it before it sends anything back to the computer, so the lm4f node is always sending to the lm4f the last cmd_vel message received in order to get encoder info out of it. i'd recommend doing what frank said about constantly sending 0 velocity on key5 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants