Mobility
gradysim.simulator.handler.mobility.MobilityHandler
Bases: INodeHandler
Introduces mobility into the simulatuon. Works by registering a regular event that updates every node's position based on it's target and speed. A node, through it's provider, can sent this handler communication commands to alter it's behaviour including it's speed and current target. Nodes also recieve telemetry updates containing information pertaining a node's current mobility status.
Source code in gradysim/simulator/handler/mobility.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 |
|
__init__(configuration=MobilityConfiguration())
Constructor for the mobility handler
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configuration |
MobilityConfiguration
|
Configuration for the mobility handler. If not set all default values will be used. |
MobilityConfiguration()
|
Source code in gradysim/simulator/handler/mobility.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.py
gradysim.simulator.handler.mobility.MobilityConfiguration
dataclass
Configuration class for the mobility handler
Source code in gradysim/simulator/handler/mobility.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