/// <summary> /// Adds a multicopter to the simulation environment /// </summary> /// <param name="position">The initial start position</param> private void SimulatorAddMulticopterEntity(MulticopterType multicopterType, float propellerInclination) { _multicopterEntity = new MulticopterEntity(multicopterType, propellerInclination, INITIAL_MULTICOPTER_POSITION); _multicopterEntity.cameraView = _cameraView; _multicopterEntity.windowStatisticsEventsPort = _windowStatisticsEventsPort; _multicopterEntity.windowControlEventsPort = _windowControlEventsPort; SimulationEngine.GlobalInstancePort.Insert(_multicopterEntity); }
/// <summary> /// Creates a new multicopter entity /// </summary> /// <param name="name">The name of the entity</param> /// <param name="initialPos">The initial position for the multicopter to be placed</param> public MulticopterEntity(MulticopterType multicopterType, float propellerInclinationAngle, Vector3 initialPos) { // Save the initialization parameters this.multicopterType = multicopterType; this.propellerInclinationAngle = propellerInclinationAngle; this.initialPos = initialPos; // TO DO Entfernen Globals.currentMulticopterType = Globals.Instance.multicopterDesignation[multicopterType]; Globals.currentInclinationAngle = ((int)propellerInclinationAngle).ToString() + "°"; // InitializePlot vectors totalForceVector = new Vector3(); torqueVector = new Vector3(); windForceVector = new Vector3(); // InitializePlot the sound entity soundEntity = new SoundEntity(); soundEntity.PlaySound(); // InitializePlot miscellaneous InitializeWindowEventMessages(); InitializePIDController(); InitializeSimplexNoiseGenerators(); // Set the state name State.Name = Globals.Instance.multicopterDesignation[multicopterType]; // Set the mass densitiy. Mass equals weight of a single multicopter arm times the arms State.MassDensity.Mass = MULTICOPTER_ARM_MASS * Globals.Instance.multicopterPropellerCount[multicopterType]; State.MassDensity.Density = 0.0f; // Set the center of mass State.MassDensity.CenterOfMass = new Pose(new Vector3(0.0f, CHASSIS_DIMENSIONS_HEIGHT / 2, 0.0f)); // Simulate air resistance // TODO Impuls und Drehimpuls selbst anhand der Fläche simulieren State.MassDensity.LinearDamping = LINEAR_DAMPING; State.MassDensity.AngularDamping = ANGULAR_DAMPING; // Load and scale the 3D mesh of the multicopter State.Assets.Mesh = Globals.Instance.multicopterMeshFiles[multicopterType]; // Set mesh scale so 1.0f = 1 meter MeshScale = new Vector3(0.01f, 0.01f, 0.01f); InsertAttachedCameraEntity(); }
internal void SetInitialMulticopterSettings(MulticopterType multicopterType, float propellerInclination) { trackBarMulticopterType.Value = Globals.Instance.multicopterPropellerCount[multicopterType]; trackBarPropellerInclination.Value = (int)(propellerInclination * 10); }
public OnAction(OnActionActions action, MulticopterType multicopterType, float propellerInclination) { this.action = action; this.multicopterType = multicopterType; this.propellerInclination = propellerInclination; }