Sale!

ECE 276 Assignment 1 : Classical Control solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (3 votes)

In this assignment, you will implement and tune a trajectory following controller for a 2-
degree of freedom(DoF) robotic arm and a race car. The most common structure is the
gym environment used by OpenAI(Read through https://gym.openai.com/docs/ the page
for more details.)
Note: Before starting the assignment, make sure you have downloaded and installed the
necessary packages for setting up the environment.
Question 1 – 2 DoF Arm
To import the environment use the following command:
import gym
import pybulletgym . envs
env = gym . make ( ” ReacherPyBulletEnv−v0” )
Figure 1: 2 DoF Arm
Figure 2: Arm Trajectory: The (x, y) point is
given by x = (0.19 + 0.02cos(4θ))cos(θ), y =
(0.19 + 0.02cos(4θ))sin(θ) for θ ∈ [−π, π]
The action space of environment is [τq0
, τq1
], where τq0 and τq1 are the joint torques to joint
q0 and q1 respectively.The links l0 and l1 are 0.1m and 0.11m respectively. Rather than using
the observation space of the environment, use the following class methods to get the states
of the robot.
env = gym . make (” ReacherPyBulletEnv−v0 ” )
1 ECE 276
# To s e t j o i n t q0 to a p a r t i c u l a r p o s i t i o n
env . unwrapped . ro bo t . c e n t r a l j o i n t . r e s e t p o s i t i o n ( p o si ti o n , 0 )
# To s e t j o i n t q1 to a p a r t i c u l a r p o s i t i o n
env . unwrapped . ro bo t . e l b o w j o i n t . r e s e t p o s i t i o n ( p o si ti o n , 0 )
# To g e t the c u r r e n t p o s i t i o n and a ng ula r v e l o c i t y of q0
q0 , q0 do t = env . unwrapped . ro bo t . c e n t r a l j o i n t . c u r r e n t p o s i t i o n ( )
# To g e t the c u r r e n t p o s i t i o n and a ng ula r v e l o c i t y of q1
q1 , q1 do t = env . unwrapped . ro bo t . e l b o w j o i n t . c u r r e n t p o s i t i o n ( )
1. Using the robot model paramters, write a function getForwardModel(q0,q1) that takes
the joint states and returns the end-effector position.
2. Write a function getJacobian(q0,q1) that takes the joint states and returns the jacobian.
3. Using the help of the above two functions, write a function getIK that returns the joint
angles corresponding to a given target position.
4. Implement a closed loop PD-controller that controls the robot along the given trajectory(Figure 2) using the error in the end-effector as the input signal(keep vref = 0) .
Plot the trajectory of the robot juxtaposed over the required trajectory and calculate
the mean square error between both paths.
5. Implement a closed loop PD-controller that controls the robot along the given trajectory(Figure 2) using the error in the joint-angles as the input signal(keep vref = 0).
Plot the trajectory of the robot juxtaposed over the actual trajectory and caluclate
the mean square error between both paths.
Question 2 – Race Car
The objective of this environment is to make the race car complete a trajectory within the
given time. There are 3 tracks available – FigureEight, Linear and Circle, each having its
corresponding horizon length. To set up an environment with a particular track, you can
pass the track name while instantiating the environment. For example, to set up the figure
eight trajectory :
from r a c e c a r . SDRaceCar import SDRaceCar
env = SDRaceCar ( r e n d e r e n v=True , t ra c k=’ Fig u r eEig h t ’ )
The action space of the environment consists of [wheel angle, thrust]. The range of both these
inputs are normalized to be between ±1.The observation space consists of [x,y,θ,vx,vy,
˙θ,h],
where (x,y,θ) is the inertial frame position of the car and vx, vy is the longitudinal and lateral
velocities respectively ,and ˙θ is the angular rotation of the car. h is the co-ordinate on the
track the car has to reach. Using these observations implement a controller that can traverse
all three tracks, in the given amount of time. Plot the trajectory of the car juxtaposed over
the actual trajectory.
2 ECE 276