Follow Mobility
gradysim.protocol.plugin.follow_mobility
This module declares two plugin for the protocol: a leader and a follower. The leader broadcasts its position and the follower follows it.
Beware that this plugin controls your protocol's mobility to implement its behaviour, so you should not use any other mobility plugin with it or implement any mobility behaviour in your protocol. The MobilityLeaderPlugin does not affect the node's movement and thus should be fine to use with other mobility plugin or mobility behaviour.
BROADCAST_TIMER_TAG = 'FollowMobilityPlugin__leader_broadcast_timer'
module-attribute
The leader will broadcast its position using a timer with this name, make sure it doesn't conflict with other timers
FOLLOWER_TAG = 'FollowMobilityPlugin__follower'
module-attribute
LEADER_TAG = 'FollowMobilityPlugin__leader'
module-attribute
The leader will broadcast its position using a packet with this tag, make sure it doesn't conflict with other packets
MobilityFollowerConfiguration
dataclass
Source code in gradysim/protocol/plugin/follow_mobility.py
auto_follow: bool = True
class-attribute
instance-attribute
Automatically follows the first leader available if set to True. If set to False, the user must call follow_leader manually. If True the user can still call follow_leader to follow a specific leader, but if connection to that leader is lost the follower will automatically follow the first leader available.
leader_timeout: float = 2
class-attribute
instance-attribute
After this amount of simulation seconds without receiving a broadcast from the leader, we consider it disconnected
scanning_interval: float = 0.5
class-attribute
instance-attribute
Interval between leader scans, in simulation seconds. The follower will update the list of leaders and the current leader.
MobilityFollowerPlugin
Source code in gradysim/protocol/plugin/follow_mobility.py
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 |
|
MobilityLeaderConfiguration
dataclass
Source code in gradysim/protocol/plugin/follow_mobility.py
broadcast_interval: float = 0.02
class-attribute
instance-attribute
The interval at which the leader broadcasts its position
follower_timeout: float = 5
class-attribute
instance-attribute
If we don't receive a message from a follower for this amount of simulation seconds we consider it disconnected