0

To walk, the robot must receive input in meters, how long it has to walk. The robot will compute the distance it has moved every 1 meter. The process of checking the distance will be repeated every 1 meter until it finishes the movement.

My Pseudo code Design:

start
num walkingDistance
num distanceMoved = 0

Display "Enter the distance (in meter) : "
Get walkingDistance

for (count = 1 to walkingDistance)
 distanceMoved = distanceMoved + 1
endfor
end

Is there any problems on my design? Any help is much appreciated.

Edited by aloi93: n/a

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Adak
0

Your logic should answer the kid's annoying questions on long trips:

"Are we there yet?"

while(1) {
  if distance == goal) {
    stopWalking();
    printf("Goal reached\n");
    break;
  }else {
    takeAstep();
    //assumes each step is 1 meter
    printf("I have %d more meters to cover\n", --distance);
  }
}

In humans, walking is a forward lean accompanied by taking steps. Same thing with robots, except they don't do well with the energy saving forward lean aspect of it. It still saves energy, but if you don't limit it, they'll fall over. They have no sense of balance, as we do, unless you build it into them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.