Ask Your Question

How could I navigate with a real robot

asked 2019-11-29 10:09:14 -0500

yosra gravatar image

Hello, I have a robot with 4 wheels and laser sensor ydlidar x4 , succeed to build the map with hector slam , now I don't know what to do to navigate using a static map from the actual position to B position , the robot (raspberry pi 3B) is connected via UART to an stm32 responsible for running the robot i have to send 4 caracters : "F" for front , "B" for back , "R" for right and "L" for left

Any one have any idea?

edit retag flag offensive close merge delete


You have some work left to do before your can use navigation stack. Since you only send F,B,R,L to controller maybe a lot of work left.

Do you get any feedback from the wheels from an encoder, or maybe you are using stepper motors where you can directly control the number of steps/second?

Can you control the rate of spin on the wheels?

Can you both turn and move forward at the same time?

Navigation stack assumes you have the capability to steer your robot while moving and have some control over the speed of the robot. Navigation stack will output a velocity command and a rotate command(at the same time) and you'll need to translate that command into some your controller can use.

For wheel feedback the standard use is odometry data from encoders, but there are a couple alternate ways to get ...(more)

billy gravatar image billy  ( 2019-11-29 18:31:10 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-12-02 03:39:00 -0500

Delb gravatar image

@billy 's questions are relevant, please edit your questions to add the answers (even if you can't answer every question). The most important one is :

Can you both turn and move forward at the same time?

You can use the navigation stack to generate trajectories without moving your robot thanks to the service make_plan, that will return a path (i.e. a list of poses). Since you can only use 4 commands you can call the service to get the positions and then try to reach each of them. Since you said you are using a map previously created, you need to use AMCL to get the position of the robot. By comparing the robot pose with the goal you have to reach you could decide in which direction your robot has to move. You can then decide to have a goal tolerance to decide to reach the next goal.

edit flag offensive delete link more


The robot can't turn just moving to 4 directions (F,L,R,B)

yosra gravatar image yosra  ( 2019-12-02 04:19:32 -0500 )edit

Oh so that's a holonomic robot ? Eventhough it can't turn, can it go to the left (or right) and forward at the same time ?

Delb gravatar image Delb  ( 2019-12-02 04:31:21 -0500 )edit

No it can't , eventually one action will perform first , if we send Left and right at the same time one action will execute first and then the second.

yosra gravatar image yosra  ( 2019-12-02 04:37:50 -0500 )edit

And can you change this behavior ? That's not optimal at all, but you should still be able to navigate doing as I suggested. If you can change this then refer to @billy 's comment to be able to use the navigation stack.

Delb gravatar image Delb  ( 2019-12-02 04:47:24 -0500 )edit

How could I run AMCL for localisation ? I'm using hector slam to build the map my approch: 1/run the map server 2/rosrun amcl scan:=base_scan

yosra gravatar image yosra  ( 2019-12-02 08:51:22 -0500 )edit

You could use a launch file to have all the AMCL parameters set but that's indeed the two required nodes for the localization with AMCL.

Delb gravatar image Delb  ( 2019-12-02 09:24:46 -0500 )edit

Ok thank you i'll try your approach

yosra gravatar image yosra  ( 2019-12-02 10:07:10 -0500 )edit

answered 2019-11-29 11:17:24 -0500

duck-development gravatar image

You have to look at the navigation stack, but you have already done it because Hector slam is working. With r viz you can set the goal

edit flag offensive delete link more



The navigation stack is for moving a robot and Hector Slam is to create a map and localize a robot so I don't see why you conclude OP is using the navigation stack.

Delb gravatar image Delb  ( 2019-12-02 02:03:11 -0500 )edit

Yes! in fact hector slam is working, but with a real robot i have to communicate with the controller in stm32 , I don't know the implementation done but just I have to send via UART a char "f" for forwad, "b" for back "r" for right and "l" for left don't know how to translate the velocity commnad to such information used by the robot

yosra gravatar image yosra  ( 2019-12-02 02:44:51 -0500 )edit

You write a node witch is subscribing the twis topic and read the data und send as a response some uart megs to you stm32 over uart

duck-development gravatar image duck-development  ( 2019-12-03 12:22:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-11-29 10:09:14 -0500

Seen: 106 times

Last updated: Dec 02 '19