使用通信模块前的提交
添加速度改变
This commit is contained in:
parent
24a31c20c2
commit
a419289c91
@ -35,6 +35,11 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
TakeOff = 22,
|
TakeOff = 22,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 命令飞行器改变速度
|
||||||
|
/// </summary>
|
||||||
|
ChangeSpeed = 178,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 命令LED颜色改变
|
/// 命令LED颜色改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -57,6 +57,10 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Plane.Libraries\Plane.Windows.Messages\Plane.Windows.Messages.csproj">
|
||||||
|
<Project>{413C18E2-235F-4E15-B5C1-633657DE5D7A}</Project>
|
||||||
|
<Name>Plane.Windows.Messages</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\PlaneGcsSdk.Contract_Private\PlaneGcsSdk.Contract_Private.csproj">
|
<ProjectReference Include="..\PlaneGcsSdk.Contract_Private\PlaneGcsSdk.Contract_Private.csproj">
|
||||||
<Project>{47141894-ece3-48ca-8dcf-ca751bda231e}</Project>
|
<Project>{47141894-ece3-48ca-8dcf-ca751bda231e}</Project>
|
||||||
<Name>PlaneGcsSdk.Contract_Private</Name>
|
<Name>PlaneGcsSdk.Contract_Private</Name>
|
||||||
|
@ -44,6 +44,7 @@ namespace Plane.Communication
|
|||||||
}
|
}
|
||||||
_isBroken = false;
|
_isBroken = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_stream = _client.GetStream();
|
_stream = _client.GetStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,10 @@ namespace Plane.Communication
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _client.Available;
|
if (_client.Connected)
|
||||||
|
return _client.Available;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException ex)
|
catch (ObjectDisposedException ex)
|
||||||
{
|
{
|
||||||
@ -89,6 +92,7 @@ namespace Plane.Communication
|
|||||||
{
|
{
|
||||||
while (Available < count)
|
while (Available < count)
|
||||||
{
|
{
|
||||||
|
if (!IsOpen) return 0;
|
||||||
await Task.Delay(5).ConfigureAwait(false);
|
await Task.Delay(5).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
return await _stream.ReadAsync(buffer, offset, count);
|
return await _stream.ReadAsync(buffer, offset, count);
|
||||||
|
@ -198,5 +198,13 @@ namespace Plane.Copters
|
|||||||
G = green, //Green
|
G = green, //Green
|
||||||
B = blue //Blue
|
B = blue //Blue
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static IMission CreateChangeSpeedMission(float levelSpeed, float upSpeed, float downSpeed) => new Mission
|
||||||
|
{
|
||||||
|
Command = FlightCommand.ChangeSpeed,
|
||||||
|
Param1 = levelSpeed, //水平速度
|
||||||
|
Param2 = upSpeed, //上升速度
|
||||||
|
Param3 = downSpeed, //下降速度
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)CommunicationManagement\CommModule.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)CommunicationManagement\CommModule.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)CommunicationManagement\CommModulePacketAnalysis.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Communication\ExceptionThrownEventSource.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Communication\ExceptionThrownEventSource.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Communication\EmptyConnection.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Communication\EmptyConnection.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Communication\CompositeConnection.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Communication\CompositeConnection.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user