Skip to content

Commit

Permalink
Merge pull request #4 from NUS-Advanced-Robotics-Centre/respawn_objects
Browse files Browse the repository at this point in the history
New Version for Spring 2024
  • Loading branch information
SS47816 authored Mar 1, 2024
2 parents aba8269 + c145c53 commit 4e81a64
Show file tree
Hide file tree
Showing 52 changed files with 1,384 additions and 410 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NUS ME5413 Autonomous Mobile Robotics Final Project
![GitHub Repo stars](https://img.shields.io/github/stars/NUS-Advanced-Robotics-Centre/ME5413_Final_Project?color=FFE333)
![GitHub Repo forks](https://img.shields.io/github/forks/NUS-Advanced-Robotics-Centre/ME5413_Final_Project?color=FFE333)

![cover_image](src/me5413_world/media/gazebo_world.jpg)
![cover_image](src/me5413_world/media/gazebo_world.png)

## Dependencies

Expand Down Expand Up @@ -164,7 +164,7 @@ roslaunch me5413_world navigation.launch

* From the starting point, move to the given pose within each area in sequence
* Assembly Line 1, 2
* Packaging Area 1, 2, 3, 4
* Random Box 1, 2, 3, 4
* Delivery Vehicle 1, 2, 3
* We have provided you a GUI in RVIZ that allows you to click and publish these given goal poses to the `/move_base_simple/goal` topic:

Expand Down
133 changes: 64 additions & 69 deletions src/interactive_tools/include/interactive_tools/rviz_panel.hpp
Original file line number Diff line number Diff line change
@@ -1,91 +1,86 @@
/* rviz_panel.hpp
* Copyright (C) 2023 SS47816
* Rviz Panel for controling goal poses
**/

#ifndef rviz_panel_H_
#define rviz_panel_H_

#include <ros/ros.h>
#include <rviz/panel.h>

/**
#include <ui_simple_panel.h>
/**
* Include header generated from ui file
* Note that you will need to use add_library function first
* in order to generate the header file from ui.
*/
#include <ui_simple_panel.h>

// Other ROS dependencies
#include <std_msgs/Int16.h>
#include <std_msgs/String.h>

namespace rviz_panel
{
/**
* Here we declare our new subclass of rviz::Panel. Every panel which
* can be added via the Panels/Add_New_Panel menu is a subclass of
* rviz::Panel.
*/

class simplePanel : public rviz::Panel
{
/**
* This class uses Qt slots and is a subclass of QObject, so it needs
* the Q_OBJECT macro.
*/
Q_OBJECT

public:
#ifdef UNIT_TEST
friend class testClass;
#endif
/**
* QWidget subclass constructors usually take a parent widget
* parameter (which usually defaults to 0). At the same time,
* pluginlib::ClassLoader creates instances by calling the default
* constructor (with no arguments). Taking the parameter and giving
* a default of 0 lets the default constructor work and also lets
* someone using the class for something else to pass in a parent
* widget as they normally would with Qt.
*/
simplePanel(QWidget * parent = 0);
class simplePanel : public rviz::Panel
{
Q_OBJECT

/**
* Now we declare overrides of rviz::Panel functions for saving and
* loading data from the config file. Here the data is the topic name.
*/
virtual void save(rviz::Config config) const;
virtual void load(const rviz::Config & config);
public:
#ifdef UNIT_TEST
friend class testClass;
#endif
/**
* QWidget subclass constructors usually take a parent widget
* parameter (which usually defaults to 0). At the same time,
* pluginlib::ClassLoader creates instances by calling the default
* constructor (with no arguments). Taking the parameter and giving
* a default of 0 lets the default constructor work and also lets
* someone using the class for something else to pass in a parent
* widget as they normally would with Qt.
*/
simplePanel(QWidget *parent = 0);

/**
* Next come a couple of public Qt Slots.
*/
public Q_SLOTS:
/**
* Now we declare overrides of rviz::Panel functions for saving and
* loading data from the config file. Here the data is the topic name.
*/
virtual void save(rviz::Config config) const;
virtual void load(const rviz::Config &config);

/**
* Here we declare some internal slots.
*/
private Q_SLOTS:
// Assembly Line buttons
void on_button_1_1_clicked();
void on_button_1_2_clicked();
// Packaging Area buttons
void on_button_2_1_clicked();
void on_button_2_2_clicked();
void on_button_2_3_clicked();
void on_button_2_4_clicked();
// Delivery Vehicle buttons
void on_button_3_1_clicked();
void on_button_3_2_clicked();
void on_button_3_3_clicked();
public Q_SLOTS:
/**
* Here we declare some internal slots.
*/
private Q_SLOTS:
// Assembly Line buttons
void on_button_1_1_clicked();
void on_button_1_2_clicked();
// Packaging Area buttons
void on_button_2_1_clicked();
void on_button_2_2_clicked();
void on_button_2_3_clicked();
void on_button_2_4_clicked();
// Delivery Vehicle buttons
void on_button_3_1_clicked();
void on_button_3_2_clicked();
void on_button_3_3_clicked();
// Contorl Buttons
void on_button_regen_clicked();
void on_button_clear_clicked();

/**
* Finally, we close up with protected member variables
*/
protected:
// UI pointer
std::shared_ptr<Ui::two_button> ui_;
// ROS declaration
ros::NodeHandle nh_;
ros::Publisher pub_goal_;
std_msgs::String goal_name_msg_;
protected:
// UI pointer
std::shared_ptr<Ui::TaskControlPanel> ui_;
// ROS declaration
ros::NodeHandle nh_;
ros::Publisher pub_goal_;
ros::Publisher pub_respawn_;
std_msgs::String goal_name_msg_;
std_msgs::Int16 regen_cmd_msg_;
};

};
} // namespace rviz_panel

#endif
Loading

0 comments on commit 4e81a64

Please sign in to comment.