Exercise: Underactuated Two-Link Simulation¶
The main objective of this exercise is to become familiar with the Webots robot simulator we will be using for the first part of the course.
Objectives¶
After this exercise, you should be able to:
Install the Webots simulator on your own computer.
Install a Python 3 programming system on your own computer.
Unpack a ‘Webots project’, i.e. a sample world definition.
Run the simulator.
Modify an existing Python script to create a slightly changed movement sequence.
Modify dynamic properties of a physical simulation.
Create a movie file.
Reference Guides
Please review the following reference guides as needed:
Assigned video lecture clips.
Resources
The sample Webots project is a package of files and folders provided as a zip file passive-two-link.zip.
The course Piazza is a good place to collect and answer questions.
Steps and observations¶
The details of software installation can be found on the Webots and Python pages listed above, as well as links to the software documentation. Please try this soon, and let me know if you have problems getting this running on your own computer. There are many potential ways this might go go astray and I’d like it not to become a roadblock to progress.
On first launch, Webots will bring up the Guided Tour, which is a fun way to see the diversity of pre-installed robot models.
Please download the Webots project zip file linked above and unpack it wherever convenient for you. In general, these exercises will provide a template project as a starting point for you to modify. Webots expects a particular folder structure within the project. Each project can contain one or more world definitions with associated robot control programs and other object definitions.
After unpacking, please locate the following contents:
passive-two-link/worlds/passive-2-link-sample.wbt
: sample world file, opening it should launch the simulatorpassive-two-link/controllers/passive_two_link/passive_two_link.py
: Python script to control the simulated robot
Please explore the interface. The play/rewind interface above the graphics interface should run and reset the simulation. The tree editor on the left is the “Scene Tree” which defines all the properties of the world and mechanism. The code editor should be open on the right; if not, please locate the Robot object in the scene tree, right-click on it and select ‘Edit Controller’ from the menu.
For a more thorough tutorial, please consult The User Interface in the Getting Started with Webots section of he Webots User Guide.
The key deliverable for the assignment is a movie of a modified movement sequence. This doesn’t need to be complicated, although I encourage you to decide on some simple bit of choreography before starting. One suggested method would be to duplicate the final clause of the Python program (lines 37-40) and then adjust the timing values (e.g. 2000) and velocity values (e.g. 3 radians/second). The base joint motor is initially limited to 3.14 radians/sec (180 degrees/sec). The second joint has friction but no motor.
Some ideas: can you build the movement to a climax? Can you knock over the base (it isn’t attached)? Can you get the second indirectly-driven link to come to rest in a deliberate way?
In this example, the mechanism is entirely defined within the scene tree. This won’t always be true; more complicated robots are defined as code in .proto files. The Robot definition is deeply nested as it represents a graph of the kinematic structure.
As a starting point for changing a dynamic property, please turn off the friction in the passive joint and see the effects. You’ll need to dig down this path:
Robot > children > HingeJoint > endPoint > children > HingeJoint > jointParameters > dampingConstant
Parameters can be adjusted while the simulator is running. But I highly recommend you get in the habit of resetting the simulation state before saving any world changes in order to preserve the accuracy of the initial conditions. This does mean that desired positional changes need to be re-applied to the initial state.
If you have any questions, please post to them to Piazza.
Finally, please render a short movie clip of your final results. You can either select File/Make Movie or the film icon in the toolbar.
Deliverables¶
Short video clip of simulated behavior, submitted to Canvas either as a video file or a link to a third-party streaming service.