Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 a ) Run the baseline simulator & generate a plot Here's an example of how to run the simulator for a few timesteps. In

1a) Run the baseline simulator & generate a plot
Here's an example of how to run the simulator for a few timesteps. In this assignment, we told the simulator to return the true state of the
environment (in future assignments, we'll only give noisy sensor data).
In this problem, you should make a plot of the system's state over time. This will be helpful as you debug future parts of the assignment. This
part uses the Unicycle kinematic model that's built into the simulator.
Deliverables:
Implement the plot_path method. At a minimum, you should plot the (x,y) position over time (the first 2 elements of the state vector).
You are welcome to add other capabilities to your plot_path function as you go through the assignment (e.g., visualizing the heading
angle and/or the goal coordinate), but this is not necessary for this part. You probably should make your axes have the same scale (e.g.,
using plt.axis ('equal')).
[] def plot_path(env: gymnasium.Env, observation_history: list[np.ndarray]) None:
## Your Implementation Here ##
raise NotImplementedError
[] def dummy_unicycle_controller(current_state: np.ndarray) np.ndarray:
return np.array([3.,0.2]) # [linear speed, angular speed]
def simulate_n_steps(env: gymnasium.Env, num_steps: int, controller: Callable):
observation_history =[]
observation_history.append (obs)
print(f"initial state: {obs}")
# run the simulator for a few steps and see how the state evolves
for _ in range (num_steps):
action = controller(obs)
obs, _, terminated, ,,_= env.step(action)
observation_history.append (obs)
print (f"current state: {obs}")
if terminated:
break
return observation_history
[] # Tell the simulator to its built-in kinematic model
env.unwrapped. motion_model = gym_neu_racing. motion_models.Unicycle()
# Run the simulation and plot the path taken
num_steps =10
observation_history = simulate_n_steps(env, num_steps, dummy_unicycle_controller)
plot_path(env, observation_history)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago