Impeller Robot Model

The impeller robot model simulates a single-DOF robot which can ‘bat’ objects in the plane. The model is intended as a demonstration testbed for planar juggling.

The link geometry uses only cylinder primitives. The same geometry is referenced to use as bounding objects for collision and automatic calculation of physics parameters. The base object has a NULL Physics object so it does not move, simulating a rigid connection to the ground.

The contact sensor is represented by a yellow cone. It is implemented as a DistanceSensor of limited range, pointing outward along the link axis from the base.

This model is demonstrated in the impeller-demo.wbt world.

../_images/impeller-demo.png

Screenshot of Webots model of impeller robot in an arena with an ElevationGrid slope around the edge.

Sample Control Code

 1# impeller.py
 2#
 3# Sample Webots controller file for driving a single actuator
 4# attached to an 'impeller' which manipulates objects.  The
 5# example simply moves in a periodic oscillation.
 6
 7# No copyright, 2020-2021, Garth Zeglin.  This file is
 8# explicitly placed in the public domain.
 9
10#------------------------------------------------------------------------------
11print("loading impeller.py...")
12
13# Import standard Python modules.
14import math
15
16# Import the Webots simulator API.
17from controller import Robot
18
19# Define the time step in milliseconds between controller updates.
20EVENT_LOOP_DT = 50
21
22#------------------------------------------------------------------------------
23# Request a proxy object representing the robot to control.
24robot = Robot()
25robot_name = robot.getName()
26print("%s: controller connected." % (robot_name))
27
28# Fetch handle for the 'base' joint motors.
29j1 = robot.getDevice('motor1')
30
31# Connect to the proximity sensor.
32sensor = robot.getDevice("endRangeSensor")
33sensor.enable(EVENT_LOOP_DT) # set sampling period in milliseconds
34
35#------------------------------------------------------------------------------
36# Run loop to execute a periodic script until the simulation quits.
37# If the controller returns -1, the simulator is quitting.
38while robot.step(EVENT_LOOP_DT) != -1:
39    # Read simulator clock time.
40    t = robot.getTime()
41
42    # Change the target position target (in radians).
43    period  =  6   # seconds
44    degrees = 180 * math.sin(t * (2*math.pi / period))
45    radians = degrees * (math.pi/180.0)
46    j1.setPosition(radians)