-2

I have LEGO NXT and a square room of 100x100cm. I would like to use the center of the of the room always as my starting point(the black box). The green box is going to be my park area. Circles can be the random placed obstacles on my way. Red is the walls of the room. Objectives:

  • When starting no matter where the robot is, it should return to center, afterwards it should be able to park into the green box when requested.
  • In its returning center/home progress there can be obstacles on the way, I should try to overcome these obstacles and park successfully. The obstacles don't have to be circular, they can be square as well.
  • If there is an obstacle in the park/center area I should give an error not possible to park or abort the parking...

Worst case scenarios: Robot starting from the corner and obstacles on the way to park. I'm using for the time being color sensor and ultrasound sensor, I can also add a gyro sensor but haven't made yet deep search about it. I also have RFID sensor but I think only with 2 transponders it wont help much.

My first challenge is without any obstacles for starters would be identifying the center to the robot, and it knows where it has to come from a random position. Any tips? I'm using leJOS.

Robot room

Ultrasound is able to measure distances from 5 to 255 centimeters with a precision of +/-3 cm. Anything lower than 5 cm is shown as 6-8 cm, triangular/round faces are problematic the error in distance can be 10cm in those times but we will consider all as square/nice objects for the beginning. The color sensor is under the Ultrasound sensor they are both on the front of my robot like the lights of a car.

Anarkie
  • 657
  • 3
  • 19
  • 46
  • Could you be more specific about your sensors? Does the color sensor work only on the ground below the robot, or can it "see". How accurately can the ultrasound detect objects? – Noctua Apr 26 '14 at 09:17
  • @Noctua Ultrasound is able to measure distances from 5 to 255 centimeters with a precision of +/-3 cm. Anything lower than 5 cm is shown as 6-8 cm, triangular/round faces are problematic the error in distance can be 10cm in those times but we will consider all square/nice objects for the beginning. The color sensor is under the Ultrasound sensor they are both on the front of my robot like the lights of a car. – Anarkie Apr 26 '14 at 09:24
  • This question appears to be off-topic because it is not about programming within the scope defined in the help center. I can't find any programming questions here, asking how your robot should identify positions is a conceptual problem highly dependend on the robots sensors and capabilities and would maybe be better asked at the robotics Stack Exchange site. – l4mpi Apr 26 '14 at 10:04
  • @l4mpi The robot has to be in the end programmed in java to be able to do the tasks but tasks should be first realized... – Anarkie Apr 26 '14 at 10:09
  • 1
    The fact that you will have to program something eventually does not mean that the whole of your task is an acceptable question for SO. If your have any problems with the actual programming part, feel free to ask here. But right now there is no programming question here, just a conceptual problem highly related to robotics and unrelated to programming. – l4mpi Apr 26 '14 at 10:14

1 Answers1

0

I agree with the comments: It is hard to imagine what an "acceptable" answer could be. As simple as such a task may seem, it's a highly complex process that involves the classical "Sense-Plan-Act" cycle of

  • Detecting objects with the sensors and integrating this into your knowledge about the world
  • Planning a path, including the acquired knowledge
  • Acting by moving towards the goal

There are many unknowns here. For example, what about "degenerate" cases, where the robot is surrounded by a wall of obstacles? Does the robot know its orientation (i.e. the direction in which it is heading)? How to you control the robot? Using the DifferentialPilot class? Does the robot know its size (width) in centimeters, so that it may detect whether it can pass through two obstacles that are close together? Should the robot try to take some "shortest path", or is it OK to extensively explore the world for a while? Is it valid to assume hat obstacles are detected via the distance sensor and the parking area via the color sensor? Is it true that the color sensor only has a range of a few centimeters? And maybe most importantly: Do you know where the parking position is?

Considering all these questions, one can only try to give general hints about possible approaches. I'll try to do this before the answer is closed. But this should not be considered as a really profound step-by-step solution, but only as suggestions, because all the questions mentioned above have to be answered before one can say whether a solution might work at all (and whether it will work is another question...)


You should think about your intended representation of the "World" (or describe this representation, if you already thought of one!). I could imagine that some sort of "grid" may be sufficient here. But it would probably be beneficial to use a LineMap for the representation of the world, because this enables you to use the existing infrastructure of the NXT API.

Once your have a representation of the world, you have to find its center. Again, when there are obstacles, this may not even be possible (I'm thinking about the Allegory of the Cave here). But when there are no obstacles, you could just spin the robot in place, about 360°: This will provide distance information for all the wall points. Given this information, it should be possible to detect the corners of the world - these would exactly be the corners of the bounding rectangle of the LineMap. Computing the average of these corner positions will yield the center.

After moving to the center, you have to move to the parking position. If I understood the setup correcly, you do not even know where this parking position is. In this case, you'd have to start a systematic exploration: You could try to move in "spirals" outwards, starting from the center. Whenever you encounter an obstacle, you try to move to the next free point on this "spiral". If you know where the parking position is, you could try to move directly to this position, avoiding all obstacles.

In both cases, you'd have a "current position" and a "target position" - the latter either being the "next free point on the spiral", or the "parking position". In order to find a path between these points in the world map, you could use a A* search algorithm. Fortunately, the NXT API already offers a ShortestPathFinder. Integrating this so that it properly controls your robot may nevertheless be tricky. But if you use, for example, the DifferentialPilot class, there are probably many resources of free/sample source code for tasks that are already similar to what you are trying to do, maybe you can find some ... "inspiration" there.

Marco13
  • 53,703
  • 9
  • 80
  • 159
  • For simplicity lets assume first there are no obstacles. The black box in the center is where I want the robot to start and return when he finishes his duty. The green box is the parking area, robot should park for charging in the green box. So when it needs charging it first should come to center(black box) then to charging(green box) Challenge is to find the black box again after leaving home. – Anarkie Apr 26 '14 at 14:34
  • 1
    Again: You have not asked a **question** that can be **answered**. You have given a blurry (and formally underspecified) description of a highly complex task that has to be solved. There are literally hundreds or thousands of degrees of freedom for solving this task, and we can not discuss or elaborate all of them here. – Marco13 Apr 26 '14 at 14:38