Robotics Notes

Robotics (INF-2600)

Introduction to AI in Robotics

  • Robotics Definition: A multidisciplinary field combining mechanical engineering, electronics, computer science, and AI to create autonomous systems. These systems are designed to perceive, decide, and act within the physical world.
  • Intelligence in Robotics: Robots exhibit intelligence when they can adapt, learn, and respond to sensory input rather than merely executing pre-programmed routines.

Embodied Intelligence

  • Embodied AI: This concept shifts from software agents to physical robots, emphasizing intelligence expressed through a physical body that learns via interaction with the real world.
  • Historical Context: Embodied AI's evolution can be traced from early robots like Shakey (1960s) to the advanced robots of Boston Dynamics.

Core Components of an AI Robot

  • Perception:
    • Involves using sensors such as cameras, LiDAR, IMU (Inertial Measurement Unit), and touch sensors.
    • AI enhances perception through object detection, localization, and SLAM (Simultaneous Localization and Mapping).
  • Reasoning and Decision Making:
    • Includes path planning and obstacle avoidance.
  • Learning in Robotics:
    • Utilizes Reinforcement Learning (RL), imitation learning, and Sim2Real techniques.

Introduction to Manipulator Kinematics

  • Inspired by Burton, York University

Robotic Manipulators

  • Definition: A robotic manipulator is a kinematic chain, which is an assembly of rigid bodies connected by joints that allow movement relative to each other through mechanical constraints.
    • Links: The rigid bodies in the manipulator.
    • Joints: The mechanical constraints that allow relative movement between links.

Joints

  • Types of Joints:
    1. Revolute (Rotary):
      • Functions like a hinge, allowing relative rotation about a fixed axis between two links.
      • By convention, the axis of rotation is the z-axis.
    2. Prismatic (Linear):
      • Functions like a piston, allowing relative translation along a fixed axis between two links.
      • By convention, the axis of translation is the z-axis.
  • Joint Convention: Joint ii connects link i1i-1 to link ii. When joint ii is actuated, link ii moves.

Joint Variables

  • Degrees of Freedom (DOF): Revolute and prismatic joints are one degree of freedom joints, described by a single numeric value called a joint variable.
  • Joint Variable Notation: qiq_i represents the joint variable for joint ii.
    1. Revolute:
      • q<em>i=θ</em>iq<em>i = \theta</em>i: Angle of rotation of link ii relative to link i1i-1.
    2. Prismatic:
      • q<em>i=d</em>iq<em>i = d</em>i: Displacement of link ii relative to link i1i-1.

Revolute Joint Variable

  • For a revolute joint, the joint variable q<em>iq<em>i is equal to the angle of rotation θ</em>i\theta</em>i of link ii relative to link i1i-1.

Prismatic Joint Variable

  • For a prismatic joint, the joint variable q<em>iq<em>i is equal to the displacement d</em>id</em>i of link ii relative to link i1i-1.

Common Manipulator Arrangements

  • Most industrial manipulators have six or fewer joints.
    • The first three joints form the arm.
    • The remaining joints form the wrist.
  • Manipulators are often described using the joints of the arm:
    • R: Revolute joint
    • P: Prismatic joint

Articulated Manipulator

  • Configuration: RRR (all three joints are revolute).
  • Joint Axes:
    • z0z_0: Waist
    • z<em>1z<em>1: Shoulder (perpendicular to z</em>0z</em>0)
    • z<em>2z<em>2: Elbow (parallel to z</em>1z</em>1)

Spherical Manipulator

  • Configuration: RRP
  • Example: Stanford arm

SCARA Manipulator

  • Configuration: RRP (revolute-revolute-prismatic)
  • Full Name: Selective Compliant Articulated Robot for Assembly

Forward Kinematics

  • Problem: Given the joint variables and link dimensions, determine the position and orientation of the end effector.

Forward Kinematics - Process

  • Choose the base coordinate frame of the robot.
  • Express the position (x,y)(x, y) in this frame.
  • Link 1 moves in a circle centered on the base frame origin:
    (a<em>1cosθ</em>1,a<em>1sinθ</em>1)(a<em>1 \cos \theta</em>1 , a<em>1 \sin \theta</em>1)
  • Choose a coordinate frame with its origin located on joint 2, oriented the same as the base frame.
  • Link 2 moves in a circle centered on frame 1:
    (a<em>2cos(θ</em>1+θ<em>2),a</em>2sin(θ<em>1+θ</em>2))(a<em>2 \cos(\theta</em>1 + \theta<em>2), a</em>2 \sin(\theta<em>1 + \theta</em>2))
  • Sum the coordinates because the base frame and frame 1 have the same orientation. The position of the end effector in the base frame is:
    (a<em>1cosθ</em>1+a<em>2cos(θ</em>1+θ<em>2),a</em>1sinθ<em>1+a</em>2sin(θ<em>1+θ</em>2))(a<em>1 \cos \theta</em>1 + a<em>2 \cos(\theta</em>1 + \theta<em>2), a</em>1 \sin \theta<em>1 + a</em>2 \sin(\theta<em>1 + \theta</em>2))
  • Determine the orientation of frame 2 with respect to the base frame, expressing x<em>2x<em>2 and y</em>2y</em>2 in terms of x<em>0x<em>0 and y</em>0y</em>0.
    • x<em>2=(cos(θ</em>1+θ<em>2),sin(θ</em>1+θ2))x<em>2 = (\cos(\theta</em>1 + \theta<em>2), \sin(\theta</em>1 + \theta_2))
    • y<em>2=(sin(θ</em>1+θ<em>2),cos(θ</em>1+θ2))y<em>2 = (-\sin(\theta</em>1 + \theta<em>2), \cos(\theta</em>1 + \theta_2))

Inverse Kinematics

  • Problem: Given the position (and possibly the orientation) of the end effector and the link dimensions, determine the joint variables.
  • Challenge: Inverse kinematics is more complex than forward kinematics because there is often more than one possible solution.

Inverse Kinematics - Law of Cosines

  • Using the law of cosines:
    b2=a<em>12+a</em>222a<em>1a</em>2cos(πθ2)=x2+y2b^2 = a<em>1^2 + a</em>2^2 - 2 a<em>1 a</em>2 \cos(\pi - \theta_2) = x^2 + y^2
  • Therefore:
    cos(πθ<em>2)=a</em>12+a<em>22x2y22a</em>1a2\cos(\pi - \theta<em>2) = \frac{a</em>1^2 + a<em>2^2 - x^2 - y^2}{2 a</em>1 a_2}
  • And:
    cos(θ<em>2)=x2+y2a</em>12a<em>222a</em>1a2\cos(\theta<em>2) = \frac{x^2 + y^2 - a</em>1^2 - a<em>2^2}{2 a</em>1 a_2}
  • Let C=x2+y2a<em>12a</em>222a<em>1a</em>2C = \frac{x^2 + y^2 - a<em>1^2 - a</em>2^2}{2 a<em>1 a</em>2}, then cosθ2=C\cos \theta_2 = C
  • Taking the inverse cosine gives only one of two possible solutions.
  • Using trigonometric identities to obtain both solutions:
    sin2θ+cos2θ=1\sin^2 \theta + \cos^2 \theta = 1
    tanθ=sinθcosθ\tan \theta = \frac{\sin \theta}{\cos \theta}
    θ=tan1±1C2C\theta = \tan^{-1} \frac{\pm \sqrt{1 - C^2}}{C}
  • Calculate c<em>2c<em>2 and s</em>2s</em>2:
    c<em>2=(x<em>x+y</em>ya1<em>a1a2</em>a2)/(2<em>a1</em>a2)c<em>2 = (x<em>x + y</em>y – a1<em>a1 – a2</em>a2) / (2<em>a1</em>a2)
    s</em>2=1c2c2s</em>2 = \sqrt{1 – c2*c2}
  • Solutions for θ<em>2\theta<em>2: θ</em>21=atan2(s<em>2,c</em>2)\theta</em>{21} = \text{atan2}(s<em>2, c</em>2)
    θ<em>22=atan2(s</em>2,c2)\theta<em>{22} = \text{atan2}(-s</em>2, c_2)

Spatial Descriptions

Points and Vectors
  • Point: A location in space.
  • Vector: Magnitude (length) and direction between two points.

Coordinate Frames

  • Choosing a frame (a point and two perpendicular vectors of unit length) allows assignment of coordinates.

Dot Product

  • Definition: The dot product of two vectors uu and vv.
    u=[u<em>1 u</em>2  u<em>n],v=[v</em>1 v<em>2  v</em>n]u = \begin{bmatrix} u<em>1 \ u</em>2 \ \vdots \ u<em>n \end{bmatrix}, v = \begin{bmatrix} v</em>1 \ v<em>2 \ \vdots \ v</em>n \end{bmatrix}
    uv=u<em>1v</em>1+u<em>2v</em>2++u<em>nv</em>n=<em>i=1nu</em>ivi=uTvu \cdot v = u<em>1 v</em>1 + u<em>2 v</em>2 + \dots + u<em>n v</em>n = \sum<em>{i=1}^{n} u</em>i v_i = u^T v
    uv=uvcosθu \cdot v = ||u|| ||v|| \cos \theta

Translation

  • Suppose we are given o<em>1o<em>1 expressed in frame 0{0}: 0o</em>1=[3 0]^0o</em>1 = \begin{bmatrix} 3 \ 0 \end{bmatrix}

Translation 1

  • The location of frame 1{1} expressed in frame 0{0}:
    0d<em>1=0o</em>10o0=[3 0][0 0]=[3 0]^0d<em>1 = ^0o</em>1 - ^0o_0 = \begin{bmatrix} 3 \ 0 \end{bmatrix} - \begin{bmatrix} 0 \ 0 \end{bmatrix} = \begin{bmatrix} 3 \ 0 \end{bmatrix}

Translation 2

  • p<em>1p<em>1 expressed in frame 0{0}. 0p=0d</em>1+1p=[3 0]+[1 1]=[4 1]^0p = ^0d</em>1 + ^1p = \begin{bmatrix} 3 \ 0 \end{bmatrix} + \begin{bmatrix} 1 \ 1 \end{bmatrix} = \begin{bmatrix} 4 \ 1 \end{bmatrix}

Translation 3

  • q0q_0 expressed in frame 0{0}.
    0q=0p+0d=[1 1]+[3 0]=[2 1]^0q = ^0p + ^0d = \begin{bmatrix} -1 \ 1 \end{bmatrix} + \begin{bmatrix} 3 \ 0 \end{bmatrix} = \begin{bmatrix} 2 \ 1 \end{bmatrix}

Rotation

  • Suppose that frame 1{1} is rotated relative to frame 0{0} by an angle θ\theta.

Rotation 1

  • The orientation of frame 1{1} expressed in 0{0}. The rotation matrix 0R<em>1^0R<em>1 can be interpreted as the orientation of frame j{j} expressed in frame i{i}. 0R</em>1=[0x<em>11x0y</em>11x 0x<em>11y0y</em>11y]^0R</em>1 = \begin{bmatrix} ^0x<em>1 \cdot ^1x & ^0y</em>1 \cdot ^1x \ ^0x<em>1 \cdot ^1y & ^0y</em>1 \cdot ^1y \end{bmatrix}

Rotation 2

  • p<em>1p<em>1 expressed in frame 0{0}. The rotation matrix 0R</em>1^0R</em>1 can be interpreted as a coordinate transformation of a point from frame j{j} to frame i{i}.
    0p=0R11p=[cosθamp;sinθ sinθamp;cosθ][1 1]^0p = ^0R_1 ^1p = \begin{bmatrix} \cos \theta &amp; - \sin \theta \ \sin \theta &amp; \cos \theta \end{bmatrix} \begin{bmatrix} 1 \ 1 \end{bmatrix}

Rotation 3

  • q0q_0 expressed in frame 0{0}.

    0q=0R10p=[cosθamp;sinθ sinθamp;cosθ][1 1]^0q = ^0R_1 ^0p = \begin{bmatrix} \cos \theta &amp; - \sin \theta \ \sin \theta &amp; \cos \theta \end{bmatrix} \begin{bmatrix} -1 \ 1 \end{bmatrix}

Properties of Rotation Matrices

  • RT=R1R^T = R^{-1}
  • The columns of RR are mutually orthogonal.
  • Each column of RR is a unit vector.
  • detR=1\det R = 1 (the determinant is equal to 1).

Rotations in 3D

  • Rotation matrix in 3D:

0R<em>1=[0x</em>11xamp;0y<em>11x0z</em>11x 0x<em>11y0y</em>11yamp;0z<em>11y 0x</em>11zamp;0y<em>11z0z</em>11z]^0R<em>1 = \begin{bmatrix} ^0x</em>1 \cdot ^1x &amp; ^0y<em>1 \cdot ^1x & ^0z</em>1 \cdot ^1x \ ^0x<em>1 \cdot ^1y & ^0y</em>1 \cdot ^1y &amp; ^0z<em>1 \cdot ^1y \ ^0x</em>1 \cdot ^1z &amp; ^0y<em>1 \cdot ^1z & ^0z</em>1 \cdot ^1z \end{bmatrix}

Reinforcement Learning for Control

  • RL Concepts: State, Action, Reward, Policy, Q-value.
  • Deep RL in Robotics: DDPG (Deep Deterministic Policy Gradient), PPO, SAC (Soft Actor-Critic).
  • Control Types: Model-based vs. Model-free control.
  • Case Studies: OpenAI Gym, MuJoCo, Robosuite.
  • Challenges: Sample inefficiency, safety, real-time learning.

Human-Robot Interaction and Explainable Robotics

  • Human-in-the-loop Systems: Robots that take feedback from humans (e.g., RLHF).
  • Emotion and Intention Recognition: Essential for social and assistive robots.
  • Explainability and Trust in Robotics: Important in healthcare, military, and collaborative settings.
  • Ethical Issues and Biases in Robotic Decisions: Bias in models, decision transparency, responsibility.

Applications and Case Studies

  • Healthcare Robots: Surgical, eldercare.
  • Industrial Automation: Robot arms, warehouses.
  • Autonomous Vehicles and Drones.
  • Humanoids and Social Robots: Pepper, Sophia.
  • Extreme Environments: Space, disaster zones.

Frontiers and Research Challenges

  • Sim2Real gap, continual learning, multi-agent collaboration
  • Embodied intelligence and developmental robotics
  • Open-ended learning and self-repairing robots
  • AI + Robotics + Neuroscience

DARPA Urban Challenge

  • Date: November 3, 2007
  • Objective: Complete a 96 km urban area course in 6 hours.
  • Challenge: Multiple robotic vehicles carry out missions simultaneously on the same course.
  • Basic Rules:
    • Use a stock vehicle.
    • Obey California driving laws.
    • Operate entirely autonomously.
    • Avoid collisions with objects typical of an urban environment.
    • Operate in parking lots.
  • DARPA supplied an environment map with information on lanes, lane markings, stop signs, parking lots, and special checkpoints.

Autonomous Car Driving Sensors

  • Surround View
  • Blind Spot Detection
  • Traffic Sign Recognition
  • Cross Traffic Alert
  • Emergency Braking
  • Adaptive Cruise Control
  • Pedestrian Detection
  • Park Assist
  • Collision Avoidance
  • Eye/Face Tracking
  • Rear Collision Warning
  • Lane Departure Warning
  • Long-Range Radar
  • LIDAR
  • Camera
  • Short/Med-Range Radar
  • Ultrasound

Junior - Autonomous Vehicle

  • Equipped with various sensors:
    • Velodyne laser
    • Riegl laser
    • Applanix INS
    • SICK LMS laser
    • IBEO laser
    • SICK LDLRS laser
    • BOSCH Radar