Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sv 13 driving mode switching #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
30 changes: 30 additions & 0 deletions qt-gui.workspace.user
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to resolve the merge conflicts in this file.


<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f4cc9e8d-34cc-4663-9466-ea6b16c693b9}</value>

=======
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f4cc9e8d-34cc-4663-9466-ea6b16c693b9}</value>
>>>>>>> 503295bb76816f9a6fad58a9cf7530f938e63b50
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
Expand Down Expand Up @@ -114,7 +120,13 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ROSProjectManager.ROSBuildConfiguration</value>
<<<<<<< HEAD

<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">0</value>

=======
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">0</value>
>>>>>>> 503295bb76816f9a6fad58a9cf7530f938e63b50
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.CMakeBuildType">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
Expand All @@ -137,7 +149,13 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ROSProjectManager.ROSBuildConfiguration</value>
<<<<<<< HEAD

<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>

=======
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>
>>>>>>> 503295bb76816f9a6fad58a9cf7530f938e63b50
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.CMakeBuildType">1</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
Expand All @@ -160,7 +178,13 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release with Debug Information</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ROSProjectManager.ROSBuildConfiguration</value>
<<<<<<< HEAD

<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>

=======
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>
>>>>>>> 503295bb76816f9a6fad58a9cf7530f938e63b50
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.CMakeBuildType">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
Expand All @@ -183,7 +207,13 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Minimum Size Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ROSProjectManager.ROSBuildConfiguration</value>
<<<<<<< HEAD

<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>

=======
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.BuildSystem">48753808</value>
>>>>>>> 503295bb76816f9a6fad58a9cf7530f938e63b50
<value type="int" key="ROSProjectManager.ROSBuildConfiguration.CMakeBuildType">3</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">4</value>
Expand Down
240 changes: 188 additions & 52 deletions src/gui/resources/main_window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import QtQuick 2.5
import QtQuick.Window 2.2
import bluesat.owr 1.0



Window {
id: main_window
width: 800
Expand Down Expand Up @@ -40,7 +38,6 @@ Window {
anchors.topMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0

ROSVideoComponent {
// @disable-check M16
objectName: "videoStream"
Expand Down Expand Up @@ -68,7 +65,6 @@ Window {
font.pixelSize: 12
}
}

}

Item {
Expand Down Expand Up @@ -99,20 +95,155 @@ Window {
// @disable-check M16
topic: qsTr("/rover/signal")
}
}

Item {
id: driving_mode_switching_container
anchors.bottomMargin: -255
anchors.leftMargin: -8
anchors.topMargin: 325
anchors.right: parent.right
anchors.rightMargin: 52
anchors.top: parent.top
anchors.left: logo.right
anchors.bottom: video_pane.top
ROSDrivingModeSwitching {
// @disable-check M16
objectName: "driving_mode_switching"
id: driving_mode_switching
// @disable-check M16`
anchors.bottom: parent.bottom
// @disable-check M16
anchors.bottomMargin: 0
// @disable-check M16
anchors.top: parent.top
// @disable-check M16
anchors.left: parent.left
// @disable-check M16
anchors.right: parent.right
// @disable-check M16
topic: qsTr("/rover/driving_mode_switching")
}

}

Item{
x:200
y:180
width:360
height:20
focus: true;
Keys.enabled: true;
Keys.forwardTo: [box_front,box_crab,box_four];

//rectangle for front wheel steering
Rectangle{
x:200
y:180
width:120
height:20
id: box_front
border.color: "black"
color:"white"
focus:true;
Text {
text: "front"
anchors.horizontalCenter:parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pointSize:12
font.bold:true
}
}

//rectangle for crab wheel steering
Rectangle{
x:320
y:180
width:120
height:20
id: box_crab
border.color:"black"
color:"white"
focus: true;
Text {

text: "crab"
anchors.centerIn: parent
font.pointSize:12
font.bold:true
}
}

//rectangle for four wheel steering
Rectangle{
x:440
y:180
width:120
height:20
id: box_four
border.color: "black"
color:"white"
focus:true;
Text {
text: "four"
anchors.horizontalCenter:parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pointSize:12
font.bold:true
}
}
//key press response
Keys.onPressed: {

switch(event.key){
//if A is pressed
//change color to red

case Qt.Key_A:
box_front.color = "red"
box_crab.color = "white";
box_four.color="white"
driving_mode_switching.sendmessage();
break;

//if S is pressed
//change color to red
case Qt.Key_S:
box_front.color = "white"
box_crab.color = "red";
box_four.color="white"
driving_mode_switching.sendmessage();
break;

//if D is pressed
//change color to red
case Qt.Key_D:
box_front.color="white"
box_crab.color = "white"
box_four.color = "red"
driving_mode_switching.sendmessage();
break;
default:
return;
}
event.accepted = true;
}

}


Item {
id: camera_switching_container
width: 50
height: 660
anchors.topMargin: 0
anchors.leftMargin: 0
anchors.rightMargin: -800
anchors.topMargin: 43
anchors.leftMargin: 27
anchors.rightMargin: -827
anchors.bottom: parent.top
anchors.right: parent.left
anchors.left: parent.left
anchors.top: parent.top
anchors.bottomMargin: -800
anchors.bottomMargin: -843

ROSCameraSwitching {
// @disable-check M16
Expand All @@ -135,7 +266,6 @@ Window {

// @disable-check M16
focus: true

Shortcut {
sequence: "0"
onActivated: camera_switching.camera_number = 0
Expand Down Expand Up @@ -169,41 +299,24 @@ Window {
onActivated: camera_switching.camera_number = 7
}

ROSJoystickListener {
// @disable-check M16
objectName: "bot_joystick"
// @disable-check M16
topic: "/joy"
// @disable-check M16
onButton_down: {
var start_number = camera_switching.camera_number;

// handle the case where no camera is selected
if(start_number < 0) {
start_number = 0;
}

if(button === 4) { // Left Buffer
camera_switching.camera_number = (start_number - 1) % 8;
} else if(button === 5) { // Right Buffer
camera_switching.camera_number = (start_number + 1) % 8;
}
}
}
}

}

DriveModeWidget {


DriveModeWidget {
id: drive_mode
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: signal_strength_container.left
anchors.leftMargin: 0
anchors.top: signal_strength_container.bottom
anchors.topMargin: 10
}
}


VoltageMeterWidget {
VoltageMeterWidget {
id: voltage_meter
anchors.right: parent.right
anchors.rightMargin: 0
Expand All @@ -213,24 +326,47 @@ Window {
anchors.topMargin: 30
}

ROSTimer {
// @disable-check M16
objectName: "timerDisplay"
id: timerDisplay
// @disable-check M16
anchors.bottom: video_pane.bottom
// @disable-check M16
anchors.bottomMargin: 5
// @disable-check M16
anchors.right: video_pane.right
// @disable-check M16
anchors.rightMargin: 5
// @disable-check M16
focus:true;
// @disable-check M16
width: 160
// @disable-check M16
height: 80

}
ROSTimer {
// @disable-check M16
objectName: "timerDisplay"
id: timerDisplay
// @disable-check M16
anchors.bottom: video_pane.bottom
// @disable-check M16
anchors.bottomMargin: 5
// @disable-check M16
anchors.right: video_pane.right
// @disable-check M16
anchors.rightMargin: 5
// @disable-check M16
focus:true;
// @disable-check M16
width: 160
// @disable-check M16
height: 80
}

ROSJoystickListener {
// @disable-check M16
objectName: "bot_joystick"
// @disable-check M16
topic: "/joy"
// @disable-check M16
onButton_down: {
var start_number = camera_switching.camera_number;

// handle the case where no camera is selected
if(start_number < 0) {
start_number = 0;
}

if(button === 4) { // Left Buffer
camera_switching.camera_number = (start_number - 1) % 8;
} else if(button === 5) { // Right Buffer
camera_switching.camera_number = (start_number + 1) % 8;
}
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary blank lines

Loading