Commit 064ccf54 authored by roangel's avatar roangel
Browse files

Added link to use custom controller and safe controller. Need to see what...

Added link to use custom controller and safe controller. Need to see what happens if we change yaml file name on the run
parent 7e049134
......@@ -68,6 +68,12 @@ private slots:
void on_pushButton_3_clicked();
void on_load_yaml_button_clicked();
void on_en_custom_controller_clicked();
void on_en_safe_controller_clicked();
private:
Ui::MainWindow *ui;
......
......@@ -313,3 +313,22 @@ void MainWindow::on_pushButton_3_clicked()
this->crazyRadioCommandPublisher.publish(msg);
ROS_INFO("command disconnect published");
}
void MainWindow::on_load_yaml_button_clicked()
{
}
void MainWindow::on_en_custom_controller_clicked()
{
std_msgs::Int32 msg;
msg.data = CMD_USE_CUSTOM_CONTROLLER;
this->PPSClientCommandPublisher.publish(msg);
}
void MainWindow::on_en_safe_controller_clicked()
{
std_msgs::Int32 msg;
msg.data = CMD_USE_SAFE_CONTROLLER;
this->PPSClientCommandPublisher.publish(msg);
}
......@@ -320,9 +320,9 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="en_safe_controller">
<property name="text">
<string>Enable Controller</string>
<string>Enable Safe Controller</string>
</property>
</widget>
</item>
......@@ -601,9 +601,16 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="en_custom_controller">
<property name="text">
<string>Enable Controller</string>
<string>Enable Custom Controller</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="load_yaml_button">
<property name="text">
<string>Load YAML file</string>
</property>
</widget>
</item>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.2, 2017-08-29T16:03:13. -->
<!-- Written by QtCreator 4.0.2, 2017-08-29T18:10:33. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -292,7 +292,6 @@ if __name__ == '__main__':
time.sleep(1.0)
bag.close()
rospy.loginfo("bag closed")
......
......@@ -122,16 +122,18 @@ void loadSafeController() {
ROS_INFO_STREAM("loaded safe controller: " << safeController.getService());
}
void loadCustomController() {
void loadCustomController()
{
ros::NodeHandle nodeHandle("~");
std::string customControllerName;
if(!nodeHandle.getParam("customController", customControllerName)) {
if(!nodeHandle.getParam("customController", customControllerName))
{
ROS_ERROR("Failed to get custom controller name");
return;
}
customController = ros::service::createClient<Controller>(customControllerName, true);
customController = ros::service::createClient<Controller>(customControllerName, true);
ROS_INFO_STREAM("loaded custom controller " << customControllerName);
}
......@@ -443,11 +445,13 @@ void commandCallback(const std_msgs::Int32& commandMsg) {
switch(cmd) {
case CMD_USE_SAFE_CONTROLLER:
ROS_INFO("USE_SAFE_CONTROLLER Command received");
loadSafeController();
usingSafeController = true;
break;
case CMD_USE_CUSTOM_CONTROLLER:
ROS_INFO("USE_CUSTOM_CONTROLLER Command received");
loadCustomController();
usingSafeController = false;
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment