Introduction to Robotics
Kinematics, dynamics, control, motion planning, and robot manipulation.
Introduction to Robotics and Kinematics
What is Robotics? Robotics is the study of machines that sense, plan, and act in the physical world. Robots combine: Mechanical systems: joints, links, actuators Sensors: cameras, IMUs,...
What is Robotics?
Robotics is the study of machines that sense, plan, and act in the physical world. Robots combine:
- Mechanical systems: joints, links, actuators
- Sensors: cameras, IMUs, force/torque, tactile
- Computation: perception, planning, control
Robotics integrates mechanical engineering, electrical engineering, computer science, and AI.
Types of Robots
- Manipulators: industrial arms (6-DOF typical)
- Mobile robots: wheeled, legged, aerial, aquatic
- Humanoids: bipedal, complex dynamics
- Swarm robots: many simple units
- Soft robots: compliant, safe for humans
- Medical robots: surgery, rehabilitation
Each has unique challenges.
Degrees of Freedom (DOF)
The number of independent parameters describing the configuration.
- 2D planar arm with 2 joints: 2 DOF
- 3D arm with 6 joints: 6 DOF (enough to reach any pose)
- 6-DOF + gripper: 7 DOF
More DOF = more flexibility, but also more complexity.
Kinematics
Forward kinematics (FK): given joint angles, compute end-effector pose.
Inverse kinematics (IK): given desired pose, compute joint angles.
FK is straightforward (matrix multiplication). IK is hard (may have 0, 1, or many solutions).
Rigid Body Transformations
A pose in 3D has 6 DOF: position (x, y, z) + orientation (roll, pitch, yaw).
Rotation matrix R (3×3): orthogonal, det = +1.
Homogeneous transform T (4×4):
T = [ R p ]
[ 0 1 ]
Where p is position and R is orientation.
Composing transforms: T_total = T1 × T2 × T3 for a serial chain.
Forward Kinematics Example
For a planar 2-link arm with lengths L1, L2 and angles θ1, θ2:
x = L1 cos(θ1) + L2 cos(θ1 + θ2)
y = L1 sin(θ1) + L2 sin(θ1 + θ2)
Simple trig. For longer chains, matrix multiplication.
Denavit-Hartenberg (DH) Parameters
A standard convention for assigning frames to robot links.
Four parameters per link:
- θ (joint angle, revolute)
- d (link offset, prismatic)
- a (link length)
- α (link twist)
With a DH table, FK is a product of 4×4 matrices.
Workspace and Reachability
The workspace is the set of poses the end-effector can reach.
- Reachable workspace: at least one IK solution
- Dexterous workspace: end-effector can achieve any orientation
For a 2-link arm, reachable workspace is an annulus (ring) with inner radius |L1 - L2| and outer radius L1 + L2.
Jacobian
The Jacobian matrix J relates joint velocities to end-effector velocity:
ẋ = J(q) × q̇
Where ẋ is end-effector velocity (6D), q̇ is joint velocity (n), and J is 6×n.
For a redundant robot (n > 6), J is rectangular. Uses:
- Velocity control: given desired ẋ, solve for q̇ = J⁻¹ ẋ (if square and invertible)
- Singularities: det(J) = 0 → loss of DOF, infinite joint velocities
- Statics: τ = J^T F, joint torques for end-effector force
Singularities
Configuration where Jacobian loses rank. Common types:
- Boundary singularity: arm fully extended
- Interior singularity: axes align
Behavior near singularity: infinite joint velocities for finite end-effector motion. Controllers must handle (damping, avoid).
Redundancy
When n > 6, robot is redundant. Infinite IK solutions. Use extra DOF for:
- Obstacle avoidance
- Joint limit avoidance
- Optimal pose (minimize energy)
- Singularity avoidance
Resolved via null-space projection: q̇ = J⁺ ẋ + (I - J⁺J) z, where z is a secondary objective.
Key Takeaways
- Robotics integrates mechanical, electrical, CS, AI
- DOF = number of independent joints
- FK: joint angles → pose (easy)
- IK: pose → joint angles (hard, multiple solutions)
- Homogeneous transforms compose kinematics
- DH parameters standardize link frames
- Jacobian relates velocities
- Singularities lose DOF
- Redundancy enables secondary goals
Dynamics and Equations of Motion
Why Dynamics? Kinematics describes motion. Dynamics describes the forces and torques that cause motion. For control, we need dynamics. Newton's second law in robot form: τ = M(q) q̈ + C(q, q̇) q̇...
Why Dynamics?
Kinematics describes motion. Dynamics describes the forces and torques that cause motion. For control, we need dynamics.
Newton's second law in robot form: τ = M(q) q̈ + C(q, q̇) q̇ + g(q) + friction
Where:
- M(q): mass matrix (positive definite, symmetric)
- C(q, q̇): Coriolis and centrifugal terms
- g(q): gravity vector
- friction: joint friction (viscous + Coulomb)
This is the equation of motion for a robot manipulator.
Lagrangian Formulation
Derive equations from energy:
L = T - V (kinetic - potential)
d/dt (∂L/∂q̇) - ∂L/∂q = τ
This yields the equations of motion systematically. Works for any mechanical system.
Newton-Euler Formulation
Recursive algorithm using Newton's laws on each link. Two passes:
- Forward pass: velocities and accelerations from base to tip
- Backward pass: forces and torques from tip to base
Efficient for real-time control (O(n) instead of O(n³) for Lagrangian).
The Mass Matrix
M(q) is symmetric, positive definite. It generalizes "mass" to multiple joints.
For a 2-link planar arm, M is 2×2 with entries involving link masses, inertias, and cos(θ2).
Off-diagonal terms mean joint 1's acceleration depends on joint 2's motion.
Coriolis and Centrifugal
C(q, q̇) q̇ captures:
- Centrifugal: velocity-squared terms
- Coriolis: cross-velocity terms
For fast robots, these dominate. Slow robots can ignore them.
Gravity
g(q) is the torque required to hold the robot against gravity. For each joint, depends on configuration.
For a revolute joint holding a link of mass m at distance r: τ_gravity = m g r cos(θ).
Important for gravity compensation in controllers.
Computing Dynamics
Three main algorithms:
- Lagrangian (symbolic): derive equations, implement directly. Inefficient for n > 4.
- Newton-Euler (recursive): O(n) algorithm. Standard for real-time.
- Composite Rigid Body: O(n²) for mass matrix, used in advanced control.
Libraries: RBDL, Pinocchio, Drake implement these efficiently.
Forward Dynamics
Given joint torques τ, compute accelerations q̈:
q̈ = M⁻¹(q) (τ - C(q, q̇) q̇ - g(q) - friction)
This is used in simulation: integrate q̈ to get velocities and positions.
Cost: inverting M is O(n³) per timestep. Newton-Euler solves it in O(n).
Inverse Dynamics
Given desired accelerations q̈, compute required torques:
τ = M(q) q̈ + C(q, q̇) q̇ + g(q)
Used in feedforward control: compute torques to achieve a trajectory.
Control with Dynamics
PD control: τ = Kp (q_d - q) + Kd (q̇_d - q̇). Simple, but gravity sags.
Computed torque (inverse dynamics): τ = M (q̈_d + Kd ė + Kp e) + C q̇ + g. Perfect tracking if model is exact.
Adaptive control: estimate parameters online.
Robust control: handle model uncertainty.
Impedance and Admittance Control
Impedance: robot behaves like a spring-damper. τ = K (x_d - x) + D (ẋ_d - ẋ).
Admittance: robot responds to external force as if it had mass. Used in collaborative robots (cobots).
Important for safe human-robot interaction.
Simulation
Physics engines solve forward dynamics:
- Gazebo: ROS standard, general robotics
- MuJoCo: fast, contact-rich, reinforcement learning
- PyBullet: Python, easy to use
- Drake: MIT, optimization-focused
- Isaac Sim: NVIDIA, GPU-accelerated, photorealistic
Simulation is essential for testing before real-world deployment.
Contact Dynamics
When robot touches the environment:
- Rigid contact: hard constraint, impulsive forces
- Compliant contact: springs between surfaces
- Friction: Coulomb model, stick-slip
Contact is hard to simulate accurately. Modern engines use convex optimization (Drake) or impulse-based methods.
Learning Dynamics
Neural networks can learn dynamics from data:
- Feedforward NN: predict next state from current state + action
- Long Short-Term Memory: handle history
- Physics-informed NN: incorporate known physics
Used in model-based RL and adaptive control.
Key Takeaways
- Dynamics: forces cause motion (τ = M q̈ + C q̇ + g)
- Lagrangian: energy-based derivation
- Newton-Euler: recursive, O(n)
- Mass matrix, Coriolis, gravity
- Forward dynamics: torques → accelerations
- Inverse dynamics: accelerations → torques
- Control: PD, computed torque, impedance
- Simulation essential for testing
- Contact dynamics is hard
Trajectory Planning and Motion Control
Why Trajectory Planning? A robot must move from point A to point B smoothly. Joint trajectories must be: Continuous (no jumps) Smooth (continuous velocity, ideally acceleration) Within joint limits...
Why Trajectory Planning?
A robot must move from point A to point B smoothly. Joint trajectories must be:
- Continuous (no jumps)
- Smooth (continuous velocity, ideally acceleration)
- Within joint limits
- Avoiding obstacles
Joint Space vs Task Space
Joint space: plan in joint angles. Simple, but end-effector path is unpredictable.
Task space: plan end-effector path, then IK to joints. More intuitive, but IK can have issues.
Hybrid: plan in joint space with waypoints in task space.
Point-to-Point Motion
Simple case: move from q_start to q_goal.
Linear interpolation: q(t) = q_start + (q_goal - q_start) × (t/T).
Problem: discontinuity in velocity at start and end → infinite acceleration.
Polynomial Trajectories
Cubic polynomial: q(t) = a0 + a1 t + a2 t² + a3 t³.
Boundary conditions: q(0) = q_start, q(T) = q_goal, q̇(0) = q̇(T) = 0.
Four constraints → four coefficients.
Quintic polynomial: adds q̈ boundary conditions for smooth acceleration. Used in high-precision applications.
Trapezoidal Velocity Profile
Constant acceleration, then constant velocity, then constant deceleration.
Velocity: rises linearly, holds, falls linearly.
Position: S-curve.
Popular for industrial robots. Ensures smooth motion with bounded acceleration.
S-Curve Profile
Further smooths the jerk (derivative of acceleration):
Acceleration is trapezoidal, jerk is bounded. Smoothest but slowest.
Used in CNC machines, pick-and-place.
Multi-Waypoint Trajectories
Spline through waypoints. B-splines are popular: local control, smooth, stay near control points.
For a sequence of waypoints q0, q1, ..., qn, fit a B-spline. Each segment connects adjacent waypoints with C² continuity.
Obstacle Avoidance
If there are obstacles, plan a collision-free path.
Potential fields: attract to goal, repel from obstacles. Simple but can get stuck in local minima.
RRT (Rapidly-exploring Random Tree): random sampling, tree growth. Probabilistically complete.
**RRT*: asymptotically optimal version.
PRM (Probabilistic Roadmap): build graph in free space, search it.
A*: grid-based search, optimal if heuristic is admissible.
Trajectory optimization: minimize cost (time, energy) subject to constraints. Direct collocation, direct shooting.
Trajectory Optimization
Formulate as optimization:
minimize ∫ L(q, q̇, q̈) dt
subject to: dynamics, joint limits, obstacle constraints
Methods:
- Direct collocation: discretize time, solve NLP
- Direct shooting: parameterize controls, simulate
- CHOMP, STOMP: gradient-based smoothing
Tools: TrajOpt, Drake, CasADi.
Feedback Control
Open-loop trajectories fail with disturbances. Feedback corrects in real time.
PID per joint: simple, effective for stiff robots.
Computed torque: uses full dynamics for high performance.
Model Predictive Control (MPC): solve optimization at each timestep, apply first control. Handles constraints.
Learning-based: neural network policies trained via RL or imitation.
Impedance Control
Instead of tracking a trajectory, control the robot's interaction dynamics:
F = M_d (ẍ_d - ẍ) + B_d (ẋ_d - ẋ) + K_d (x_d - x)
Robot behaves like a mass-spring-damper. Useful for:
- Assembly (peg-in-hole)
- Polishing, grinding
- Human collaboration
Force Control
When the robot interacts with the environment, position control fails. Use force control:
Direct force control: measure force, control to desired.
Hybrid: position in some directions, force in others.
Admittance: measure force, respond with motion.
Used in:
- Deburring, grinding
- Surgery
- Human-robot collaboration
- Legged robots (foot contact)
Real-Time Constraints
Control loops must run at fixed rates:
- Position: 1 kHz typical
- Force: 1-10 kHz
- Impedance: 1 kHz
Missed deadlines cause instability. Use real-time OS or dedicated hardware.
ROS and Motion Planning
ROS (Robot Operating System) is the standard framework:
- MoveIt: motion planning library
- ROS Control: controller management
- TF: coordinate transforms
- RViz:** visualization
Nodes communicate via topics, services, actions.
Key Takeaways
- Trajectory: smooth, feasible joint paths
- Polynomials for point-to-point
- Trapezoidal and S-curve profiles
- Splines for multi-waypoint
- Obstacle avoidance: RRT, PRM, optimization
- Feedback control: PID, computed torque, MPC
- Impedance/force control for interaction
- Real-time: fixed loop rates
- ROS + MoveIt for practical planning
Perception: Sensors and State Estimation
Why Perception? A robot must know its state (position, velocity) and environment (obstacles, objects). Sensors provide measurements; estimation fuses them into a coherent picture. Common Sensors...
Why Perception?
A robot must know its state (position, velocity) and environment (obstacles, objects). Sensors provide measurements; estimation fuses them into a coherent picture.
Common Sensors
Encoders: measure joint angles. High precision, direct.
IMU (Inertial Measurement Unit): accelerometer + gyroscope (+ magnetometer). Measures orientation and acceleration. Drifts over time.
Cameras: RGB, depth (stereo, structured light, ToF), event. Rich data, computationally heavy.
LiDAR: 2D or 3D scanning. Accurate range, expensive. Used in autonomous vehicles.
GPS: global position, ~1 m accuracy (worse in urban canyons).
Force/torque sensors: measure interaction forces. Essential for manipulation.
Tactile sensors: contact, pressure. Growing area.
Ultrasonic: cheap range sensing, low resolution.
Sensor Characteristics
- Accuracy: how close to truth
- Precision: repeatability
- Range: min/max measurable
- Resolution: smallest change detected
- Bandwidth: how often updated
- Noise: random error
- Bias: systematic error
Every sensor has trade-offs. Fusion combines complementary strengths.
State Estimation
Estimate the robot's state (pose, velocity) from noisy measurements.
Bayes filter: probabilistic framework. Maintain belief over state.
Kalman filter: optimal for linear Gaussian systems.
Predict: x̂ = F x̂ + B u; P = F P F^T + Q
Update: K = P H^T (H P H^T + R)^-1
x̂ = x̂ + K (z - H x̂)
P = (I - K H) P
Where F is dynamics, H is measurement, Q and R are noise covariances.
Extended Kalman Filter (EKF)
For nonlinear systems, linearize around current estimate.
F = ∂f/∂x |_{x̂}
H = ∂h/∂x |_{x̂}
Standard in robotics for years.
Unscented Kalman Filter (UKF)
Better for strongly nonlinear systems. Uses sigma points (deterministic samples) propagated through the nonlinear function.
More accurate than EKF at similar cost.
Particle Filter
Represent belief as a set of weighted samples (particles).
- Predict: sample each particle through dynamics
- Update: weight by measurement likelihood
- Resample: pick particles proportional to weight
Handles multimodal distributions. Used in SLAM (Monte Carlo Localization).
SLAM (Simultaneous Localization and Mapping)
Chicken-and-egg problem: to localize, need a map; to build a map, need to know location.
Solutions:
- EKF-SLAM: joint estimation of robot and landmarks.
- FastSLAM: particle filter for robot, EKF for landmarks.
- GraphSLAM: poses and landmarks as nodes in a graph; solve optimization.
- Visual SLAM: ORB-SLAM, LSD-SLAM use cameras.
Modern SLAM is mature — used in robots, drones, AR/VR.
Sensor Fusion Examples
Drone pose: IMU (fast, drifts) + GPS (slow, no drift) + barometer + magnetometer → EKF.
Self-driving car: LiDAR + cameras + radar + GPS + IMU → Kalman / particle.
Mobile robot: wheel encoders + IMU + LiDAR → EKF SLAM.
Fusion benefits: better accuracy, robustness to sensor failure, higher rate.
Deep Learning for Perception
Classical methods struggle with complex scenes. Neural networks excel:
- Object detection: YOLO, Faster R-CNN
- Semantic segmentation: U-Net, DeepLab
- Depth estimation: stereo matching, monocular depth
- Pose estimation: OpenPose, MediaPipe
- SLAM features: SuperPoint, DROID-SLAM
Training data: real (expensive), synthetic (free from simulators), self-supervised.
Sensor Calibration
Sensors have intrinsics (internal) and extrinsics (relative poses).
Camera intrinsics: focal length, principal point, distortion. Calibrate with a checkerboard (Zhang's method).
Extrinsics: camera to IMU, camera to LiDAR. Calibrate by observing known patterns.
Poor calibration ruins fusion. Invest in this.
Key Takeaways
- Robots need to know their state and environment
- Many sensors, each with trade-offs
- Bayes filter for probabilistic estimation
- Kalman filter: linear Gaussian optimal
- EKF, UKF for nonlinear
- Particle filter for multimodal
- SLAM: joint localization and mapping
- Sensor fusion combines complementary sensors
- Deep learning for complex perception
- Calibration is critical
Manipulation and Grasping
Why Manipulation? Moving objects is fundamental to robots in manufacturing, logistics, surgery, home assistance. It's hard: contact, friction, uncertainty. Grasp Types Power grasp: entire hand...
Why Manipulation?
Moving objects is fundamental to robots in manufacturing, logistics, surgery, home assistance. It's hard: contact, friction, uncertainty.
Grasp Types
- Power grasp: entire hand wraps object. Stable, no fine control.
- Precision grasp: fingertips pinch. Fine control, less stable.
- Pinch, tripod, spherical: various taxonomies.
Choice depends on task and object.
Grasp Quality
Metrics:
- Force closure: can resist arbitrary external forces via contact forces
- Form closure: geometric constraint, no friction needed
- Grasp isotropy: uniform manipulation in all directions
- Stability margin: how far from slipping
Optimize grasps for robustness.
Contact Modeling
Rigid body contact with Coulomb friction:
|F_t| ≤ μ |F_n|
Tangential force bounded by normal force times friction coefficient.
Contact state: sticking (no slip), sliding (tangential force at limit).
Compliant contact (soft finger): elastic model, force proportional to deformation.
Grasp Planning
Analytical: given object model and gripper, compute force-closure grasps. Requires exact geometry.
Data-driven: learn from simulation or demonstrations. Handles uncertainty.
Sampling-based: generate random contacts, evaluate, keep good ones.
Deep learning: DexNet, GraspNet predict grasp quality from vision.
Underactuated Hands
More DOF than actuators. Examples: tendon-driven, adaptive grippers.
Benefits: compliance, simplicity, robustness to uncertainty.
Cost: less control, complex dynamics.
Dexterous Manipulation
Multi-finger hands (like human) can manipulate within the hand.
Challenges:
- High DOF (20+)
- Contact state changes
- Tactile sensing required
- Complex dynamics
Applications: tool use, in-hand reorientation, assembly.
Task and Motion Planning (TAMP)
Combines symbolic task planning (what to do) with motion planning (how to move).
Example: "put the cup on the shelf" →
- Move arm near cup
- Grasp cup
- Lift
- Move to shelf
- Place
- Release
Each step has motion constraints. TAMP integrates them.
Learning Manipulation
Imitation learning: record human demonstrations, learn policy. DAgger, behavior cloning.
Reinforcement learning: reward-based trial and error. Sample inefficient, but powerful.
Sim-to-real: train in simulation, transfer to real robot. Domain randomization handles the gap.
Self-supervised: robot generates its own data. Grasping, pushing, opening.
Real-World Manipulation Systems
- Amazon Picking Challenge: pick items from shelves.
- Dexterity: OpenAI's Rubik's cube, in-hand manipulation.
- Cooking: PR2, Mobile ALOHA cook meals.
- Surgery: da Vinci, autonomous suturing.
- Warehouse: Kiva, Fetch robots.
Each has unique constraints.
Force Control in Manipulation
When contact is critical, use force control:
Impedance: robot behaves like spring-damper, compliant to environment.
Admittance: sense force, command motion.
Hybrid: position in free directions, force in contact directions.
Used for peg-in-hole, polishing, assembly.
Assembly Tasks
Peg-in-hole: classic. Challenges: tight tolerances, chamfers, jamming.
Solutions:
- Compliance (RCC, remote center compliance)
- Force feedback + search
- Learning from demonstration
- Reinforcement learning
Snap-fit: plastic parts with interlocking features. Requires force profile.
Screwing: rotation + force control.
Grippers
- Parallel jaw: simple, versatile, most common
- Vacuum: flat surfaces, no residual marks
- Magnetic: ferrous objects
- Soft grippers: delicate objects (fruit, glass)
- Universal gripper: granular jamming, adapts to shape
Choose based on object variety and cycle time.
Key Takeaways
- Manipulation: moving objects with contact
- Grasp quality: force closure, stability
- Contact modeling with friction
- Grasp planning: analytical or learned
- Dexterous manipulation challenges
- TAMP combines task and motion planning
- Learning: imitation, RL, sim-to-real
- Force control for contact-rich tasks
- Assembly, screwing, snap-fit
- Gripper choice depends on task
📝 Problem Set 1: Kinematics, Jacobian, Dynamics
Q1. For a 2-link planar arm with L1 = L2 = 1, θ1 = 30°, θ2 = 60°, compute the end-effector position.
Show Solution
x = 1×cos(30°) + 1×cos(90°) = 0.866 + 0 = 0.866. y = sin(30°) + sin(90°) = 0.5 + 1 = 1.5. Position: (0.866, 1.5).
Q2. Compute the Jacobian of the 2-link arm at θ1 = θ2 = 0.
Show Solution
At θ1=θ2=0: J = [[0, 0], [L1+L2, L2]] = [[0, 0], [2, 1]]. Rank = 1 (not 2) → singularity! Arm fully extended.
Q3. A mobile robot has a differential drive with wheel radius r = 0.1 m, wheelbase L = 0.5 m. If left wheel speed = 1 m/s and right = 1.5 m/s, find linear and angular velocity of the robot.
Show Solution
v = (1 + 1.5)/2 = 1.25 m/s. ω = (1.5 - 1)/0.5 = 1 rad/s. Turning left.
🎯 Midterm 1: Kinematics, Dynamics, Control
Q1. For a 2-link arm with masses m1=m2=1kg, lengths L1=L2=1m, in horizontal plane (no gravity), compute the mass matrix at θ = (0, 0).
Show Solution
M11 = m1 L1²/3 + m2 (L1² + L1 L2 cos θ2 + L2²/3) = 0.333 + (1 + 1 + 0.333) = 2.667. M12 = m2 (L2²/3 + L1 L2 cos θ2 / 2) = 0.333 + 0.5 = 0.833. M22 = m2 L2²/3 = 0.333. M = [[2.667, 0.833], [0.833, 0.333]].
Q2. Design a PD controller for a joint with inertia J = 0.1 kg·m², target natural frequency ω_n = 10 rad/s, damping ratio ζ = 0.7. Compute Kp and Kd.
Show Solution
For J·θ'' + Kd·θ' + Kp·θ = 0: ω_n = √(Kp/J) = 10 → Kp = 100 × 0.1 = 10. 2ζω_n = Kd/J → Kd = 2 × 0.7 × 10 × 0.1 = 1.4.
Q3. Explain the difference between computed torque control and PD control. When is each appropriate?
Show Solution
PD: τ = Kp e + Kd ė. Simple, doesn't use dynamics. Works for stiff robots, slow motions. Computed torque: τ = M(q)(q̈_d + Kd ė + Kp e) + C q̇ + g. Uses full dynamics — cancels nonlinearities. Better for fast, accurate motions or light robots. Requires accurate dynamic model.