53 lines
2.2 KiB
C#
53 lines
2.2 KiB
C#
using Plane.Communication;
|
|
using Plane.Copters;
|
|
using Plane.FormationCreator.Formation;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Plane.FormationCreator
|
|
{
|
|
public class Test
|
|
{
|
|
public Test(CopterManager copterManager)
|
|
{
|
|
_copterManager = copterManager;
|
|
}
|
|
|
|
private CopterManager _copterManager;
|
|
|
|
private ICopter[] _copters = new FakeCopter[]
|
|
{
|
|
//new FakeCopter(23.14973333, 113.40974166) { Id = "C1", Name = "C1", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500, Voltage = 10.6f },
|
|
//new FakeCopter(23.14973333, 113.40984166) { Id = "C2", Name = "C2", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500, Voltage = 12.6f },
|
|
//new FakeCopter(23.14973333, 113.40994166) { Id = "C3", Name = "C3", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500 },
|
|
//new FakeCopter(23.14973333, 113.41004166) { Id = "C4", Name = "C4", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500 },
|
|
//new FakeCopter(23.14973333, 113.41014166) { Id = "C5", Name = "C5", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500 },
|
|
//new FakeCopter(23.14973333, 113.41024166) { Id = "C6", Name = "C6", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500 },
|
|
//new FakeCopter(23.14973333, 113.41034166) { Id = "C7", Name = "C7", Channel1 = 1500, Channel2 = 1500, Channel3 = 1500, Channel4 = 1500 }
|
|
};
|
|
|
|
public Test Prepare()
|
|
{
|
|
foreach (var copter in _copters)
|
|
{
|
|
_copterManager.Copters.Add(copter);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public void Run()
|
|
{
|
|
foreach (var copter in _copters)
|
|
{
|
|
copter.ConnectAsync();
|
|
copter.GetCopterDataAsync();
|
|
}
|
|
//await FormationController.Instance.FlyInCircleAsync(_copterManager.Copters, 280, 15, clockwise: false);
|
|
//await FormationController.Instance.FlyToAltitudeAsync(_copterManager.Copters, 50);
|
|
}
|
|
}
|
|
}
|