Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Add option to disable camera controller
Browse files Browse the repository at this point in the history
  • Loading branch information
dmweis committed Dec 15, 2017
1 parent ac3ac95 commit cab0568
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Quadruped.WebInterface/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton<InterpolationGaitEngine>();
services.AddSingleton<InterpolationController>();
services.AddSingleton<IRobot, Robot>();
services.AddSingleton<ICameraController, CameraController>();
services.AddSingleton<IVideoService, VideoStreamingService>();
if (Configuration.GetSection("streamerConfig").GetValue<bool>("ControllerOn"))
{
services.AddSingleton<ICameraController, CameraController>();
services.AddSingleton<IVideoService, VideoStreamingService>();
}
else
{
services.AddSingleton<IVideoService, MockVideoStream>();
services.AddSingleton<ICameraController, CameraControllerMock>();
}
}

services.AddSingleton<IImuService, NetworkImuService>();
Expand Down
8 changes: 7 additions & 1 deletion Quadruped.WebInterface/VideoStreaming/StreamerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Quadruped.WebInterface.VideoStreaming
{
public class StreamerConfig : IEquatable<StreamerConfig>
{
public bool ControllerOn { get; set; } = true;
public int ImageQuality { get; set; } = 85;
public int HorizontalResolution { get; set; } = 800;
public int VerticalResolution { get; set; } = 600;
Expand All @@ -13,7 +14,11 @@ public bool Equals(StreamerConfig other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return ImageQuality == other.ImageQuality && HorizontalResolution == other.HorizontalResolution && VerticalResolution == other.VerticalResolution && Framerate == other.Framerate;
return ControllerOn == other.ControllerOn &&
ImageQuality == other.ImageQuality &&
HorizontalResolution == other.HorizontalResolution &&
VerticalResolution == other.VerticalResolution &&
Framerate == other.Framerate;
}

public override bool Equals(object obj)
Expand All @@ -32,6 +37,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ HorizontalResolution;
hashCode = (hashCode * 397) ^ VerticalResolution;
hashCode = (hashCode * 397) ^ Framerate;
hashCode = (hashCode * 397) ^ ControllerOn.GetHashCode();
return hashCode;
}
}
Expand Down
1 change: 1 addition & 0 deletions Quadruped.WebInterface/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}
},
"streamerConfig": {
"ControllerOn": false,
"ImageQuality": 85,
"HorizontalResolution": 480,
"VerticalResolution": 240,
Expand Down

0 comments on commit cab0568

Please sign in to comment.