buzz-lang/Buzz

Unexpected behavior of footbot

Closed this issue · 4 comments

I don't know if this the correct place to make a question because it might simply be that I misunderstood something, but since I don't find any other place, here I go. For the attached experiment I expected:

  1. that the bot stops at t == 50,
  2. that the bot moves in a straight line,

but neither of these behaviors happen: it continues circling infinitely. I'll really appreciate any help, best regards,

Alan Calderón Castro
pruebas_footbot.argos.txt
pruebas.bzz.txt

Hai Alan Calderon,
Thank you for your interest in buzz.
The goto function in buzz expects a vector in the local coordinate system of the robot and drives it. It is meant to be used in a closed-loop fashion, where the coordinates are recomputed every step based on the sensing. For instance, if you are trying to drive the robot to a fixed x and y coordinates in the simulator, you might have to compute the local vector using the current position of the robot. The following code snippet will drive the robot to a target coordinate (5,5):

Target = math.vec2.new(5,5)
m_target = math.vec2.sub(Target, pose.position)
m_target =  math.vec2.rotate(m_target,-pose.orientation.yaw)
goto(m_target.x,m_target.y)

If you want to drive the robot forward with a constant speed, you could try using the set_wheels(left_wheel_speed,right_wheel_speed)

Furthermore, what happens with your existing code is that you are trying to increment the x and y coordinates every step and it results in a diagonal vector in the first quadrant of the robot's coordinate system. The robot tries to rotate and reach this point and the goto vectors stay the same (pointing in the 1st coordinate), so the robot keeps turning infinitely. If you want the robot to keep going forward you will have to pass in a vector like this: (25,0). It will keep going in the forward direction.
If you have more questions, feel free to contact me.

-Vivek

Thank you very much Vivek for your quick and complete answer!!
Do you have the API doc for the footbot and all other types of bots that we can program from Buzz? Or do you know where could I download them?

I would refer you to the Buzz website: https://the.swarming.buzz
Inside the wiki (https://the.swarming.buzz/wiki/doku.php?id=buzz_kh4), you will find the information you are looking for.

Thank you very much Vivek!