This is my first ever post here, so unsure whether im in the right place or not

I am writing a piece of code, for the distance sensor on the NXT, to sense one object, move on, and then sense another object. The whole project is to make a car that can parallel park itself, but this is the first thing I want it to do, sense the space it will be parking in.

Any sort of help would be great. I have only started the project so not really got any code yet.

Fantastic advise. You have been more than helpful I definitely know where to come if I need anymore help!

Mohsin.

Sat Oct 16, 2010 8:00 am

boxr007

Rookie

Joined: Fri Oct 15, 2010 2:20 pmPosts: 17Location: Rochdale, UK

Re: how detect one thing....then another

Right, the FSM has been really helpful. I have done the "park car" state. I am struggling to do the rest. I have written some pseudo code to try and make it clearer to me, which is helpful, but still, I am having difficulty in how to structure the actual program to get the car to actually check the start of the parking spot, check end of parking spot and see if the spot is big enough. This is the sort of thing I have written:

Start off with US sensor next to first imaginary car.

Wait for US sensor to detect distance further than 10cm (free space in between cars).

If US sensor detects distance further than 10cm, reset rotation sensor on motor to start counting free space.

If rotation sensor has counted at least 960 degrees (suitable distance for parking) and then US sensor has detected distance nearer than 10cm, get car ready for parking, else loop again.

If US sensor detects distance nearer than 10cm before rotation sensor has counted at least 960 degrees, start loop again.

Any help to help me sort out some structure for this program will be fantastic!

But that's the thing, I havnt actually written anything to do with the sensors yet. The above code is only for when it needs to carry out the parallel park from the end point it needs to be at. Its just gettin it to that end point! I'm having difficulty even starting writing that part of the code. Sorry I know I sound like a total amateur :$ lol.

Tue Nov 02, 2010 10:36 am

boxr007

Rookie

Joined: Fri Oct 15, 2010 2:20 pmPosts: 17Location: Rochdale, UK

Re: how detect one thing....then another

Oh I know that it will need to be before the whole of the code, after the task main() bit. I have some sort of idea, that it should first detect when there is some free space, meaning the start of the parking spot. From here I think it should count the distance till the next time it senses something that is not free space-meaning the next car. And if this distance is suitable..carry out the above code to park??

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum