Mobility
The mobility subsystem currently exposes two handler families:
MasslessMobilityHandler: target-based motion with instantaneous speed changes and no inertia.DynamicVelocityMobilityHandler: dynamic velocity mobility with velocity commands, acceleration limits, and velocity telemetry.
For a conceptual explanation of how protocols, mobility commands, handlers, and telemetry fit together, see How Mobility Works.
For the dynamic velocity mobility API, see Dynamic Velocity Mobility Handler.
gradysim.simulator.handler.mobility
Mobility handlers introduce mobility to nodes in the simulation. Different mobility handlers can implement different mobility models, from simple static nodes to complex models that simulate real-world movement patterns. They are responsible for updating the position of nodes based on mobility commands received from protocols and for sending updated position telemetry back to the protocols.
DynamicVelocityMobilityConfiguration
dataclass
Configuration parameters for the Dynamic Velocity Mobility Handler.
Attributes:
| Name | Type | Description |
|---|---|---|
update_rate |
float
|
Time interval (in seconds) between mobility updates. Typical for trajectory-level quadrotor sims: 0.01–0.05 s. |
max_speed_xy |
float
|
Maximum horizontal speed (m/s). Applied to the norm of (vx, vy). Typical: 3–15 m/s (depends heavily on vehicle and mission). |
max_speed_z |
float
|
Maximum vertical speed (m/s). Applied to |vz|. Typical: 1–8 m/s. |
max_acc_xy |
float
|
Maximum horizontal acceleration (m/s²). Applied to the norm of (ax, ay). Typical: 2–8 m/s². |
max_acc_z |
float
|
Maximum vertical acceleration (m/s²). Applied to |az|. Typical: 2–10 m/s². |
tau_xy |
Optional[float]
|
Optional first-order time constant (seconds) for horizontal velocity tracking. When set, the model behaves like a 1st-order system + acceleration saturation: a* = (v_des - v) / tau_xy Typical: 0.3–0.8 s. |
tau_z |
Optional[float]
|
Optional first-order time constant (seconds) for vertical velocity tracking. Typical: 0.5–1.2 s. |
send_telemetry |
bool
|
If True, emit Telemetry messages after position updates. |
telemetry_decimation |
int
|
Emit telemetry every N mobility updates (default: 1). |
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/config.py
DynamicVelocityMobilityHandler
Bases: INodeHandler
Dynamic Velocity Mobility Handler for GrADyS-SIM NG.
This handler updates node positions based on velocity commands with realistic physical constraints (velocity and acceleration limits).
Key features:
- Direct velocity control (no waypoints)
- Independent horizontal and vertical constraints
- Acceleration-limited velocity tracking (optionally with 1st-order lag via tau)
- Optional telemetry emission
Usage
config = DynamicVelocityMobilityConfiguration( update_rate=0.1, max_speed_xy=10.0, max_speed_z=5.0, max_acc_xy=2.0, max_acc_z=1.0 ) handler = DynamicVelocityMobilityHandler(config)
In your protocol handler:
handler.set_velocity(node.identifier, (vx, vy, vz))
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
__init__(config)
Initialize the Dynamic Velocity Mobility Handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config |
DynamicVelocityMobilityConfiguration
|
Configuration parameters for mobility constraints and update rate. |
required |
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
after_simulation_step(iteration, time)
Called after each simulation step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iteration |
int
|
Current simulation iteration number |
required |
time |
float
|
Current simulation time |
required |
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
finalize()
handle_command(command, node)
Performs a mobility command. This method is called by the node's provider to transmit it's mobility command to the mobility handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command |
MobilityCommand
|
Command being issued |
required |
node |
Node
|
Node that issued the command |
required |
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
initialize()
Start the periodic mobility update loop.
Schedules the first mobility update event for all nodes.
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
inject(event_loop)
Inject the event loop into the handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_loop |
EventLoop
|
The event loop for scheduling periodic updates. |
required |
register_node(node)
Register a node with this handler (called when node is created).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node |
Node
|
The node instance to register. |
required |
Source code in gradysim/simulator/handler/mobility/dynamic_velocity/handler.py
MasslessMobilityConfiguration
dataclass
Configuration class for the mobility handler
Source code in gradysim/simulator/handler/mobility/massless.py
default_speed: float = 10
class-attribute
instance-attribute
This is the default speed of a node in m/s
reference_coordinates: Tuple[float, float, float] = (0, 0, 0)
class-attribute
instance-attribute
These coordinates are used as a reference frame to convert geographical coordinates to cartesian coordinates. They will be used as the center of the scene and all geographical coordinates will be converted relative to it.
update_rate: float = 0.01
class-attribute
instance-attribute
Interval in simulation seconds between mobility updates
MasslessMobilityHandler
Bases: INodeHandler
Introduces mobility into the simulation. Simulates nodes as massless and dimensionless points that can move freely in 3D space. There is no concept of acceleration or inertia, all changes in velocity are instantaneous.
Works by registering a regular event that updates every node's position based on its target and speed. A protocol is capable of altering its own speed and heading by sending mobility commands through its provider. These commands will reach the mobility handler which will update the node's target and speed accordingly. Nodes also receive telemetry updates containing information pertaining a node's current mobility status.
Source code in gradysim/simulator/handler/mobility/massless.py
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 | |
__init__(configuration=MasslessMobilityConfiguration())
Constructor for the mobility handler
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration |
MasslessMobilityConfiguration
|
Configuration for the mobility handler. If not set all default values will be used. |
MasslessMobilityConfiguration()
|
Source code in gradysim/simulator/handler/mobility/massless.py
handle_command(command, node)
Performs a mobility command. This method is called by the node's provider to transmit it's mobility command to the mobility handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command |
MobilityCommand
|
Command being issued |
required |
node |
Node
|
Node that issued the command |
required |
Source code in gradysim/simulator/handler/mobility/massless.py
Massless Mobility Handler
gradysim.simulator.handler.mobility.massless.MasslessMobilityHandler
Bases: INodeHandler
Introduces mobility into the simulation. Simulates nodes as massless and dimensionless points that can move freely in 3D space. There is no concept of acceleration or inertia, all changes in velocity are instantaneous.
Works by registering a regular event that updates every node's position based on its target and speed. A protocol is capable of altering its own speed and heading by sending mobility commands through its provider. These commands will reach the mobility handler which will update the node's target and speed accordingly. Nodes also receive telemetry updates containing information pertaining a node's current mobility status.
Source code in gradysim/simulator/handler/mobility/massless.py
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 | |
__init__(configuration=MasslessMobilityConfiguration())
Constructor for the mobility handler
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration |
MasslessMobilityConfiguration
|
Configuration for the mobility handler. If not set all default values will be used. |
MasslessMobilityConfiguration()
|
Source code in gradysim/simulator/handler/mobility/massless.py
handle_command(command, node)
Performs a mobility command. This method is called by the node's provider to transmit it's mobility command to the mobility handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command |
MobilityCommand
|
Command being issued |
required |
node |
Node
|
Node that issued the command |
required |
Source code in gradysim/simulator/handler/mobility/massless.py
gradysim.simulator.handler.mobility.massless.MasslessMobilityConfiguration
dataclass
Configuration class for the mobility handler
Source code in gradysim/simulator/handler/mobility/massless.py
default_speed: float = 10
class-attribute
instance-attribute
This is the default speed of a node in m/s
reference_coordinates: Tuple[float, float, float] = (0, 0, 0)
class-attribute
instance-attribute
These coordinates are used as a reference frame to convert geographical coordinates to cartesian coordinates. They will be used as the center of the scene and all geographical coordinates will be converted relative to it.
update_rate: float = 0.01
class-attribute
instance-attribute
Interval in simulation seconds between mobility updates
Dynamic Velocity Mobility Handler
See Dynamic Velocity Mobility Handler for the full handler, configuration, telemetry, and core API reference.