ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 4227

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

13

SIM parameter file

Simulation Systems

Figure 13.6: Ball simulation

A number of parameter files are used for the EyeSim simulator, which determine simulation parameters, physical robot description, and robot sensor layout, as well as the simulation environment and graphical representation:

myfile.sim

Main simulation description file, contains links to environment and robot application binary.

myfile.c (or .cpp) and myfile.dll

Robot application source file and compiled binary as dynamic link library (DLL).

The following parameter files can be supplied by the application programmer, but do not have to be. A number of environment, as well as robot description and graphics files are available as a library:

myenvironment.maz or myenvironment.wld

Environment file in maze or world format (see Section 13.5).

myrobot.robi

Robot description file, physical dimensions, location of sensors, etc.

myrobot.ms3d

Milkshape graphics description file for 3D robot shape (graphics representation only).

Program 13.2 shows an example for a “.sim” file. It specifies which environment file (here: “maze1.maz”) and which robot description file (here: S4.robi”) are being used.

The robot’s starting position and orientation may be specified in the “robi” line as optional parameters. This is required for environments that do not specify a robot starting position. E.g.:

robi S4.robi DriveDemo.dll 400 400 90

182

EyeSim Environment and Parameter Files

Program 13.2: EyeSim parameter file “.sim”

1

# world description file (either maze or world)

2

maze maze1.maz

3

4# robot description file

5robi S4.robi DriveDemo.dll

ROBI parameter file

There is a clear distinction between robot and simulation parameters, which is expressed by using different parameter files. This split allows the use of different robots with different physical dimensions and equipped with different sensors in the same simulation.

Program 13.3: Robot parameter file “.robi” for S4 soccer robot

1# the name of the robi

2name S4

3

4# robot diameter in mm

5diameter 186

6

# max

linear velocity in mm/s

7

8

speed

600

9

# max

rotational velocity in deg/s

10

11

turn

300

12

# file name of the graphics model used for this robi

13

14

model

S4.ms3d

15

16# psd sensor definition: (id-number from "hdt_sem.h")

17# "psd", name, id, relative position to robi center(x,y,z)

18# in mm, angle in x-y plane in deg

19

psd PSD_FRONT

-200

60

20

30

0

20

psd

PSD_LEFT

-205

56

45

30

90

21

psd

PSD_RIGHT

-210

56

-45

30

-90

22

23# color camera sensor definition:

24# "camera", relative position to robi center (x,y,z),

25# pan-tilt-angle (pan, tilt), max image resolution

26

camera 62 0 60

0 -5

80 60

27

28# wheel diameter [mm], max. rotational velocity [deg/s],

29# encoder ticks/rev., wheel-base distance [mm]

30

wheel 54 3600 1100 90

31

32# motors and encoders for low level drive routines

33# Diff.-drive: left motor, l. enc, right motor, r. enc

34

drive DIFFERENTIAL_DRIVE MOTOR_LEFT QUAD_LEFT

35

MOTOR_RIGHT QUAD_RIGHT

183


13 Simulation Systems

Each robot type is described by two files: the “.robi” parameter file, which contains all parameters of a robot relevant to the simulation, and the default Milkshape “.ms3d” graphics file, which contains the robot visualization as a colored 3D model (see next section). With this distinction, we can have a number of physically identical robots with different shapes or color representation in the simulation visualization. Program 13.3 shows an example of a typical “.robi” file, which contains:

Robot type name

Physical size

Maximum speed and rotational speed

Default visualization file (may be changed in “.sim” file)

PSD sensor placement

Digital camera placement and camera resolution in pixels

Wheel velocity and dimension

Drive system to enable low-level (motoror wheel-level) driving, supported drive systems are DIFFERENTIAL_DRIVE, ACKERMANN_

DRIVE, and OMNI_DRIVE

With the help of the robot parameter file, we can run the same simulation with different robot sensor settings. For example, we can change the sensor mounting positions in the parameter file and find the optimal solution for a given problem by repeated simulation runs.

13.6 SubSim Simulation System

SubSim is a simulation system for Autonomous Underwater Vehicles (AUVs) and therefore requires a full 3D physics simulation engine. The simulation software is designed to address a broad variety of users with different needs, such as the structure of the user interface, levels of abstraction, and the complexity of physics and sensor models. As a result, the most important design goal for the software is to produce a simulation tool that is as extensible and flexible as possible. The entire system was designed with a plug-in based architecture. Entire components, such as the end-user API, the user interface and the physics simulation library can be exchanged to accommodate the users’ needs. This allows the user to easily extend the simulation system by adding custom plug-ins written in any language supporting dynamic libraries, such as standard C or C++.

The simulation system provides a software developer kit (SDK) that contains the framework for plug-in development, and tools for designing and visualizing the submarine. The software packages used to create the simulator include:

wxWidgets [wxWidgets 2006] (formerly wxWindows)

A mature and comprehensive open source cross platform C++ GUI framework. This package was selected as it greatly simplifies the task

184

SubSim Simulation System

Physics simulation

Application programmer interface

of cross platform interface development. It also offers straightforward plug-in management and threading libraries.

TinyXML [tinyxml 2006]

This XML parser was chosen because it is simple to use and small enough to distribute with the simulation.

Newton Game Dynamics Engine [Newton 2006]

The physics simulation library is exchangeable and can be selected by the user. However, the Newton system, a fast and deterministic physics solver, is SubSim’s default physics engine.

The underlying low-level physics simulation library is responsible for calculating the position, orientation, forces, torques and velocities of all bodies and joints in the simulation. Since the low-level physics simulation library performs most of the physics calculations, the higher-level physics abstraction layer (PAL) is only required to simulate motors and sensors. The PAL allows custom plug-ins to be incorporated to the existing library, allowing custom sensor and motor models to replace, or supplement the existing implementations.

The simulation system implements two separate application programmer interfaces (APIs). The low-level API is the internal API, which is exposed to developers so that they can encapsulate the functionality of their own controller API. The high-level API is the RoBIOS API (see Appendix B.5), a user friendly API that mirrors the functionality present on the EyeBot controller used in both the Mako and USAL submarines.

The internal API consists of only five functions:

SSID InitDevice(char *device_name);

SSERROR QueryDevice (SSID device, void *data);

SSERROR SetData(SSID device, void *data);

SSERROR GetData(SSID device, void *data);

SSERROR GetTime(SSTIME time);

The function InitDevice initializes the device given by its name and stores it in the internal registry. It returns a unique handle that can be used to further reference the device (e.g. sensors, motors). QueryDevice stores the state of the device in the provided data structure and returns an error if the execution failed. GetTime returns a time stamp holding the execution time of the submarine’s program in ms. In case of failure an error code is returned.

The functions that are actually manipulating the sensors and actuators and therefore affect the interaction of the submarine with its environment are either the GetData or SetData function. While the first one retrieves the data (e.g. sensor readings) the latter one changes the internal state of a device by passing control and/or information data to the device. Both functions return appropriate error codes if the operation fails.

185


CLGf
Sfin
Ge ve

13 Simulation Systems

13.7 Actuator and Sensor Models

Propulsion model The motor model (propulsion model) implemented in the simulation is based on the standard armature controlled DC motor model [Dorf, Bishop 2001]. The transfer function for the motor in terms of an input voltage (V) and output rotational speed (T) is:

T

K

---

-----------------------------------------------------

V

Js b Ls R K2

Where:

Jis the moment of inertia of the rotor, s is the complex Laplace parameter,

b is the damping ratio of the mechanical system,

Lis the rotor electrical inductance,

Ris the terminal electrical resistance,

Kis the electro-motive force constant.

Thruster model The default thruster model implemented is based on the lumped parameter dynamic thruster model developed by [Yoerger, Cook, Slotine 1991]. The thrust produced is governed by:

Thrust = Ct ·: · |:|

Where:

: is the propeller angular velocity, Ct is the proportionality constant.

Control surfaces Simulation of control surfaces (e.g. rudder) is required for AUV types such as USAL. The model used to determine the lift from diametrically opposite fins [Ridley, Fontan, Corke 2003] is given by:

L

1

S

G

v

2

fin

--UC

fin

e

e

2

LGf

Where:

Lfin

is the lift force,

Uis the density,

is the rate of change of lift coefficient

with respect to fin effective angle of attack, is the fin platform area,

is the effective fin angle, is the effective fin velocity

SubSim also provides a much simpler model for the propulsion system in the form of an interpolated look-up table. This allows a user to experimentally collect input values and measure the resulting thrust force, applying these forces directly to the submarine model.

186


Actuator and Sensor Models

Sensor models

Environments

Error models

The PAL already simulates a number of sensors. Each sensor can be coupled with an error model to allow the user to simulate a sensor that returns data similar to the accuracy of the physical equipment they are trying to simulate. Many of the position and orientation sensors can be directly modeled from the data available from the lower level physics library. Every sensor is attached to a body that represents a physical component of an AUV.

The simulated inclinometer sensor calculates its orientation from the orientation of the body that it is attached to, relative to the inclinometers own initial orientation. Similarly, the simulated gyroscope calculates its orientation from the attached body’s angular velocity and its own axis of rotation. The velocimeter calculates the velocity in a given direction from its orientation axis and the velocity information from the attached body.

Contact sensors are simulated by querying the collision detection routines of the low-level physics library for the positions where collisions occurred. If the collisions queried occur within the domain of the contact sensors, then these collisions are recorded.

Distance measuring sensors, such as echo-sounders and Position Sensitive Devices (PSDs) are simulated by traditional ray casting techniques, provided the low level physics library supports the necessary data structures.

A realistic synthetic camera image is being generated by the simulation system as well. With this, user application programs can use image processing for navigating the simulated AUV. Camera user interface and implementation are similar to the EyeSim mobile robot simulation system.

Detailed modeling of the environment is necessary to recreate the complex tasks facing the simulated AUV. Dynamic conditions force the AUV to continually adjust its behavior. E.g. introducing (ocean) currents causes the submarine to permanently adapt its position, poor lighting and visibility decreases image quality and eventually adds noise to PSD and vision sensors. The terrain is an essential part of the environment as it defines the universe the simulation takes part in as well as physical obstacles the AUV may encounter.

Like all the other components of the simulation system, error models are provided as plug-in extensions. All models either apply characteristic, random, or statistically chosen noise to sensor readings or the actuators’ control signals. We can distinguish two different types of errors: Global errors and local errors. Global errors, such as voltage gain, affect all connected devices. Local errors only affect a certain device at a certain time. In general, local errors can be data dropouts, malfunctions or device specific errors that occur when the device constraints are violated. For example, the camera can be affected by a number of errors such as detector, Gaussian, and salt-and-pepper noise. Voltage gains (either constant or time dependent) can interfere with motor controls as well as sensor readings.

Also to be considered are any peculiarities of the simulated medium, e.g. refraction due to glass/water transitions and condensation due to temperature differences on optical instruments inside the hull.

187

13 Simulation Systems

13.8 SubSim Application

The example in Program 13.4 is written using the high-level RoBIOS API (see Appendix B.5). It implements a simple wall following task for an AUV, swimming on the water surface. Only a single PSD sensor is used (PSD_LEFT) for wall following using a bang-bang controller (see Section 4.1). No obstacle detection is done in front of the AUV.

The Mako AUV first sets both forward motors to medium speed. In an endless loop, it then continuously evaluates its PSD sensor to the left and sets left/ right motor speeds accordingly, in order to avoid a wall collision.

Program 13.4: Sample AUV control program

1 #include <eyebot.h>

2

3int main(int argc, char* argv[])

4{ PSDHandle psd;

5int distance;

6MotorHandle left_motor;

7MotorHandle right_motor;

8psd = PSDInit(PSD_LEFT);

9PSDStart(psd, 1);

10left_motor = MOTORInit(MOTOR_LEFT);

11right_motor= MOTORInit(MOTOR_RIGHT);

12

MOTORDrive(right_motor, 50);

/* medium speed */

13MOTORDrive(left_motor, 50);

14while(1) /* endless loop */

15

{ distance = PSDGet(psd);

/* distance to left */

16if (distance < 100) MOTORDrive(left_motor, 90);

17else if (distance>200) MOTORDrive(right_motor, 90);

18else { MOTORDrive(right_motor, 50);

19

MOTORDrive(left_motor, 50);

20}

21}

22}

The graphical user interface (GUI) is best demonstrated by screen shots of some simulation activity. Figure 13.7 shows Mako doing a pipeline inspection in ocean terrain, using vision feedback for detecting the pipeline. The controls of the main simulation window allow the user to rotate, pan, and zoom the scene, while it is also possible to link the user’s view to the submarine itself. The console window shows the EyeBot controller with the familiar buttons and LCD, where the application program’s output in text and graphics are displayed.

Figure 13.8 shows USAL hovering at the pool surface with sensor visualization switched on. The camera viewing direction and opening angle is shown as the viewing frustrum at the front end of the submarine. The PSD distance sensors are visualized by rays emitted from the submarine up to the next obstacle or pool wall (see also downward rays in pipeline example Figure 13.7).

188