uos / sick_tim

A ROS driver for the SICK TiM series of laser scanners.
http://wiki.ros.org/sick_tim
47 stars 90 forks source link

Auto retry USB and ethernet connections due to any reason. #25

Closed chadrockey closed 9 years ago

chadrockey commented 9 years ago

@mintar @mikeferguson @jspricke

This pull request enables a more robust driver by resetting the state and attempting to reconnect automatically until the laser enables or ROS shutsdown.

The driver should survive USB disconnects, ethernet disconnects, and laser power disconnects and eventually come back up.

mintar commented 9 years ago

@chadrockey , thanks for your PR! I don't have a device handy for testing, but I suppose you've tested this. Looks good to me.

jspricke commented 9 years ago

Apart from the sleep(1) it looks good to me as well.

chadrockey commented 9 years ago

@mintar I tested on a TIM that had both micro USB and ethernet. I don't have all of the models so there could be cases in some of the parsers if they keep undesirable states and we violate that assumption, but I didn't see any.

chadrockey commented 9 years ago

@mintar @jspricke I fixed some issues and addressed comments.

mikeferguson commented 9 years ago

I haven't tried it out -- but based on my quick look it LGTM. This would be a very nice improvement (the respawn thrashing can be pretty problematic). Thanks @chadrockey!

mintar commented 9 years ago

Thanks @chadrockey , looks perfect! Could you please squash all 3 commits into one and force-push the branch? I'll merge it then.

mintar commented 9 years ago

Guys, let's just merge this pull request as it is and move the sleep(1) into the outer loop in a seperate one. Ok?

jspricke commented 9 years ago

Fine with me.

chadrockey commented 9 years ago

I found a method that's most consistent for me. Basically, I check in the outer loop if ! ethernet then ros::Duration(1).sleep(). I'll push a squashed updated pull to this later today PST.

mintar commented 9 years ago

Great! I'll merge as soon as you've pushed the update (please also add a comment then, since I don't think I get an email notification on a force-push).

chadrockey commented 9 years ago

@jspricke @mintar

Forgot about this yesterday.

Updated and squashed version is pushed now.

mintar commented 9 years ago

Thanks a lot again for your work, merged! :-)