Robot control & MDPs
Robot control
Section titled “Robot control”Mathematical representation of robot motion
Section titled “Mathematical representation of robot motion”Robots come in a wide variety of morphologies. How can we control them? We assume robots are rigid bodies and robot motion can be represented as rigid-body motion. Rigid body means that any two points on the robot maintain a constant distance. As such, we only have to track one point on the robot instead of multiple.

To represent robot motion mathematically or in code, we use homogeneous transformation matrices.
SE(2): 3 degrees of freedom
SE(3): 6 degrees of freedom
In order for these to be valid rotation matrices, they must satisfy the following properties:
- The matrices must be orthogonal, meaning that the transpose of the matrix is equal to its inverse.
- The determinant of the rotation matrix must be equal to 1, which ensures that it represents a proper rotation without any scaling or reflection.
Why do we care about these rotation matrices? It’s so that we can chain transformations together to determine an object’s position in the base frame given its position in some sensor’s frame.

Robot embodiment
Section titled “Robot embodiment”However, robot is not a single solid body. Most humanoids have links (rigid parts) that are connected by joints (which allow for relative motion between the links), and end effectors (which are the parts of the robot that interact with the environment, such as hands or grippers). To find out the position of the end effector in the base frame, we can apply the transform chaining technique above.
For robot arms, Franka is a typical example of a 7 degree of freedom robot arm.

For effectors, suction grippers, parallel grippers, and dexterous hands are common types.

Hard-coded geometry vs learned representations
Section titled “Hard-coded geometry vs learned representations”Intuition: Motion planning in C-space quickly becomes intractable as the number of degrees of freedom increases. In modern robot learning, we don’t want to have perfect world information, we want to learn a policy that can learn to feel where the obstacles are implicitly and recognizing automatically invalid states.
Task space: the manifold in which the robot’s task is naturally defined, independent of its embodiment. If task space dimension is less than the robot’s degree of freedom, then the robot is redundant. If task space dimension is greater than the robot’s degree of freedom, then the robot is underactuated.
Example: task is whiteboard cleaning, task space is whiteboard surface
Example: Franka’s arm C-space, workspace, and task space

Example of redundancy leading to null space motion: a Franka arm holding a cup of coffee can move its elbow without affecting the position of the cup. This is called null space motion, and it can be used to optimize for secondary objectives such as avoiding obstacles or minimizing energy consumption.
Forward and inverse kinematics
Section titled “Forward and inverse kinematics”Forward kinematics: given the robot’s joint angles, compute the position of the end effector in the base frame. This process is straightforward and can be done by chaining together the transformations from the base frame to the end effector frame.
- Maps from C-space to task space,
- Deterministic, but not bijective (multiple joint configurations can lead to the same end effector position).
Inverse kinematics: given the desired position of the end effector in the base frame, compute the joint angles that will achieve that position. This is much harder as there might be multiple configurations to achieve the same end effector pose.
, mapping- Often non-unique or has no analytical solution
- Optimization-based inverse kinematics (IKs): introduce cost function (how far away current end effector pose is from target pose), add some secondary constraint (obstacle, energy), and optimize for the joint angles that minimize cost with gradient descent.
Optimization-based inverse kinematics
Section titled “Optimization-based inverse kinematics”Objective: Minimize the distance between the current end effector pose and the target pose.
Loss:
Update:
Gradient of the loss w.r.t. the joint angles:
where
Jacobian method:
Damped least squares
Section titled “Damped least squares”The problem: Near a singularity, the Jacobian
Plain gradient descent uses
Take derivative w.r.t.
Waypoint generation and following
Section titled “Waypoint generation and following”IK only gives the target joints, but robot cannot jump there. To convert IK to motor commands, we need to take into account the time of movement. For this, we generate tiny waypoints along the path so the robot can follow them.
- Inputs:
, time , and control frequency - Number of waypoints:
(one waypoint = one movement command) - Normalized time progress:
- Waypoints:
However, many issues with LERP:

Quintic splines
Section titled “Quintic splines”Thus, most controllers use quintic splines, a polynomial-based method, to generate waypoints, i.e., representing the trajectory of each joint as a 5th order polynomial.
- Then add 6x boundary conditions for smoothness:
- Start and end with no velocity and acceleration, while keeping position
- Quintic time scaling:
- Standard for industry robots like Frankas

PID control
Section titled “PID control”In the real world, the robot would not follow these waypoints perfectly because of friction and air resistance. Thus, we need to use PID controllers. The difference between the desired joint angles and the current joint angles (the tracking error) is fed into a PID controller. The controller calculates the appropriate control signal.
Given trajectory waypoints
Tracking error:
Continuous form:
Discrete form:

Markov decision processes (MDPs)
Section titled “Markov decision processes (MDPs)”Representing a policy
Section titled “Representing a policy”
Not too different from an image classifier, the policy takes in an observation and outputs an action conditioned on the observation and outputs a distribution over actions.
Some environments are only partially observable, so
Markov property
Section titled “Markov property”

- State space can be discrete (chess, go) or continuous (robot movement)
- Similarly, action can be discrete (play a certain card from 64, keyboard WASD) or continuous (apply force in x, y, z direction)
- Transition model can be deterministic
or stochastic . Uncertainty caused by sensor noise, motor overshooting, i.e., latent variables - Reward function can be sparse (reward only at the end of the episode) or dense (reward at every step). E.g., robot arm trying to pick up a cup, reward only when it successfully picks up the cup (sparse), or reward based on how close the end effector is to the cup (dense).
Trajectory probability
Section titled “Trajectory probability”How likely a trajectory

Finite-horizon vs infinite-horizon MDPs
Section titled “Finite-horizon vs infinite-horizon MDPs”- Finite-horizon MDPs: the episode ends after a fixed number of steps
. - Infinite-horizon MDPs: the episode can go on indefinitely, and we introduce a
discount factor
to ensure that the total reward is finite so the robot doesn’t just keep trying to maximize reward forever without ever stopping.
Learning objective
Section titled “Learning objective”The optimal policy is the one that maximizes the expected return, which is the sum of discounted rewards over time. We can’t straight up use total reward because the world is stochastic, so we need to take the expectation over all possible trajectories that could occur under the policy.
