Skip to content

Scripts

rajat edited this page Oct 5, 2021 · 1 revision

Unity C# Scipts

A brief description of the scripts used is given below. Further documentation can be found within the scripts.

Scripts for Simulator

  1. AUVControl: This script uses a transform function to move the AUV body, disregarding its mass properties.

  2. Buoyancy:

    1. BoatPhysics: This script is attached to the vehicle and find the extract information about the location of the meshes.
    2. ModifyBoatMesh: Generates the mesh that’s below the water.
    3. TriangleData: Send the triangle information to other Buoyancy scripts.
    4. WaterController: Extract information about the water and water level to send to the other scripts.
  3. ButtonFunctions:

    1. Release the AUV from the control station when ’R’ is pressed.
    2. Control the button functions for the Front and Downward Illumination.
    3. Optional functions to switch camera views if the user doesn't want two camera views on the screen.
  4. Coordinates: Show the coordinates of the AUV and freezes them when 'M' is pressed to mark the Leak’s coordinates.

  5. FogStart: Switches on Unity's Fog when the vehicle's position is below the water level. The color of the fog is preset in Unity settings.

  6. ForceControls: Uses AddForce and AddTorque to make the vehicle move, thus providing a more realistic approach.

  7. PauseGame: A pause menu for the simulator to give the user more control over the scene and easy access to the main menu.

  8. SeabedScript: It calculates the following things:

    1. Vehicle’s Angular and Linear Velocity and convert them to scalar their respective scalars, i.e., Angular and Linear Speed.
    2. Acceleration of the Vehicle.
    3. Vehicle’s distance from the seabed.
    4. Vehicle’s depth, its surrounding Temperature, and Pressure.
    5. Vehicle’s distance from the control station.
    6. Controls the behavior of the Range warning, Proximity warning, and collision warning LEDs.
  9. StartScreen: Script controlling the main menu elements, including user input for IP address, port number, and mission timing. Takes these inputs, uses them in the simulator and redirects to the simulator screen when 'Start' is pressed.

  10. StartUnderwater: Starts the underwater distortion effects when a particular camera goes below the water level. It also plays the background sounds when the vehicle goes underwater.

  11. SwitchOffGravity: Used only when the Buoyancy scripts are not being used. Disables the gravity as soon as the vehicle enters the water to simulate a simple underwater environment.

  12. UIScript: Controls and Display the following UI elements:

    1. Speed
    2. Angular Speed
    3. Acceleration
    4. Temperature
    5. Pressure
    6. Depth
    7. Distance from the seabed
    8. Distance from the control station
    9. Remaining Battery
  13. UnderWaterEffects: Controls the parameters for underwater distortion effects. Called by 'StartUnderwater' to activate the effects on cameras.

  14. WaterAnim: Controls the caustic projection on object surfaces to create a lightning shift effect due to water.

Scripts for ROSBridge in ROSBFolder

  1. PoseSubscriber: Subscribes to a 'pose' topic used by control scripts for movement and function controls.
  2. TwistPublisher: A base publisher that can publish pose data.
  3. DataManager: Controls the publisher script to publish the required information.
  4. downcamPublisher: Compressed Image Publisher for the downward-facing camera.
  5. frontcamPublisher: Compressed Image Publisher for the forward-facing camera.
  6. ImagePublisher: Standard compressed image publisher used to transfer station camera feed to ROS.
  7. ImageTransfer: Encode the video feed into a string message which can then be used to call the StringImagePublisher to publish the video feed as a string topic type.
  8. RawImagePublisher1: A base Raw Image Publisher.
  9. ROSInitializer: Initializes the Rosbridge connection using the IP address entered in the start screen. Also, it encodes video feed by first projecting it on a texture and then publishing that texture as a compressed image.
  10. StringImagePublisher: A base publisher for String topic type, used to transfer video feed as string message type.
Clone this wiki locally