Exercise: Sensors and Feedback

The main objective of this exercise is to explore feedback control. We will use both proprioceptive sensing that measures the internal state of a robot and exterioceptive sensors which measure a property of the environment. The emphasis is on applying essential control principles to individual joints and then empirically tuning parameters to observe system behaviors.

Control theory is a vast body of work concerned with stabilizing dynamic systems. Familiar applications range from a home thermostat regulating temperature to a rocket nozzle actuator stabilizing and steering a launch.

In general, a system (also called a plant or process) is stabilized by adding sensing, actuation, and a control system with either analog or digital computation. The general idea is that an unstable system can be stabilized by adding a control loop to create a composite system with new dynamics. The control system is parameterized with gains to allow tuning the controlled dynamics.

Most common definitions of robot include some element of sensing and responding to the world. In many actual robots, this sensing is purely internal in the form of control feedback which regulates movement to achieve a specified position goal, target velocity, or trajectory. This feedback uses proprioceptive sensors to measure joint positions, applies a control model to compute appropriate actuator commands for a known physical system, and then applies force via the actuators. If it works, the mechanism moves closer to the goal state and errors are reduced. If the disturbances are too great, the process can fail to achieve the target or become unstable.

The ideas behind feedback predate robotics: a classic example is the flyball governor, invented in 1788 to regulate steam engine speed. The ideas have been generalized broadly beyond mechanical systems in the study of cybernetics.

A controller ‘closes the loop’ by creating a cyclical energetic and informational pathway including both a process and a representation of that process in the controller. In this view, cause and effect is not well-defined: if the mechanism encounters a disturbance, then the controller will respond with increased torque. Likewise, if the program chooses a new position target, the controller will respond with torque. In equilibrium, both disturbances and goals affect the balance of the system, with the intent of converging in a stable way toward an objective. But the resulting behavior is the composite of both ‘intent’ and ‘reaction’.

One outcome is that even simple feedback-controlled devices can be easily interpreted as ‘alive’ or having ‘purpose’ in the right context, and this effect is what this exercise is intended to explore.

Relevant terms: proportional control, PID control, degree of freedom (DOF), closed-loop control, position target, goal, disturbance, error signal, stability, bandwidth, lag, set point.

../_images/controls-project.jpg

Screenshot of sample Webots project including several two-link arms and a clock. All robots are shown in the neutral pose.

Objectives

After this exercise, you should be able to:

  1. Tune the gains of a single-axis PD servo.

  2. Attach a simulated external range sensor to a simulated robot.

  3. Formulate a set of single-axis control functions to produce reactive behavior.

Reference Guides

Please review the following reference guides as needed:

Resources

  • The sample Webots project is a package of files and folders provided as a zip file controls.zip.

  • The course Piazza is a good place to collect and answer questions.

Part 1: Setting Clock Gains

The objective is to experiment with a single-axis controller and discover the relationship between proportional and derivative gains. This isn’t meant to take more than a few minutes.

Please follow these steps:

  1. Open the controls-sample.wbt world file.

  2. Focus your attention on the clock. Please note you can right-click it and select “Move Viewpoint to Object.”

  3. Run the simulation once: you should see the hands slowly converge to the current wall clock time after a lot of oscillation.

  4. Open the controller code. Please note you may right-click on the clock in the scene tree and select “Edit Controller Code.”

  5. Find the initialization of the P_gain and D_gain variables.

  6. Try a damping (D_gain) of 0.05, restarting the simulator to observe the start-up transient.

  7. Experiment a bit with both P and D gains to see the outcome, restarting the simulator each time. E.g., what happens with a negative D_gain?

  8. What P and D would you choose, and for what effect?

Part 2: Adding a Sensor and Environment

The objective is instrument a robot for a chosen task and implement a switching or linear controller. You may either use the provided models or add instrumentation to your own. You may also add fixed or movable objects or other robots to create the task.

The ultimate objective is to create a situation with rich enough dynamics both in terms of the device physics and the control programs that surprising behavior may naturally emerge. This can take some experimentation.

Please follow these steps to start:

  1. Open the controls-sample.wbt world file.

  2. Examine the left two-link robot in the scene tree. It was generated using the two-link.proto file, so the structure is not shown, just the user-accessible parameters.

  3. Try right-clicking the robot and selecting ‘Convert to Base Node(s)’. The robot should be expanded into a full node tree.

  4. Locate the DistanceSensor node. It is one of the children of the link2 Solid node, as it is attached to the link2 body; you’ll need to walk out through kinematics tree to find it.

  5. The yellow cone representing the sensor is a Shape node that is a child of the DistanceSensor node.

  6. The maximum range of the sensor is expressed via its lookupTable property.

  7. If you wish to add a sensor to your own robot, the simplest way would be to copy and paste this DistanceSensor node as a child of a Solid in your own model.

After setting up the sensor, you may add additional Solid nodes at top level to represent other props. With top-level solids, if the boundingObject is set but not the physics, it will be immovable but still participate in collisions.

Part 3: Feedback Control using an External Sensor

The objective is to set up a control process which responds to external objects or other robots via distance sensor readings. There are endless possibilities, from linear regulation feedback up to world mapping; a full treatment is beyond the scope of this course.

To start, I suggest a focus on switching functions rather than linear feedback. The essential idea is that different states of the robot and world are mapped to different discrete control outputs. These solutions can be hard to treat analytically and are prone to defects such as instability or getting stuck, but can be intuitive to formulate and suited for empirical development.

The two_link_sensor.py script in the sample world contains one such controller. It implements a heuristic switching controller which locates nearby obstacles for short intervals. It has a ‘hunt’ mode in which it scans for range readings, and a ‘track’ mode where it attempts to oscillate around a local minimum of the distance function.

Deliverables

This assignment has two parts:

  1. Experimenting with the provided single-axis clock controller to find new gains.

  2. Extending a simulation with external sensing and constructing a controller for it. You may use your own previous model, modify the two-link model, or create a new one.

For submitted files, please add your name (either preferred or last) as a prefix on the filename, e.g. “Garth-sim.zip” or “Zeglin-sensors.zip”.

Please submit the following files to Canvas:

  1. A text file with two paragraphs briefly describing:

    1. Your final gain settings on the one-axis simulator and your criteria for the selection.

    2. Your behavioral objectives and outcomes using external sensing.

  2. Zip file of your Webots project.

  3. Short video clip (under one minute) of simulated behavior, submitted to Canvas either as a video file or a link to a third-party streaming service. If a file, please add a similar name prefix.

N.B. it appears Canvas is treating the submission criteria as exclusive-or, e.g. it doesn’t seem to accept direct text submission along with files.