This is quite a basic question. I'm practising robot programming with VRep. I have 2 K3 robots in the scene. One robot follows a predefined path. I want the second robot to move "in parallel" with the first one so they keep same orientation and same distance at all time. When there is a turn, I want the follower to slow/accelerate a little to keep the parallel.

In my implementation, I use wireless communication. The first robot will periodically "tell" the second about its speed, orientation. The second will use these parameters to calculate two speed to its two wheel. But when I run it, it doesn't work. The orientation of the follower is wrong. The distance is not maintained. I was totally confused.

I think this is quite a rudimentary task. There must be some practise to follow. Can somebody help to provide some ideas, references? That will be highly appreciated!

  • $\begingroup$ Can you tell us what the follower robot is doing? Is it turning but not enough, going too fast/slow? Are the instructions as simple as 'turn x degrees clockwise, change speed to y m/s" or more complicated? $\endgroup$ Jun 1, 2014 at 7:44
  • $\begingroup$ @MatthewGordon Thank you for your help Matthew. The message follower robot get is the radius of the turn, and the average speed of the first robot. I use this radius to calculate a ratio that will multiple to the speed to get how much thrust the follower robot should apply to its two wheels. I don't know how to implement routines to let K3 to turn x degrees. What I do is hope the thrust is proportional so that it will have the effect of turning same angles like the first one. But it doesn't turn out that way. Can you point out what I was wrong? Apprecaite! $\endgroup$
    – Archer
    Jun 1, 2014 at 11:48
  • $\begingroup$ Why would the second one slow down or accelerate to keep in parallel? Is it keeping in parallel with a fixed cartesian translation? Or is it keeping in parallel with a fixed radial distance in some polar coordinate? $\endgroup$
    – Shahbaz
    Jun 1, 2014 at 21:13

1 Answer 1


As is often the case in robotics, there is no universally agreed-upon approach to formation control (which is what you are trying to achieve). As explained in the introduction to this article, there are roughly three basic approaches currently in use:

  • Behaviour-based, where each robot moves according to a set of local rules, and the formation dynamics results from the interactions between neighboring robots;
  • Virtual structure, where the robots are conceived to be parts of a single body (e.g. vertices of a polygon) and trajectories are calculated to conserve the shape of that abstract body;
  • Leader-following, where a designated "leader" robot follows a prescribed trajectory, and the "followers" track transformed versions of the leader current pose.

Given your description of the intended scenario, I'd say leader-following would be the best approach. This could be achieved fairly easily in the following manner (see this presentation for references on terminology and formulas):

  1. Define the intended pose $p_f$ for the follower robot in the leader's reference frame – e.g. $p_f = [0 \quad 1 \quad 0]^T$ for keeping to the left, or $p_f = [0 \quad -1 \quad 0]^T$ for keeping to the right;
  2. Every once in a while calculate the follower's pose in the global reference frame $g_f = Tp_f$ and relay it to the follower robot;
  3. Have the follower robot adjust its position to comply with the received pose $g_f$.

Just for reference, the Rigid Body Transformation matrix T is given by:

$$ T = \begin{bmatrix} cos(\theta) & -sin(\theta) & x \\ sin(\theta) & cos(\theta) & y \\ 0 & 0 & 1 \end{bmatrix} $$

Where $[x \quad y \quad \theta]^T$ is the leader robot's current pose.

  • $\begingroup$ Hey @xperroni , thanks for the amazing answer ! The link you shared, is broken. Can you please update it ? Thanks :) $\endgroup$
    – Pe Dro
    Oct 9, 2020 at 15:23
  • $\begingroup$ Sure, just fixed the dead link. $\endgroup$
    – xperroni
    Oct 9, 2020 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.