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

Conversation

TomyangSydney
Copy link
Contributor

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

…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
@wmpmiles
Copy link

@TomyangSydney Master has been updated, please re-merge and resolve conflicts.

@@ -0,0 +1,86 @@
#include "ros_video_components/ros_driving_mode_switching.hpp"

#define RECT_X 0
Copy link
Contributor

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 #defines

}
}


Copy link
Contributor

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
};


Copy link
Contributor

@sajidanower23 sajidanower23 Sep 20, 2018

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){
Copy link
Contributor

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"
Copy link
Contributor

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
Copy link
Contributor

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]
Copy link
Contributor

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

}

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

Keys.onPressed: {


switch(event.key){
Copy link
Contributor

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

@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

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.

Copy link
Contributor

@sajidanower23 sajidanower23 left a 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),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
a(0),

msg.data = 1000;
drive_mode_pub.publish(msg);
//when the key 'A/S/D'pressed, a should add 1
a++;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
a++;

drive_mode_pub.publish(msg);
//when the key 'A/S/D'pressed, a should add 1
a++;
ROS_INFO("value is %d",a);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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");
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//#include "owr_messages/activeCameras.h"

ros::Publisher drive_mode_pub;
QString topic_value;
bool ros_ready;
int a;
Copy link
Contributor

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
/*

Copy link
Contributor

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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants