forked from nmccrea/sobot-rimulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manual.txt
202 lines (114 loc) · 10.4 KB
/
Manual.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
===============================
======= Sobot Rimulator =======
== A Robot Programming Tool ===
===============================
Thank you for downloading Sobot Rimulator! It is my sincere hope that this program will help you practice mobile robot control theory. The following is a brief manual for how to run and make use of the simulator.
This software and all accompanying materials are Copyright 2013-2014 Nicholas Sloan Dowson McCrea. It is being released under the GNU General Public License, Version 3. Please see the accompanying LICENSE file for more information.
For questions or comments, email me at [email protected].
TABLE OF CONTENTS
=================
1. ACKNOWLEDGEMENTS
2. REQUIREMENTS
3. RUNNING THE SIMULATOR
4. USING THE SIMULATOR
5. PROGRAMMING THE ROBOT
1. ACKNOWLEDGEMENTS
===================
I would like to thank the following folks for their part in the creation of Sobot Rimulator:
Dr. Magnus Egerstedt of The Georgia Institute of Technology, who's Coursera course "Control of Mobile Robots" was my first formal introduction to robotic control theory and the catalyst for this software's creation.
Jean-Pierre de la Croix of The Georgia Institute of Technology, for aiding the Coursera course. JP's robot simulator Sim.I.Am served as the design inspiration for Sobot Rimulator.
All the visionary people at Coursera, who provide an invaluable education service.
Carmen, for her effortless brilliance coming up with titles.
And geniuses everywhere.
2. REQUIREMENTS
===============
Sobot Rimulator is cross-platform compatible and should be able to run on Windows, Mac OSX, and Linux/Unix machines. In order to run, the following two items must be installed on your computer:
- Python 2.6.1 or higher
- PyGTK 2.7 or higher
To install Python: The latest Python interpreter can be found at http://www.python.org/download/.
To install PyGTK: The latest PyGTK distributions can found at http://www.pygtk.org/downloads.html.
Alternatively, both pieces of software should be available through package managers such as Apt-Get (for Linux/Unix) or Homebrew (Recommended for Mac)
3. RUNNING THE SIMULATOR
========================
To run the simulator, open a command prompt (terminal) and navigate to the Sobot Rimulator directory. Then type:
python rimulator.py
4. USING THE SIMULATOR
======================
The simulator window contains the following elements:
- Simulation Viewport
- Alert Text Panel
- Control Panel
Simulation Viewport
-------------------
When the program starts, a randomized map is loaded.
A small blue and black circular object in the center of the viewport is the robot. The dimensions and capabilities of this robot are modeled after the Khepera III research robot. (See http://www.k-team.com/mobile-robotics-products/khepera-iii). The Khepera III is a differential-drive mobile robot. It is equipped with 9 infrared proximity sensors forming a "skirt", with which it can detect nearby obstacles.
A green circle indicates the location of the goal the robot will attempt to reach.
Red rectangles scattered throughout the map are obstacles - if the robot makes contact with an obstacle, a collision will occur and the simulation will end.
A grid is drawn onto the map to help you judge distances. Major gridlines are laid out every meter. Minor gridlines are laid out every 20 centimeters.
Alert Text Panel
----------------
When events such as a collision or successful arrival at the goal occur, it will be reported in the space between the simulation view port and the control panel. When the simulation begins, the alert text panel is blank.
Control Panel:
--------------
The control panel is divided into three rows.
The FIRST ROW of buttons controls the simulation progress:
== "Play"
Causes the simulation to proceed until you stop it, or the robot reaches the goal or collides with an obstacle.
== "Stop"
Stops the simulation in its current state.
== "Step"
Advances the simulation by one simulation cycle. The simulation will be stopped after this button is pressed.
== "Reset"
Clears all progress of the robot and resets the simulation.
The SECOND ROW of buttons gives gives you control over the map:
== "Save Map"
Causes a save dialog to appear. The default location to save maps is in the /maps folder of the simulator directory. Saving a map will NOT save the current state of the simulation. It only saves the location of the obstacles and the goal.
== "Load Map"
Causes a load dialog to appear. From here you can load previously saved maps.
== "Random Map"
Generates a random map on the fly. The simulation resets when a new random map is generated.
The THIRD ROW of buttons provides a more detailed visualization of what the robot is doing:
== "Show Invisibles"
Causes extra information to be drawn to the simulation view that would not be visible in the real world. This includes the robot's traverse path (where it has been so far), the robot's infrared sensor cones, the robot's current desired heading, and other information specific to the current control mode the robot is in:
- A green heading bar indicates that the robot is currently in Go to Goal mode.
- A red heading bar indicates that the robot is currently in Avoid Obstacles mode. This will be accompanied by a black outline indicating the robot's detected surroundings.
- A blue heading bar indicates that the robot is currently in blended Go to Goal and Avoid Obstacles mode. This will be accompanied by two lesser heading bars each corresponding to the pure heading of Go to Goal mode and Avoid Obstacles mode, as well as the black outline displayed by the Avoid Obstacles mode.
- An orange heading bar indicates that the robot is currently in Follow Wall mode. This will be accompanied by two black lines - one indicating the followed surface calculated by the robot, and another indicating the stand-off distance to that obstacle surface.
5. PROGRAMMING THE ROBOT
========================
********************************************************
This section is for programmers. Everything in this section refers to Python code. The .py files associated with each Python class mentioned are given.
This section serves only as a quick and dirty description of the programmed control architecture as provided with this distribution of Sobot Rimulator. As the primary purpose of Sobot Rimulator is to allow you to play with your own designs, please do not feel any obligation to stick to or maintain the design described here. There are certainly ways it can be improved.
********************************************************
Each robot is controlled by a Supervisor object. Instead of talking directly to the Robot object, a Supervisor is given a RobotSupervisorInterface (robot_supervisor_interface.py) that defines the entirety of available commands the Supervisor can send the Robot. The RobotSupervisorInterface can therefore be thought of as an API to the robot, providing these instructions:
- read_proximity_sensors
- read_wheel_encoders
- set_wheel_drive_rates
This design separates the code for programming the robot Supervisor from the rest of the program's source code, so that programming the simulated robot is similar to programming a real Khepera III robot with the same API.
Supervisor (supervisor.py)
--------------------------
The Supervisor is the brains of the robot. It contains a RobotSupervisorInterface, a SupervisorStateMachine that manages control state transitions, and several different controllers that can generate control parameters by various criteria. It also contains odometry code for maintaining an estimate of the robot's current position and heading. The Supervisor control-loop sequence is as follows:
1. Update State - update sensor readings, odometry, and controller headings; update the SupervisorStateMachine based on the new readings; set new active controller based on the new control state
2. Execute Controller - generate new control parameters using the active controller and the current sensor readings
3. Send Commands - apply the new control parameters to the robot by sending the appropriate robot commands
SupervisorStateMachine (supervisor_state_machine.py)
----------------------------------------------------
The SupervisorStateMachine manages the robot's control state. The version distributed with Sobot Rimulator supports the following control states (defined in control_state.py):
- ControlState.AT_GOAL
- ControlState.GO_TO_GOAL
- ControlState.AVOID_OBSTACLES
- ControlState.GTG_AND_AO
- ControlState.SLIDE_LEFT
- ControlState.SLIDE_RIGHT
Once per control loop iteration, the SupervisorStateMachine updates itself. It first checks if certain conditions are met (e.g, sensors indicate that an obstacle is very close). Depending on the set of conditions that are met, the state machine may then transition the control state to a new state. A state transition will usually include changing the active controller used by the Supervisor.
Controllers
-----------
This distribution of Sobot Rimulator comes with five controllers built into the Supervisor (although additional controllers can be added fairly easily). These are:
- GoToAngleController (go_to_angle_controller.py)
- GoToGoalController (go_to_goal_controller.py)
- AvoidObstaclesController (avoid_obstacles_controller.py)
- GTGAndAOController (gtg_and_ao_controller.py)
- FollowWallController (follow_wall_controller.py)
Before the SupervisorStateMachine updates, each controller generates a heading vector. Each heading will likely be different, representing the direction the robot should go to perform the behavior that particular controller is designed to effect. These headings are then compared to each other by the SupervisorStateMachine as part of its test for state transitions.
After the SupervisorStateMachine has updated the control state, the controller that it chose to activate is executed. The active controller generates movement parameters intended to effectively move the robot towards that controller's heading vector. These parameters are given using the "unicycle model" of movement (i.e. a translational velocity parameter (v) and an angular velocity parameter (omega)). The controller updates the Supervisor with these new parameters.
Once the final movement parameters have been calculated and applied, the Supervisor will transform them from the "unicycle" model into the corresponding wheel movement rates of a "differential drive" model, and command the robot to drive the wheels using these rates.