turtlebot / turtlebot_apps

A group of simple demos and exmaples to run on your TurtleBot to help you get started with ROS and TurtleBot.
http://www.ros.org/wiki/turtlebot_apps
196 stars 225 forks source link

turtlebot_apps/turtlebot_teleop/joystick_teleop: robot keeps moving even though new joy messages not coming in #55

Open mirzashah opened 11 years ago

mirzashah commented 11 years ago

It seems that the joystick teleop hast the robot keep going even if new joystick messages aren't coming in. This works fine until you lose wifi with your robot and then it keeps going because the last joy message wasn't a full stop. The teleop for pr2 works a little different where the teleop node stops publishing Twist messages if Joy messages stop coming in.

I think for safety's sake, the turtlebot_teleop should try to replicate this.

The code looks pretty simple, there's a timer that constantly publishes the latest twist message. The fix is just to zero out the latest twist message if the last Joy message that came in the callback has a timestamp that is older than X seconds. https://github.com/turtlebot/turtlebot_apps/blob/hydro-devel/turtlebot_teleop/src/turtlebot_joy.cpp

tfoote commented 11 years ago

yes, it should definitely timeout

bit-pirate commented 11 years ago

Strange. I used those tools recently (2 weeks ago, testing ps3, xbox360 and keyboard teleop) and remember the teleop tools behaving the way you expect @mirzashah https://github.com/mirzashah. I noticed one thing though: Sometimes the joystick does not go back to absolute zero and hence keeps sending velocity commands with low speeds.

What setup are you using? Hydro? Launching minimal + app?

2013/8/20 Tully Foote notifications@github.com

yes, it should definitely timeout

Reply to this email directly or view it on GitHubhttps://github.com/turtlebot/turtlebot_apps/issues/55#issuecomment-22910673 .

Marcus Liebhardt Adresse: Zimmer 403, 634-1 Seongsan-dong, Mapo-gu, 121-846, Seoul, Republik Korea Address: Room 403, 634-1 Seongsan-dong, Mapo-gu, 121-846, Seoul, Republic of Korea 주소: 대한민국 서울특별시 121-846 마포구 634-1 성산동 4 층 403 호 Mobile / Mobilfunk: +82 10 3322 0566 Email: ich@marcusliebhardt.de ich@marcusliebhardt.de

mirzashah commented 11 years ago

@bit-pirate Yes, I'm just using turtlebot_bringup/minimal.launch + joystick teleop.

Here's the problem I have. I have replicated the output of a PS3 controller for an Android device...specifically the nvidia shield. I have it rounding down to zero values that are close to zero. The controller itself is very precise, just as precise as a PS3 controller if not more so. Here's the difference: A PS3 controller is hooked via bluetooth to the robot. If you let go of the controller it will zero out and the last message the robot receives is a 0. It's unlikely you'll lose connection to the robot while moving it. With my android device, if I loses wifi when switching between access points in an enterprise network while holding the throttle, the robot will keep going forever.

This is very obvious from just looking at the code, there's not much going on in the .cpp file.

A timer is created here to call Publish() continuously forever: https://github.com/turtlebot/turtlebot_apps/blob/hydro-devel/turtlebot_teleop/src/turtlebot_joy.cpp#L77

Here is what is going on in Publish(), if deadman is down it will publish. https://github.com/turtlebot/turtlebot_apps/blob/hydro-devel/turtlebot_teleop/src/turtlebot_joy.cpp#L91

And here is where the current joystick state is set on receiving Joy message https://github.com/turtlebot/turtlebot_apps/blob/hydro-devel/turtlebot_teleop/src/turtlebot_joy.cpp#L94

No check is done to look for a timeout.

mirzashah commented 11 years ago

I bet this could be an issue at a large show/conference/exhibition where there's lots of bluetooth interference. You could be moving around a turtlebot and lose control of it.

mirzashah commented 11 years ago

lol, you know i could have patched this in the time it took to write this comment...i'll submit a pull request tomorrow :)

bit-pirate commented 11 years ago

hehe

i'll submit a pull request tomorrow :)

+1