Ardupilot mobility
ArdupilotMobilityHandler serves as an alternate mobility implementation for traditional mobility commands.
gradysim.simulator.handler.ardupilot_mobility.ArdupilotMobilityHandler
Bases: INodeHandler
Introduces mobility into the simulatuon by communicating with a SITL-based simulation of the Node. Works by sending requests to UAV API library which connects to the Ardupilot software. It implements telemetry by constantly making requests to 'telemetry/ned' at a fixed rate and translating mobility commands into HTTP requests to UAV API
Source code in gradysim/simulator/handler/ardupilot_mobility.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |
__init__(configuration=ArdupilotMobilityConfiguration())
Constructor for the Ardupilot mobility handler
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration |
ArdupilotMobilityConfiguration
|
Configuration for the Ardupilot mobility handle. This includes parameters used in |
ArdupilotMobilityConfiguration()
|
Source code in gradysim/simulator/handler/ardupilot_mobility.py
finalize()
Ends simulation by finalizing report and shutting down drones.
Source code in gradysim/simulator/handler/ardupilot_mobility.py
handle_command(command, node)
Performs a mobility command in the SITL-based simulation. This method is called by the node's provider to transmit it's mobility command to the ardupilot mobility handler and then to the node's UAV API.
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/ardupilot_mobility.py
register_node(node)
Instantiates Drone object equivalent to the Node provided. Starts the UAV API process associated with this instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node |
Node
|
the Node instance that will be registered in the handler |
required |
Source code in gradysim/simulator/handler/ardupilot_mobility.py
gradysim.simulator.handler.ardupilot_mobility.ArdupilotMobilityConfiguration
dataclass
Configuration class for the Ardupilot mobility handler
Source code in gradysim/simulator/handler/ardupilot_mobility.py
ardupilot_path: str = None
class-attribute
instance-attribute
Path for cloned ardupilot repository. Used for SITL initialization when in simulated mode
default_speed: float = 10
class-attribute
instance-attribute
Default starting airspeed of a node in m/s
generate_report: bool = True
class-attribute
instance-attribute
Whether to output a report in the end of the simulation or not
ground_station_ip: str = None
class-attribute
instance-attribute
If provided and simulate_drones is True, this ip is used in UAV API to connect a GroundStation software to the simulated vehicle
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.
simulate_drones: bool = True
class-attribute
instance-attribute
Wheter to use SITL or connect to real vehicle
simulation_startup_speedup: int = 1
class-attribute
instance-attribute
Multiplier for SITL simulation time. This value will only affect the setup of the simulation, after all drones are positioned in the right place and are ready to start, the simulation time goes back to matching real time.
starting_api_port: int = 8000
class-attribute
instance-attribute
The port in which UAV API of Node 0 will run. Following nodes use the ports in sequence by the formula port_of_node_{node_id} = starting_api_port + {node_id}
uav_api_log_path: str = None
class-attribute
instance-attribute
Path in which UAV API will save log files. Used in simulated mode.
update_rate: float = 0.5
class-attribute
instance-attribute
Interval in simulation seconds between Ardupilot telemetry updates