-
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
base: master
Are you sure you want to change the base?
Conversation
…en A/S/D pressed the relavent mode will be red #time 8h
create a driving-mode-switching class with a publisher to report keypress event
@TomyangSydney Master has been updated, please re-merge and resolve conflicts. |
…. Some bugs may inside camera switching
e8030bf
to
2c93bd4
Compare
@@ -0,0 +1,86 @@ | |||
#include "ros_video_components/ros_driving_mode_switching.hpp" | |||
|
|||
#define RECT_X 0 |
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.
These #defines
are not being used anywhere, are they? I reckon get rid of all of these unnecessary #define
s
} | ||
} | ||
|
||
|
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.
Get rid of some of the unnecessary blank lines maybe?
int data; //the signal strength in decibels | ||
}; | ||
|
||
|
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.
Plenty of unnecessary blank lines 😄
|
||
|
||
|
||
void ROS_Driving_Mode_Switching::receive_signal(const std_msgs::Float32::ConstPtr & msg){ |
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.
Why is this function called receive_signal
? Should it not be something like receive_command
?
The reason I called this receive_signal
in my Signal Strength Indicator code is that this function was being used to receive the value of signal strength
@@ -14,9 +14,13 @@ | |||
#include "ros_video_components/ros_joystick_listener.hpp" | |||
#include "ros_video_components/ros_drive_mode.hpp" | |||
|
|||
//add the new include directory | |||
#include "ros_video_components/ros_driving_mode_switching.hpp" |
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.
Get rid of the comment above and make this #include
line 16
* ROS Package: owr_qtgui | ||
* @description: This code generates a publisher called signal_pub, which will make a variable called a increase by 1 | ||
* when keyA/S/D are pressed and print it out | ||
* @copyright: This code is released under the MIT [GPL for embeded] License. Copyright BLUEsat UNSW, 2017 |
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.
Should be 2018
instead of 2017
. Also, get rid of the [GPL for embedded]
part
/** | ||
* Date Started: 28/07/18 | ||
* @author: [Linchuan YANG] | ||
* @authors: (Editors) [Editor 1], [Editor 2] |
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.
Make @authors
@editors
and keep the right hand side empty
} | ||
|
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.
Unnecessary blank lines
src/gui/resources/main_window.qml
Outdated
Keys.onPressed: { | ||
|
||
|
||
switch(event.key){ |
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
qt-gui.workspace.user.5a83cd3
Outdated
@@ -0,0 +1,246 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
Run the command git rm qt-gui.workspace.user.5a83cd3
to get rid of this file. I don't think this file should be committed to git.
…-qtgui into SV-13-Driving-Mode-Switching
…ch the order of camera switching and driving mode switching in the qml file
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.
I can confirm that the visuals work, but I believe the drive-mode does not actually change.
QQuickPaintedItem(parent), | ||
topic_value("/rover/driving_mode_switching/"), | ||
ros_ready(false), | ||
a(0), |
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.
a(0), |
msg.data = 1000; | ||
drive_mode_pub.publish(msg); | ||
//when the key 'A/S/D'pressed, a should add 1 | ||
a++; |
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.
a++; |
drive_mode_pub.publish(msg); | ||
//when the key 'A/S/D'pressed, a should add 1 | ||
a++; | ||
ROS_INFO("value is %d",a); |
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.
ROS_INFO("value is %d",a); |
|
||
void ROS_Driving_Mode_Switching::receive_drive_mode_command(const std_msgs::Float32::ConstPtr & msg){ | ||
data = msg->data; | ||
ROS_INFO("Received signal message"); |
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.
ROS_INFO("Received signal message"); | |
ROS_INFO("Received update for drive mode"); |
} | ||
|
||
void ROS_Driving_Mode_Switching::set_topic(const QString & new_value) { | ||
ROS_INFO("set_topic"); |
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.
Unnecessary print, I think.
std_msgs::Float32 msg; | ||
msg.data = 1000; | ||
drive_mode_pub.publish(msg); | ||
//when the key 'A/S/D'pressed, a should add 1 |
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.
Is this variable necessary? It also risks an unlikely case of integer overflow
@@ -19,7 +19,7 @@ | |||
#include <ros/ros.h> | |||
#include <image_transport/image_transport.h> | |||
#include <sensor_msgs/Image.h> | |||
#include "owr_messages/activeCameras.h" | |||
//#include "owr_messages/activeCameras.h" |
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.
//#include "owr_messages/activeCameras.h" |
ros::Publisher drive_mode_pub; | ||
QString topic_value; | ||
bool ros_ready; | ||
int a; |
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.
Unnecessary variable
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you comment the stopwatch in?
@@ -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 |
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.
You may want to resolve the merge conflicts in this file.
SV-13 is about driving mode switching. Key 'A' represents front wheel steering, Key 'B' represents crab steering , Keys 'D' represent four wheel steering. When certain keys are pressed, certain block on GUI should becomes red.
I add a publisher to the GUI so that when key pressing is detected, the variable 'a' should increase by 1 and send through topic 'ros_driving_mode_switching'. The value of a should be visualized on the screen