Robots and the world

Robot

class robot.RealBot(pose, color=0)

This type of robots implements communication with a real-world robot.

Although this is a SimObject, it doesn’t move by itself. Use set_pose() to move the robot.

pause()

Stops the robot, saving the state

resume()

Restarts the robot from the saved state

update_external_info()

Initiate communication with the real robot and get state info back.

class robot.Robot(pose, color=0)[source]

The robot is a SimObject that implements drawing and information functions to interface with supervisor.

This class is not intended to be subclassed in user code. Use one of the provided subclasses instead: SimBot for emulated robots or RealBot for physical robots.

draw_sensors(renderer)[source]

Draw the sensors that this robot has

get_info()[source]

Return the robot information structure, including sensor readings and shape information

set_inputs(inputs)[source]

Set drive inputs in the format needed by this robot

class robot.SimBot(pose, color=0)

The robot defined by this class is a simulated robot, and implements its own motion in move().

To implement a new type of robot, subclass SimBot and implement get_info() and get_external_sensors().

To make your robot move, implement move().

To make you robot controllable, implement set_inputs().

If your robot has sensors that can be drawn in the view, implement draw_sensors().

get_external_sensors()

Get the external sensors of the robot as a list. This function is used to update the sensor readings in proximity sensors.

move(dt)

Move the robot for a time interval dt.

Interaction between the robot and the supervisor

The simulator can run with any robot and any supervisor, as long as they implement the necessary methods in the Robot and Supervisor base classes. However, not any supervisor can work with any robot. Specifically, the supervisor has to correctly use the output of robot.Robot.get_info() and supply the correct input to robot.Robot.set_inputs().

When the simulation is run, the supervisor does not have a direct access to the robot. All the information that the supervisor can get, is the output of get_info(). It is important when implementing a robot to put all the necessary information about the robot into this structure. This includes the sensor readings and the geometry of the robot.

The only way that the supervisor can influence the robot, is through the set_inputs() method. The supervisor has to produce the correct output from its execute() method. This output will be fed to the robot at the end of the cycle.

Sensor

class sensor.Sensor[source]

Base superclass for sensor objects

classmethod add_gauss_noise(value, sigma)[source]

Returns the value with an added normal noise

The return value is normally distributed around value with a standard deviation sigma

class sensor.MountedSensor(pose, parent)[source]

A sensor that moves together with its parent object.

The sensor is assumed to be attached to parent at pose in local coordinates.

get_internal_pose()[source]

Get the pose of the sensor in the parent (robot) coordinates.

class sensor.ProximitySensor(pose, robot, geometry)[source]

Create a proximity sensor mounted on robot at pose. The geometry is a (rmin, rmax, angle) tuple.

get_envelope()[source]

Return the envelope of the sensor

distance_to_value(dst)[source]

Returns the distance to the value using sensor calculations

distance()[source]

Returns the distance instance

reading()[source]

Returns the reading value

update_distance(sim_object=None)[source]

updates all the distances from the reading

draw(r)[source]

draws the sensor simobject

get_distance_to(sim_object)[source]

Gets the distance to another simobject returns distance in meters or None if not in contact

Table Of Contents

Previous topic

SimObject

Next topic

Supervisor/Controller system

This Page