[Show all top banners]

killer1444
Replies to this thread:

More by killer1444
What people are reading
Subscribers
:: Subscribe
Back to: Computer/IT Refresh page to view new replies
 C programming
[VIEWED 4664 TIMES]
SAVE! for ease of future access.
Posted on 04-14-13 10:35 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 i have a C project for one  of my class. this project is about developing a simulation logic path for a robot movement.
Is there anyone out there who can help me out with this?? I will appreciate any positive resoponses.



 

Project 2

Due: 4/26/13

Objective:

 

Download the executable, Project_2.exe from the Black Board course website and run it (don’t forget to

place the text map files in the same folder as the executable). Once again you will be asked to enter the

simulation time. Enter 400. A map similar to the one displayed in project 1 will be shown on the screen.

This is just one of many maps now supported (there are a total of 7). Press N to move to the next map, P

to the previous map and S to select a map (notice that the previous option is not shown on the first map,

and the next option is not shown on the last map). A screen shot of map_6.txt is shown below:

The ability to show all the maps and navigate them in this way is extra credit. What is expected is that the

user can simply enter the name of the map file to use (map_1.txt through map_7.txt). But make sure to

perform input validation, so that the user cannot crash the program. In addition, the use of multiple

console colors is extra credit (you are free to use whatever color combination you like).

Select map_6.txt, and the simulation will begin. The robot will begin searching the map, marking where

it has been with a dot. In addition, when the robot reaches a decision point (a point in the map where it

can go forward in more than one direction), it placed a solid block. One of the advancements of this

algorithm is that the robot can backtrack to a previous decision point. When it does this, the simulator

uses the degree symbol to visualize this. When the robot is sure that it has searched the entire area (which

may not occur before the simulation time ends), the robot displays a message indicating so (it does not

run indefinitely).

Unfortunately, it’s harder to break up this project into phases, so please read through the whole document

first and them begin implementation. You are free to use whatever method you like to complete this

project, however, the outline provided below is what is used in the project executable provided.

Structures:

Create several structures to help the robot with its new navigation logic:

• POS: will contain integer variables x and y and represent a two dimensional position

• ROBOT: will contain a variable pos of type POS (position of robot), an integer dir (direction of

robot), and an integer mode (when set to 1 the robot is in backtrack mode to rewind back through

decision points until an untaken path is found, otherwise it is 0)

• DECISION: will contain a variable pos of type POS (position of robot where a decision was

made), an integer dir (the direction the robot chose to move at this decision point), an integer

pDir (the previous direction of the robot)

Modularize Your Code with Functions:

This program will now have the ability to read from multiple maps, each titled map_x.txt, where x can be

any number between 1 and 7. Each map is designed to test various aspects of the robots navigation. Your

robot should be able to navigate through all 7 maps. However start testing the navigation logic in

sequence; meaning move on to map_3.txt once your robot can search 90%– 100% of map_2.txt.

Put the routine to read the map into a function Read_Map, which will take a string for the filename, and

an integer double-dimensioned array for the map. The function will also contain the routine to determine

the total area searched, which will be returned from.

Add a function, InitSim, to initialize the simulation and return the total simulation time requested by the

user. The function will get the started position of the robot (you can hard code the starting position to row

11, column 2, since all maps have this starting point).

Add a function, DisplayMap, which will take the map, and the robot, and display the map and robot’s

position on the screen.

Add a function, Move, which will take the map, a position, and a direction, and return a new position

Add a function, AtDecisionPoint, which will take the map, and the robot and return true if the robot is at a

decision point, or false otherwise.

Add a function, ReverseDirection, will take a direction, and return the reverse of that direction

New Navigation Logic:

In this phase, you will create a function, UpdateRobotPos, to move the robot with each iteration of the

simulation loop. The way in which the robot is moved depends on the following logic:

• Robot is not at a decision point

o Move in a manner similar to project 1 (keep moving forward, even around corners)

• Robot is at a decision point

o Get the future direction in which the robot should travel (this should be a function)

§ Out of the possible directions at this decision point, pick one

§ Check to see if robot has made this decision before at this very same decision

point (do not make the same decision twice)

• This will require searching through an array of past decision points

§ Make sure the future direction is not the reverse of the current direction (can use

the ReverseDirection function to test

§ To change the future position of the robot you can use the Move function

§ Return the future direction of robot, if no suitable future direction can be found

(i.e. the robot is at a decision point of which all other directions have been tried

before), return -1

o If the future direction is not -1,

§ Have a counter to keep track of the current decision point (increments with each

new decision point)

§ Keep track of the decision that was just made by inserting it into an array at the

index position of the decision point counter

• Keep in mind that a decision point consists of an x, y position, direction

and previous direction.

§ Move the robot in that direction

o If the future direction is -1 (all decisions at this decision point as been made)

§ You essentially want to backtrack to the last decision point

§ If the current decision point >= 0 (you haven’t backtracked past all your decision

points)

• If you are not in backtrack mode yet (robot->mode != 1)

o Decrement the decision point counter

o Set the robot mode to backtrack mode

• Else if you are in backtrack mode

o Find the last decision point that is different from this one

o Choose another path on this decision point to try

 

• Proper use of functions and good general programming style => + 10 points

• Able to load multiple maps => + 10 points

• Use of console colors => Extra Credit (+ 10)

• Preview maps before selecting => Extra Credit (+20)

This grading scale may be adjusted depending on the performance of the class.


 

Last edited: 15-Apr-13 08:08 PM
Last edited: 20-Apr-13 06:37 PM

 
Posted on 04-14-13 10:55 PM     [Snapshot: 27]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

You guys should be very careful before posting these type of confidential questions in public website! Your professors won't like it

 
Posted on 04-15-13 9:22 AM     [Snapshot: 200]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 


I know. But I dont have a choice, and this is not confidential as you might be thinking. 
 

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
I hope all the fake Nepali refugee get deported
To Sajha admin
Travel Document for TPS (approved)
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
Those who are in TPS, what’s your backup plan?
All the Qatar ailines from Nepal canceled to USA
MAGA and all how do you feel about Trumps cabinet pick?
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters