-
Notifications
You must be signed in to change notification settings - Fork 3
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
TomyangSydney
wants to merge
8
commits into
master
Choose a base branch
from
SV-13-Driving-Mode-Switching
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b3b21a7
SV-13 #comment Switching Mode Indicator Finished SV-13 26/05/18 8h Wh…
TomyangSydney 363c4cd
widget responding to keypress SV-13 #time 40h
TomyangSydney bcd3adb
SV-13 change the code style according to the style guide line
TomyangSydney e8030bf
Merge branch 'master' into SV-13-Driving-Mode-Switching
TomyangSydney 2c93bd4
Fix some bugs in SV-13-Driving-Mode-Switching when merge master to it…
TomyangSydney 503295b
Make some changes to the SV-13 code to improve the readability and fo…
TomyangSydney 829d845
Merge branch 'SV-13-Driving-Mode-Switching' of github.com:bluesat/owr…
sajidanower23 051b2e3
SV-13 Driving Mode Switching, fix some problems in the qml file. Swit…
TomyangSydney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,6 @@ Window { | |
anchors.topMargin: 0 | ||
anchors.bottom: parent.bottom | ||
anchors.bottomMargin: 0 | ||
|
||
ROSVideoComponent { | ||
// @disable-check M16 | ||
objectName: "videoStream" | ||
|
@@ -68,7 +67,6 @@ Window { | |
font.pixelSize: 12 | ||
} | ||
} | ||
|
||
} | ||
|
||
Item { | ||
|
@@ -99,8 +97,8 @@ Window { | |
// @disable-check M16 | ||
topic: qsTr("/rover/signal") | ||
} | ||
|
||
} | ||
|
||
Item{ | ||
id: camera_switching_container | ||
width: 50 | ||
|
@@ -133,9 +131,7 @@ Window { | |
// @disable-check M16 | ||
topic: qsTr("/owr/control/availableFeeds") | ||
|
||
// @disable-check M16 | ||
focus: true | ||
|
||
//focus:true; | ||
Shortcut { | ||
sequence: "0" | ||
onActivated: camera_switching.camera_number = 0 | ||
|
@@ -169,41 +165,158 @@ Window { | |
onActivated: camera_switching.camera_number = 7 | ||
} | ||
|
||
ROSJoystickListener { | ||
// @disable-check M16 | ||
objectName: "bot_joystick" | ||
// @disable-check M16 | ||
topic: "/joy" | ||
} | ||
|
||
} | ||
|
||
Item { | ||
id: driving_mode_switching_container | ||
anchors.bottomMargin: -94 | ||
anchors.leftMargin: -494 | ||
anchors.topMargin: 164 | ||
anchors.right: parent.right | ||
anchors.rightMargin: 538 | ||
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") | ||
} | ||
|
||
} | ||
|
||
Rectangle{ | ||
x:80 | ||
y:100 | ||
width:360 | ||
height:20 | ||
focus: true; | ||
Keys.enabled: true; | ||
Keys.forwardTo: [box_front,box_crab,box_four,ROSTimer]; | ||
|
||
//rectangle for front wheel steering | ||
Rectangle{ | ||
x:200 | ||
y:180 | ||
width:120 | ||
height:20 | ||
id: box_front | ||
border.color: "black" | ||
color:"white" | ||
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" | ||
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" | ||
Text { | ||
text: "four" | ||
anchors.horizontalCenter:parent.horizontalCenter | ||
anchors.verticalCenter: parent.verticalCenter | ||
font.pointSize:12 | ||
font.bold:true | ||
} | ||
// @disable-check M16 | ||
onButton_down: { | ||
var start_number = camera_switching.camera_number; | ||
//focus: true | ||
|
||
// handle the case where no camera is selected | ||
if(start_number < 0) { | ||
start_number = 0; | ||
} | ||
//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(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; | ||
//if r 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; | ||
|
||
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; | ||
//Keys.enable = false; | ||
} | ||
} | ||
} | ||
} | ||
|
||
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 | ||
|
@@ -213,7 +326,8 @@ Window { | |
anchors.topMargin: 30 | ||
} | ||
|
||
ROSTimer { | ||
|
||
ROSTimer { | ||
// @disable-check M16 | ||
objectName: "timerDisplay" | ||
id: timerDisplay | ||
|
@@ -232,5 +346,38 @@ Window { | |
// @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; | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary blank lines |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#include <QDebug> | ||
#include "ros_video_components/ros_video_component.hpp" | ||
#include "ros_video_components/ros_signal_strength.hpp" | ||
#include "ros_video_components/ros_driving_mode_switching.hpp" | ||
#include "ros_video_components/ros_voltage_meter.hpp" | ||
#include "ros_video_components/ros_camera_switching.hpp" | ||
#include "ros_video_components/ros_timer.hpp" | ||
|
@@ -14,6 +15,7 @@ Main_Application::Main_Application() {} | |
void Main_Application::run() { | ||
qmlRegisterType<ROS_Video_Component>("bluesat.owr", 1, 0, "ROSVideoComponent"); | ||
qmlRegisterType<ROS_Signal_Strength>("bluesat.owr", 1, 0, "ROSSignalStrength"); | ||
qmlRegisterType<ROS_Driving_Mode_Switching>("bluesat.owr", 1, 0, "ROSDrivingModeSwitching"); | ||
qmlRegisterType<ROS_Voltage_Meter>("bluesat.owr", 1, 0, "ROSVoltageMeter"); | ||
qmlRegisterType<ROS_Camera_Switching>("bluesat.owr", 1, 0, "ROSCameraSwitching"); | ||
qmlRegisterType<ROSTimer>("bluesat.owr", 1, 0, "ROSTimer"); | ||
|
@@ -36,6 +38,9 @@ void Main_Application::run() { | |
ROS_Signal_Strength * signal_strength = this->rootObjects()[0]->findChild<ROS_Signal_Strength*>(QString("signal_strength")); | ||
signal_strength->setup(&nh); | ||
|
||
ROS_Driving_Mode_Switching* driving_mode_switching = this->rootObjects()[0]->findChild<ROS_Driving_Mode_Switching*>(QString("driving_mode_switching")); | ||
driving_mode_switching ->setup(&nh); | ||
|
||
ROS_Voltage_Meter * voltage_meter = this->rootObjects()[0]->findChild<ROS_Voltage_Meter*>(QString("voltage_meter")); | ||
voltage_meter->setup(&nh); | ||
|
||
|
@@ -51,11 +56,11 @@ void Main_Application::run() { | |
// setup the timer | ||
ROSTimer * stopwatch = this->rootObjects()[0]->findChild<ROSTimer *>(QString("timerDisplay")); | ||
// the following code section is for debugging | ||
/* | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you comment the stopwatch in? |
||
if (stopwatch != NULL) { | ||
connect(stopwatch, SIGNAL(valueChanged(QString)), this, SLOT(handle(QString))); | ||
} | ||
*/ | ||
|
||
} | ||
|
||
void Main_Application::main_loop() { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De-indent this line a bit