Robotics StackExchange | Archived questions

ROS check turning given local_plan and global_plan

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

Asked by TIGER_ROARS on 2019-06-05 16:01:39 UTC

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).

Asked by gvdhoorn on 2019-06-06 02:37:38 UTC

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. :)

Asked by TIGER_ROARS on 2019-06-06 02:45:52 UTC

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.

Asked by gvdhoorn on 2019-06-06 02:49:55 UTC

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

Asked by TIGER_ROARS on 2019-06-08 15:51:06 UTC

Answers