View unanswered posts | View active topics It is currently Mon Dec 22, 2014 10:29 pm






Reply to topic  [ 7 posts ] 
Create a map 
Author Message
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Create a map
Dear,
i want to create an algorithm for path planning, first i want to create the map of environment,
how to put in my program a standard environment?


Fri May 17, 2013 3:23 am
Profile
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Re: Create a map
i started with follow program
i created a 2D array
and a loop for sonar sensor

#pragma config(Sensor, S4, sonarSensor, sensorSONAR)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

// create 2D array 5 X 5
int square[][] =
{
{10, 9, 8, 7, 8},
{11, 10, -1, 6, 7},
{-1, -1, -1, 5, 6},
{1, 2, -1, 4, 5},
{0, 1, 2, 3, 4},
};

task main()
{

// Move forward until 7 cm from the wall.
while (SensorValue(sonarSensor) > 7)
{
motor[motorA] = 10;
motor[motorC] = 10;
}

// go backward
motor[motorA] = -6;
motor[motorC] = -6;
wait1Msec(5000); // stop in 5 seconds
}


Fri May 17, 2013 4:24 am
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: Create a map
Could you explain your code a little more? For example, what does your array represent?

Ps. Enclosing your code in "code" tags makes it more readable.

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Sat May 18, 2013 2:31 pm
Profile
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Re: Create a map
the black area it is the obstacle,
i defined with -1
the other numbers
Starting from an array value of 1, add 1 to
every adjacent square that is a 0.
Starting from an array value of 2, add 1 to
every adjacent square that is a 0.
Starting from the goal turn left, right or
continue straight to ensure the robot
always goes to a lower numbered cell
Or a same numbered cell if no lower one
exists

something like this picture,
but i don't know how to create a map or how to move the lego in one area


Attachments:
plan.png
plan.png [ 15.27 KiB | Viewed 2738 times ]
Sat May 18, 2013 5:20 pm
Profile
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Re: Create a map
i want to move the robot based on array, how to connect the robot with array?


Sun May 19, 2013 5:26 am
Profile
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Re: Create a map
i believe the code for this example image is the follow
int square[][] =
{
{7, -1, 5, 6},
{6, 5, 4, -1},
{7, -1, 3, 2},
{8, -1, 3, 2},
};

how to put the robot motion with array?


Sun May 19, 2013 5:35 am
Profile
Novice

Joined: Wed Feb 20, 2013 2:46 am
Posts: 64
Post Re: Create a map
how to create a static map? the obstacles not moves, i want to know before start the program where are the obstacles
if i will create a map may have the project


Tue May 21, 2013 4:03 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.