Devlog #2 - Training My Drone: Flight Controls
drone controls
Scripts
public class DroneInputHandler : MonoBehaviour
// Properties public Vector2 Cyclic { get => cyclic; } public float Pedals { get => pedals; } public float Throttle { get => throttle; }
The DroneInputHandler.cs script handles the player input using Unity's new input system. It requires a PlayerInput component provided by Unity, which allows the input to receive messages from the script created.
public class DroneRigidbody : MonoBehaviour
private void FixedUpdate() { HandleDronePhysics(); } protected virtual void HandleDronePhysics() { }
The DroneRigidbody.cs script utilises the default rigidbody component provided by Unity, allowing me to customise the properties via code. It also allows me to seperate code into specific scripts. For this script, I created a protected virtual function that can be inherited in another script.
public class DroneController : DroneRigibody
protected override void HandleDronePhysics() { HandleDroneControls(); }
This script inherits from the drone rigidbody, which allows it to access any protected functions or variables. I overrode the HandleDronePhysics() function, which enables me to add any physics-related functionality.
References
Digital Media Final Project
Training Autonomous Drones with Reinforcement Learning.
Status | In development |
Author | Shivani |
Genre | Simulation |
More posts
- Devlog #7 - Training My Drone: Curriculum Learning for Search Tasks4 days ago
- Devlog #6 - Training My Drone: Custom PPO Configuration4 days ago
- Devlog #5 - Training My Drone: Battery Awareness11 days ago
- Devlog #4 - Training My Drone: Target Collection Basics23 days ago
- Devlog #3 - Training My Drone: ML-Agents Setup23 days ago
- Devlog #1 - Final Project Concept23 days ago
Leave a comment
Log in with itch.io to leave a comment.