BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

Python代写|Robot Intelligence : Homework 3

Python代写|Robot Intelligence : Homework 3

这是一篇美国的python智能机器人it代写

 

Instructions :

When submitting please put your answers in a zip file your_net_id .zip with your code and a pdf of your written solutions.

Please type all solutions in LATEX and submit a PDF here. Handwritten solutions will not be accepted.

For HW3 you are allowed to discuss problems and solutions with others, but they must be typed up individually. Any questions about the homework can be asked to campuswire or asked to the TAs in office hours.

 

Exercise 1 :

Implementing PD Controller

— Do NOT copy or look up solutions for the code, your code must be your own work. Any code that is copied will result in an automatic zero. You may solely consult libraries when implementing the coding questions.

— At the bottom of this exercise in your written up answers, list all any sources you may have consulted, as well as any teammates or TAs you discussed the problem with.For this problem, we will be using the CarRacing environment from Open AI and our own easier version of it, EasyTrack. The first part is meant to get you familiar with the environment and the game, and the second part involves writing a working solution so that your car may navigate around the course on its own.

1.InstallOpenAI’s gym to your python environment : https://github.com/openai/gym.

2. Try playing the game to see the environment we will be working with :python  gym/envs/box2d/car_racing .py Note that this needs to be run from the right directory, which should be the directory you cloned from git. If instead of downloading the code from git, you used pip to install it, you will need to go to the correct directory location within your conda files.

3.Identify the actions a human player can use when playing this game. How many are there ?What is the current action space passed to this environment ? (5 pts)

(Hint  :  See the code used to play the game  : https://github.com/openai/gym/blob/ master/gym/envs/box2d/car_racing.py)

4.Implement the function set_action(movement) which will takeina global variable as des- cribed at the top of controllers and set the action. This should be similar to human control, without the keyboard input. You can try replacing the actions with randomly chosen actions and make calls to this new function. Replay the game and report how your car does. (2 pts)

5.Wewantto be able to identify the track and the car from our observation. We can get the observation at the current point in time, after we take a step :

s,  r,  done,  info  =  env .step(a).

Identify each returned value in the above line and what it tells us about the environment. (2 pts) What is the size of the observation ? (2 pts)

6.Defineget_car_pos(img_rgb) incontroller .py which will locate the car in the frame. Hint 1 : You may use CAR_COLOR to help you. Hint 2 : We suggest using libraries such as Open CV to process the image. (10 pt)

7. Defineget_track_pos(img_rgb) incontroller .py which will locate the track in the frame. (10 pts)

8.Nowwe will want to use the information returned from the previous two functions to deter-mine our next action using a pd controller. First, let’s review the basics of control :

a) Inyourown words how would you describe a controller ? (2 pts)

b) What’sthedifference between a bang-bang controller and a PD controller ? (1 pt)

c) Whatabouta PD controller and PID controller ? (1 pt)

d)Write out the formula for computing the PID control variable or action value. Identify each variable and briefly explain its purpose (5 pts).

9. Definepd_controller(track_pos,  car_pos)  incontroller .py.  (10 pts)  This function should take the track position and car position returned from the previously implemen- ted functions and output the action array. This action array will be used when calling env .step(a), so it needs to compatible with what the environment expects. You may ei- ther use the set_action function defined before, or direcctly enter values into your action

10.Describe the parameters you needed to play around with to get a successful implementationon the EasyTrack. (2 pts) A good enough performance should be reaching  500 pts –  700 or until the scene resets (and not because you veered off the board). (10 pts)

Bonus :

1.Define a function pid_controller(track_pos,  car_pos) in controller .py and play around with the parameters needed for good performance (2 pts).

(2 pts) In the comments at the top of the function, describe the difference between this and the previous pd_controller you wrote, and the process of tuning this setup.

(5 pts) If your pid-controller reaches comparable performance as the other function.

2.Now try using the original CarRacing environment, and see how your controller performs. You may run the following to try this out :

python  drive_car_difficult .py

To do this, you will need to define another function in controller.py, named racing_controller(), and swap the call being made to pd_controller with pd_controller_difficult.Feel free to use any additional helper functions or change the information about the environ- ment that you pass in.

(10 pts) To get credit, the car must be able to navigate 2 sharp turns.

bestdaixie

评论已关闭。