Skip to main content

Robotics Basics

· 10 min read
Mingtong Zhang
Haoran Geng

Robotics, as an interdisciplinary field, relies on foundational principles of physics, mathematics, control systems, and computer science to create intelligent machines. This guide will introduce the key concepts essential for robotics, covering transformation, dynamics, etc.

Rodrigues' Rotation Formula

Rodrigues' rotation formula provides a simple and efficient way to rotate a vector in 3D around a specified axis by a given angle. Given a unit vector u\mathbf{u} representing the axis of rotation and an angle θ\theta, the formula for rotating a vector v\mathbf{v} is given by:

vrot=vcosθ+(u×v)sinθ+u(uv)(1cosθ)\mathbf{v}_{\text{rot}} = \mathbf{v} \cos \theta + (\mathbf{u} \times \mathbf{v}) \sin \theta + \mathbf{u} (\mathbf{u} \cdot \mathbf{v}) (1 - \cos \theta)

Here, vrot\mathbf{v}_{\text{rot}} is the rotated vector.

This formula elegantly decomposes the rotated vector into three components: a projection along the rotation axis that remains unchanged, a component perpendicular to the axis that rotates in a plane, and a cross-product term to handle rotation-induced perpendicularity.

Prove by Exponential Map

The exponential map approach leverages the mathematical relationship between rotation matrices and the Lie algebra associated with SO(3) (the special orthogonal group in 3D).

  1. Lie Algebra and Exponential Map: In this context, any rotation can be represented as an exponential of a skew-symmetric matrix formed from the axis of rotation u\mathbf{u}. Specifically, the rotation matrix R\mathbf{R} for a rotation by an angle θ\theta around the axis u\mathbf{u} is given by:

    R(θ)=exp(θ[u]×)\mathbf{R}(\theta) = \exp(\theta [\mathbf{u}]_\times)

    Here, [u]×[\mathbf{u}]_\times denotes the skew-symmetric matrix of the unit vector u\mathbf{u}:

    [u]×=[0uzuyuz0uxuyux0][\mathbf{u}]_\times = \begin{bmatrix} 0 & -u_z & u_y \\ u_z & 0 & -u_x \\ -u_y & u_x & 0 \end{bmatrix}
  2. Exponential Series Expansion: We expand exp(θ[u]×)\exp(\theta [\mathbf{u}]_\times) using its Taylor series:

    exp(θ[u]×)=I+sin(θ)[u]×+(1cos(θ))[u]×2\exp(\theta [\mathbf{u}]_\times) = \mathbf{I} + \sin(\theta) [\mathbf{u}]_\times + (1 - \cos(\theta)) [\mathbf{u}]_\times^2

    where $ \mathbf{I} $ is the identity matrix. Applying this matrix to the vector $ \mathbf{v} $, we derive the components of the Rodrigues' formula:

    vrot=(I+sin(θ)[u]×+(1cos(θ))[u]×2)v\mathbf{v}_{\text{rot}} = (\mathbf{I} + \sin(\theta) [\mathbf{u}]_\times + (1 - \cos(\theta)) [\mathbf{u}]_\times^2) \mathbf{v}
  3. Interpretation: This expression matches the form of Rodrigues' rotation formula, breaking the rotation into linear and cross-product terms with respect to the axis u\mathbf{u} and angle θ\theta.

Prove by Geometry

The geometric proof of Rodrigues' rotation formula involves decomposing the vector v\mathbf{v} into parallel and perpendicular components relative to the axis of rotation u\mathbf{u}.

  1. Decomposition of v\mathbf{v}: We first decompose v\mathbf{v} into two components:

    • Parallel component: v=(uv)u\mathbf{v}_{\parallel} = (\mathbf{u} \cdot \mathbf{v}) \mathbf{u}
    • Perpendicular component: v=vv\mathbf{v}_{\perp} = \mathbf{v} - \mathbf{v}_{\parallel}
  2. Rotation of the Perpendicular Component: The perpendicular component v\mathbf{v}_{\perp} lies in the plane orthogonal to u\mathbf{u}. When rotating v\mathbf{v}_{\perp} around u\mathbf{u} by an angle θ\theta, we obtain:

    v,rot=vcosθ+(u×v)sinθ\mathbf{v}_{\perp, \text{rot}} = \mathbf{v}_{\perp} \cos \theta + (\mathbf{u} \times \mathbf{v}_{\perp}) \sin \theta

    Since v=v(uv)u\mathbf{v}_{\perp} = \mathbf{v} - (\mathbf{u} \cdot \mathbf{v}) \mathbf{u}, we can substitute and simplify to get:

    vrot=v+vcosθ+(u×v)sinθ\mathbf{v}_{\text{rot}} = \mathbf{v}_{\parallel} + \mathbf{v}_{\perp} \cos \theta + (\mathbf{u} \times \mathbf{v}) \sin \theta
  3. Combine Components: Adding the parallel component (which remains unchanged during rotation) and the rotated perpendicular component gives the full Rodrigues' formula:

    vrot=(uv)u+(v(uv)u)cosθ+(u×v)sinθ\mathbf{v}_{\text{rot}} = (\mathbf{u} \cdot \mathbf{v}) \mathbf{u} + (\mathbf{v} - (\mathbf{u} \cdot \mathbf{v}) \mathbf{u}) \cos \theta + (\mathbf{u} \times \mathbf{v}) \sin \theta

This geometric decomposition intuitively explains how the rotation occurs in three dimensions around the axis u\mathbf{u} by an angle θ\theta, preserving the properties of length and orthogonality.

Forward and Inverse Kinematics

Kinematics is a fundamental concept in robotics that deals with the motion of robot parts without considering the forces that cause the motion. Two critical types of kinematics are forward kinematics (FK) and inverse kinematics (IK), which define how robots move and interact with their environments.

Forward Kinematics (FK)

Forward kinematics involves computing the position and orientation of a robot's end-effector (e.g., the tip of a robotic arm or gripper) given specific joint angles or displacements. The goal is to determine where the end-effector will be in the robot's workspace when the individual joints are moved in a predefined way. Forward kinematics typically uses transformation matrices, such as Denavit-Hartenberg (DH) parameters, to map joint positions to the corresponding end-effector position and orientation in 3D space.

Example:

Consider a simple two-link robotic arm with two rotational joints. Given the angles of these joints, the forward kinematics computation can determine the precise position of the end-effector relative to the robot's base. This is often represented as a chain of matrix transformations:

  1. Compute Transformations for Each Joint: Each joint's rotation or translation is represented by a transformation matrix.
  2. Chain the Transformations: Multiply the transformation matrices to derive the overall pose (position and orientation) of the end-effector.

Forward kinematics is typically straightforward to compute and results in a unique solution for a given set of joint positions.

Common Packages for Forward Kinematics:

  • ROS (Robot Operating System): ROS offers libraries such as tf and robot_state_publisher to compute FK for robot models described in URDF (Unified Robot Description Format).

  • MoveIt!: This is a powerful motion planning framework in ROS that provides FK capabilities among many other functions.

  • PyBullet: This physics engine for simulating robots offers FK functions for articulated robots.

  • Drake: Developed by MIT, this robotics library includes both FK and IK solvers and is particularly powerful for optimization-based approaches.

Inverse Kinematics (IK)

Inverse kinematics works in the reverse direction: it determines the joint angles or movements needed to place the end-effector at a desired position and orientation. Unlike forward kinematics, IK can be more challenging because there may be multiple possible solutions, no solution, or constraints due to the robot's physical limits, joint boundaries, and obstacles in the environment.

Example:

Suppose you would like to move the end-effector of the same two-link robotic arm to a specific point in space. The inverse kinematics algorithm calculates the angles for each joint required to reach that position. However, depending on the arm's configuration, there could be multiple sets of angles (known as solutions) that achieve the desired end-effector position.

Challenges in Inverse Kinematics:

  • Multiple Solutions: There can be more than one valid way to position the joints for a given end-effector location, especially in complex or redundant systems.
  • No Solutions: Certain desired positions may be outside the robot's reachable workspace, leading to situations where no joint configuration can achieve the target.
  • Constraints and Singularities: Physical constraints (like joint limits) and singularities (positions where the robot loses degrees of freedom or encounters instability) can complicate the solution process.

Inverse kinematics often requires numerical methods, such as Jacobian-based approaches, gradient descent, or optimization algorithms, to find feasible joint angles that meet a target end-effector pose. In some cases, closed-form solutions may exist, providing exact solutions without iterative calculations.

Dynamics in Robotics

Dynamics in robotics deals with understanding the forces and torques that cause motion. Unlike kinematics, which focuses on motion without considering what causes it, dynamics considers the effect of physical quantities like mass, inertia, and external forces. Understanding dynamics is essential for accurately controlling and simulating the behavior of robots, especially when interacting with their environments.

Forward Dynamics

Forward dynamics determines how a robot moves in response to applied forces and torques. Given a set of joint torques or forces, forward dynamics computes the resulting joint accelerations, velocities, and positions over time. This process requires solving the equations of motion that describe the robot's behavior.

Example:

Consider a robotic arm with several joints, each affected by gravity, friction, and external forces like contact with an object. Given the forces applied to the arm's joints, forward dynamics calculates how the arm will accelerate, which in turn determines how it moves through space.

Applications:

  • Simulation: Forward dynamics is widely used in robotic simulators to predict how robots will move and interact with their environments based on physical forces.
  • Motion Planning: By understanding how a robot will respond to forces, planners can generate physically feasible motions.
  • Control: Robots can use forward dynamics to predict future states and adjust control inputs accordingly.

Inverse Dynamics

Inverse dynamics works in the opposite direction: it computes the required forces and torques at each joint to achieve a specified motion. Given a desired trajectory of joint positions, velocities, and accelerations, inverse dynamics calculates the forces or torques necessary to produce that motion. This process is critical for controlling robots accurately and efficiently.

Example: Suppose a robotic arm needs to lift a heavy object along a predefined trajectory. The inverse dynamics approach calculates the torques that each joint motor must exert to follow the trajectory while overcoming gravity, inertia, and any applied loads.

Applications:

  • Control Systems: Inverse dynamics is commonly used in controllers, such as computed torque control, to ensure that the robot follows desired paths accurately.
  • Trajectory Optimization: By determining the forces and torques required to achieve a motion, engineers can optimize trajectories for efficiency or specific objectives, such as minimizing energy consumption.
  • Physical Interaction: Robots interacting with their environment—like pushing, pulling, or carrying objects—rely on inverse dynamics to calculate the appropriate force exertion.

Equations of Motion

The dynamics of a robot are typically described using the Newton-Euler equations or Lagrangian mechanics:

  • Newton-Euler Formulation: This approach uses Newton's laws of motion and Euler's equations for rotational motion to describe the dynamics of each link in the robot's structure. It is particularly effective for calculating joint forces and torques in a recursive manner.

Key Equations:

Linear Motion (Newton's Second Law):

F=ma\mathbf{F} = m \mathbf{a}

where F\mathbf{F} is the net force acting on the body (link). mm is the mass of the body. a\mathbf{a} is the linear acceleration of the body.

Rotational Motion (Euler's Equations):

τ=Iω˙+ω×(Iω)\boldsymbol{\tau} = \mathbf{I} \dot{\boldsymbol{\omega}} + \boldsymbol{\omega} \times (\mathbf{I} \boldsymbol{\omega})

where τ\boldsymbol{\tau} is the net torque acting on the body, I\mathbf{I} is the inertia tensor of the body, ω\boldsymbol{\omega} is the angular velocity, and ω˙\dot{\boldsymbol{\omega}} is the angular acceleration.

The Newton-Euler method typically involves two passes for computation:

  • Forward Recursion: Calculates the velocities and accelerations of each link, starting from the base (root) and moving outward to the end-effector.
  • Backward Recursion: Computes forces and torques required at each joint, starting from the end-effector and moving back toward the base.
  • Lagrangian Formulation: This method uses energy functions (kinetic and potential energy) to derive the equations of motion. The Lagrangian approach often leads to more compact expressions and is useful for analytical modeling of complex systems.
L=KPL = K - P

where KK is the kinetic energy and PP is the potential energy. The equations of motion are derived using the Euler-Lagrange equation:

ddt(Lq˙i)Lqi=τi\frac{d}{dt} \left( \frac{\partial L}{\partial \dot{q}_i} \right) - \frac{\partial L}{\partial q_i} = \tau_i

where qiq_i are the generalized coordinates (e.g., joint positions), q˙i\dot{q}_i are the generalized velocities (time derivatives of qiq_i), and τi\tau_i are the generalized forces or torques.

Key Equations for Energy Calculation:

  • Kinetic Energy:
K=12i=1nmiviTvi+12i=1nωiTIiωiK = \frac{1}{2} \sum_{i=1}^{n} m_i \mathbf{v}_i^T \mathbf{v}_i + \frac{1}{2} \sum_{i=1}^{n} \boldsymbol{\omega}_i^T \mathbf{I}_i \boldsymbol{\omega}_i

where mim_i is the mass of the ii-th link, vi\mathbf{v}_i is the linear velocity of the ii-th link, ωi\boldsymbol{\omega}_i is the angular velocity of the ii-th link, and Ii\mathbf{I}_i is the inertia tensor of the ii-th link.

  • Potential Energy:
P=i=1nmighiP = \sum_{i=1}^{n} m_i g h_i

where gg is the gravitational constant and hih_i is the height of the ii-th link in the gravitational field.

Challenges in Dynamics

  • Nonlinearity: Robot dynamics are inherently nonlinear, particularly for systems with many degrees of freedom or under the influence of significant external forces.
  • Complexity and Computation: Computing dynamics can be computationally expensive, especially for high-degree-of-freedom robots or real-time applications.
  • Contact and Friction: Dynamics calculations must account for interactions with the environment, such as contact forces and friction, which can introduce discontinuities and complexity in modeling.