Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Now, run your open loop controller on a Unicycle with both process & sensor noise. Your open - loop control sequence probably does not drive
Now, run your open loop controller on a Unicycle with both process & sensor noise. Your openloop control sequence probably does not drive
the system to the goal anymore. This is to be expected! It's like trying to park a car in a parking spot with your eyes closed. We will implement a
much smarter strategy next.
nprandom. seed
maxnumsteps
env gymnasium. makegymneuracingNEUEmptyWorldvo
# Add both sensor noise & process noise to make the problem more challenging
env NoisyStateFeedbackWrapperenv
env. unwrapped. motionmodel NoisyUnicycle
obs, env.reset # initial observation of the system's state vector
observationhistory obs
# query your open loop controller based on the initial state of the system
controlsequence openloopcontrolpolicyobs env.goal, numstepsmaxnumsteps
# Now that we've computed the control sequence, run the system forward until
# we reach maxnumsteps or the system's state is close to the goal
for step in rangemaxnumsteps:
action controlsequence step
obs, terminated,, env.stepaction
observationhistory.appendobs
if terminated:
break
# Generate a simple plot of the path taken
plotpathenv observationhistory
if terminated:
printSuccess Your openloop controller drove the system to the goal.
else:
printYour openloop controller did not successfully drive the system to the goal.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started