VRAD Martian Survival User Guide 2021-22

bool VRADDrone.request(id) - Requests control of the specified drone. If somebody else owns the drone, the current owner will receive a popup and they can accept or deny the request. float array VRADDrone.get_base_position(base_number) - Get the x,y,z coordinates of the specified base float array VRADDrone.get_gps(team, id) - Get the x,y,z coordinates of the specified drone. team is a string, either “red” or “blue” (internally use 0 for red, 1 for blue) float array VRADDrone.get_chargers() - Get the x, z coordinates of the discovered chargers. Returned in the form of a 2d array. float array VRADDrone.get_mines() - Get the x, z coordinates of the discovered mines. Returned in the form of a 2d array. drone1 / drone2 / drone3 / drone4 to reference drones 1-4. (Each drone is represented as an object, use the drone API methods below to instruct each drone on what behaviour to follow, example: drone1.take_off(5) )

currentDrone refers to the drone that the camera is currently fixated on, you can change this using the command:

VRADDrone.take_control(drone#);

example : VRADDrone.take_control(3); would change the camera to focus on drone3 and allow you to reference drone3 using the currentDrone object.

A.3 Drone API

Methods (functions returning bool are indicating success/failure): bool check_owner() - Returns false if you have ownership of the specified drone. True otherwise. Check if drone has other owner. string get_class()- Returns class of the drone referenced. bool set_class(type) - Sets the class of the drone referenced, must pass in as string eg: drone2.set_clas s(‘conman’); float get_heading() - In range [-180, 180). Ownership not required for this method float array get_gps() - Ownership not required for this method int get_currently_carrying()- Number of objects currently in cargo float get_battery()- In range [0, 1] returns battery remaining dictionary get_ir_data() - { forward: { name: “mine”/”charger”/”ground”, distance: 1.23 }, left: { etc } } bool toggle_sensors(enable)- Enable or disable sensors by passing a boolean value eg: drone3.toggle_sensors(True); bool move_forward(dst)- Moves the drone forward (pitch forward)

22

Made with FlippingBook HTML5