ROS check turning given local_plan and global_plan

asked 2019-06-05 16:01:39 -0500

TIGER_ROARS gravatar image

Hi guys I'm really new to ROS, I want to know how to check that the robot is about to turn given the two topics as well as cmd_vel and plan. I want to add turning lights a robot and I want the lights to light up before the robot is actually turning.

Would there be a library function to this? If not I was thinking of checking the local_plan shape and If that plan is a curve then I will turn on the turning lights. Any answers will be much appreciated. Thanks

edit retag flag offensive close merge delete

Comments

Just a thought: would check cmd_vel not be easier? Define some threshold and when the angular part of the Twist exceeds a certain value you could turn on the lights.

It may need a state machine to track / classify the incoming Twist compared to the current state of the robot (ie: you don't want to alternate lights too quickly).

gvdhoorn gravatar image gvdhoorn  ( 2019-06-06 02:37:38 -0500 )edit

Hey GVDHOORN, thanks for your input! This is a good idea but this wouldn't allow me to turn on the turning lights before going into the turn and I think this feature is an important part of my project. :)

TIGER_ROARS gravatar image TIGER_ROARS  ( 2019-06-06 02:45:52 -0500 )edit

Well, the delay might not be too noticable, but it's true that it's a reactive approach.

There are multiple older Q&As that explain how to receive the global and local plan on topics from move_base. See #q323856 for a recent one, but #q282519 is another.

You could perhaps subscribe to retrieve the current local plan (note: it changes often), then keep track of where the robot is relative to the plan, determine whether it's going to go "around a corner" and turn on/off lights based on that.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-06 02:49:55 -0500 )edit

I see I will definitely check those out and update you if problem arises. Thanks again!

TIGER_ROARS gravatar image TIGER_ROARS  ( 2019-06-08 15:51:06 -0500 )edit