Skip to content

Commit

Permalink
Removed MARS and video2 sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Lesches committed Sep 20, 2023
1 parent f317146 commit 1651f6d
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 176 deletions.
1 change: 0 additions & 1 deletion lib/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export "src/models/view/timer.dart";
export "src/models/view/builders/autonomy_command.dart";
export "src/models/view/builders/gps.dart";
export "src/models/view/builders/science_command.dart";
export "src/models/view/builders/mars_command.dart";
export "src/models/view/builders/builder.dart";
export "src/models/view/builders/color_builder.dart";
export "src/models/view/builders/settings_builder.dart";
Expand Down
1 change: 0 additions & 1 deletion lib/pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ library pages;

export "src/pages/autonomy.dart";
export "src/pages/home.dart";
export "src/pages/mars.dart";
export "src/pages/science.dart";
export "src/pages/settings.dart";
export "src/pages/splash.dart";
Expand Down
5 changes: 1 addition & 4 deletions lib/src/data/metrics/position.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "package:rover_dashboard/data.dart";
import "package:rover_dashboard/models.dart";

/// Metrics about the rover's position and orientation.
///
Expand Down Expand Up @@ -51,9 +50,7 @@ class PositionMetrics extends Metrics<RoverPosition> {
if(data.orientation.z > 360 || data.orientation.z < -360){
data.orientation.z = oldOrientation.z;
notifyListeners();
}
models.sockets.mars.sendMessage(MarsCommand(rover: value.gps));

}
}

/// The angle to orient the rover on the top-down map.
Expand Down
20 changes: 1 addition & 19 deletions lib/src/models/data/sockets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ class Sockets extends Model {
messageHandler: models.messages.onMessage,
);

/// A UDP socket for receiving video.
late final video2 = DashboardSocket(
device: Device.VIDEO,
onConnect: onConnect,
onDisconnect: onDisconnect,
messageHandler: models.messages.onMessage,
);

/// A UDP socket for controlling autonomy.
late final autonomy = DashboardSocket(
device: Device.AUTONOMY,
Expand All @@ -38,16 +30,8 @@ class Sockets extends Model {
messageHandler: models.messages.onMessage,
);

/// A UDP socket for controlling the MARS subsystem.
late final mars = DashboardSocket(
device: Device.MARS_SERVER,
onConnect: onConnect,
onDisconnect: onDisconnect,
messageHandler: models.messages.onMessage,
);

/// A list of all the sockets this model manages.
List<DashboardSocket> get sockets => [data, video, video2, autonomy, mars];
List<DashboardSocket> get sockets => [data, video, autonomy];

/// The rover-like system currently in use.
RoverType rover = RoverType.rover;
Expand Down Expand Up @@ -106,9 +90,7 @@ class Sockets extends Model {
final settings = models.settings.network;
data.destination = settings.subsystemsSocket.copyWith(address: addressOverride);
video.destination = settings.videoSocket.copyWith(address: addressOverride);
video2.destination = SocketInfo(address: InternetAddress("192.168.1.30"), port: 8007);
autonomy.destination = settings.autonomySocket.copyWith(address: addressOverride);
mars.destination = settings.marsSocket.copyWith(address: addressOverride);
await reset();
}

Expand Down
3 changes: 1 addition & 2 deletions lib/src/models/data/views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ViewsSelector extends StatelessWidget {
for (final view in DashboardView.cameraViews) PopupMenuItem(
value: view,
child: Row(children: [
if (models.sockets.video.isConnected || models.sockets.video2.isConnected) ...[getCameraStatus(view), const SizedBox(width: 8)],
if (models.sockets.video.isConnected) ...[getCameraStatus(view), const SizedBox(width: 8)],
Text(view.name),
],),
),
Expand Down Expand Up @@ -83,7 +83,6 @@ class DashboardView {
static final List<DashboardView> uiViews = [
DashboardView(name: Routes.science, builder: (context) => SciencePage()),
DashboardView(name: Routes.autonomy, builder: (context) => MapPage()),
DashboardView(name: Routes.mars, builder: (context) => MarsPage()),
];

/// A blank view.
Expand Down
1 change: 0 additions & 1 deletion lib/src/models/rover/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class RoverSettings extends Model {
final message = UpdateSetting(status: value);
models.sockets.video.sendMessage(message);
models.sockets.autonomy.sendMessage(message);
models.sockets.mars.sendMessage(message);

if (!await tryChangeSettings(message)) return;
models.home.setMessage(severity: Severity.info, text: "Set mode to ${value.humanName}");
Expand Down
35 changes: 0 additions & 35 deletions lib/src/models/view/builders/mars_command.dart

This file was deleted.

101 changes: 0 additions & 101 deletions lib/src/pages/mars.dart

This file was deleted.

4 changes: 2 additions & 2 deletions lib/src/widgets/atomic/video_feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class VideoFeedState extends State<VideoFeed> {
width: double.infinity,
padding: const EdgeInsets.all(4),
alignment: Alignment.center,
child: (models.sockets.video.isConnected || models.sockets.video2.isConnected) && imageLoader.hasImage && data.details.status == CameraStatus.CAMERA_ENABLED
child: models.sockets.video.isConnected && imageLoader.hasImage && data.details.status == CameraStatus.CAMERA_ENABLED
? Row(children: [
Expanded(child: RawImage(image: imageLoader.image, fit: BoxFit.contain)),
],)
Expand Down Expand Up @@ -140,7 +140,7 @@ class VideoFeedState extends State<VideoFeed> {

/// Displays an error message describing why `image == null`.
String get errorMessage {
if (!models.sockets.video.isConnected && !models.sockets.video2.isConnected) return "The video program is not connected";
if (!models.sockets.video.isConnected) return "The video program is not connected";
switch (data.details.status) {
case CameraStatus.CAMERA_LOADING: return "Camera is loading...";
case CameraStatus.CAMERA_STATUS_UNDEFINED: return "Unknown error";
Expand Down
14 changes: 4 additions & 10 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: rover_dashboard
description: Graphical application for remotely operating the rover.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 2023.9.20+2
version: 2023.9.20+3

environment:
sdk: "^3.0.0"
Expand Down Expand Up @@ -35,21 +35,15 @@ dev_dependencies:
very_good_analysis: ^5.0.0+1

# Do not modify this section unless you know what it does and why you need it.
# If you do need to override any dependencies, document which ones, which versions, and why.
# dependency_overrides:
# win32_gamepad needs win32 ^4.0.0
# path_provider_windows needs win32 <4.0.0
# So, this is the latest version of win32 before 4.0.0
# win32: 3.1.4

# Generates icons for the given platforms
# Run: flutter pub run icons_launcher:create
icons_launcher:
image_path: "assets/logo.png"
platforms:
android:
# adaptive_foreground_image: "assets/logo.png"
# adaptive_background_color: "#000000"
# adaptive_monochrome_image: "assets/logo.png"
enable: true
windows:
enable: true
Expand All @@ -61,9 +55,9 @@ flutter_launcher_icons:
generate: true

# Builds a Windows .msix App Installer file for the Dashboard.
# Run: flutter pub run msix:create
# Command: dart run msix:create
msix_config:
msix_version: 2023.9.20.2
msix_version: 2023.9.20.3
display_name: Dashboard
publisher_display_name: Binghamton University Rover Team
identity_name: edu.binghamton.rover
Expand Down

0 comments on commit 1651f6d

Please sign in to comment.