ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Piero-31's profile - activity

2019-07-11 09:13:21 -0500 received badge  Famous Question (source)
2019-01-08 07:06:55 -0500 received badge  Student (source)
2019-01-08 07:06:48 -0500 received badge  Good Answer (source)
2019-01-08 07:06:48 -0500 received badge  Enlightened (source)
2018-09-19 14:19:43 -0500 marked best answer Impossible to make a plugin with the tutorial

Hi,

I am following the 'Writing and Using a Simple Plugin' tutorial (here) but I can't compile my code. I am on Ubuntu 14.04 and I use ROS indigo. I use C++.

When I use catkin_make the terminal returns :

/home/pierre/catkin_ws/src/pluginlib_tutorials_/src/polygon_plugins.cpp:2:47: fatal error: pluginlib_tutorials_/polygon_base.h: Aucun fichier ou dossier de ce type (No files or folders of this type)

and

make[2]: *** [pluginlib_tutorials_/CMakeFiles/polygon_plugins.dir/src/polygon_plugins.cpp.o] Erreur 1
make[1]: *** [pluginlib_tutorials_/CMakeFiles/polygon_plugins.dir/all] Erreur 2

make: *** [all] Erreur 2
Invoking "make -j2 -l2" failed

I have followed every steps of the tutorials and I have tried to re start from the beginning twice. Does someone know what I must do ?

2018-03-02 19:15:34 -0500 marked best answer How can I do a GUI ?

Hi,

I am working on a project to create a GUI which would interact with a robot using ROS. It's something relatively new for me.

I have done the beginner tutorial for ROS. Then I have seen that maybe I could create a GUI with Qt so I have started a tutorial to use this framework. But I have seen that there is also the software framework rqt of ROS that could do a GUI. I don't understand if I can still do my GUI on Qt and then imported it in ROS to use it. Because I have tried to make the tutorial of rqt but I don't understant anything :/ I did not understand the plugins and how I am supposed to create a GUI with rqt reading the tutorial. Qt seems easier for me to use.

Can someone tell me if I can use Qt ? Or if not can someone help me to understand what I should do with rqt ? (or explain me the tutorial because I don't find where I should start and what to do with the tutorial of rqt).

Thank you,

Pierre.

EDIT : Actually, I have already a program using ROS which controls my robot. What I want is to create a GUI which would enable me to change graphically the parameters of the robot for example.

2017-11-12 18:06:52 -0500 received badge  Notable Question (source)
2017-05-10 15:12:07 -0500 received badge  Famous Question (source)
2017-04-10 04:19:51 -0500 received badge  Nice Answer (source)
2016-11-08 16:23:45 -0500 received badge  Teacher (source)
2016-11-08 16:23:45 -0500 received badge  Self-Learner (source)
2016-11-03 13:32:21 -0500 received badge  Famous Question (source)
2016-10-05 01:24:42 -0500 received badge  Famous Question (source)
2016-09-02 05:58:42 -0500 received badge  Notable Question (source)
2016-09-01 22:55:20 -0500 commented question My terminal opens then closes after roslaunch command

Do you mean that I have to remove : launch-prefix="gnome-terminal --command" ? when I do that it's worst and the roslaunch command doesn't even work.

2016-08-25 01:34:59 -0500 received badge  Popular Question (source)
2016-08-23 21:10:52 -0500 asked a question My terminal opens then closes after roslaunch command

Hello,

I have a problem when I use the roslaunch command to launch several executables. When I roslaunch my package, it should open 3 terminals and make the different command lines that I have put in 3 different scripts. But for one of these, the terminal opens and then closes immediately. I don't understand, because when I enter the command lines manually to launch this executable, it works.

Here is the script of my executable (its name is generation.sh) :

source catkin_ws/devel/setup.bash
rosrun rqt_mypkg generation

and the script of my launch file (test.launch) about this executable is :

<launch>
    <node name="gaitnode" pkg="rqt_mypkg" type="generation.sh" output="screen" launch-prefix="gnome-terminal --command" />
</launch>

I have made the executable executable and catkin_make my package without problem. I'm on ROS indigo and ubuntu 14.04.

So when I roslaunch it with :

roslaunch rqt_mypkg test.launch

for this executable the terminal opens, there is a message with source : not found, and then it closes. Normally the program should run and the terminal stay open. It works when I enter the commands manually.

Any explanation please ?

Thank you !

2016-07-22 22:40:38 -0500 received badge  Popular Question (source)
2016-07-18 18:41:54 -0500 commented answer Can I run a bash script using roslaunch?

I did not understand what is that. Webots replaces roslaunch ? The executable is a webots ? Where does this link talk about executable ?

2016-07-18 18:06:10 -0500 received badge  Associate Editor (source)
2016-07-18 18:05:44 -0500 asked a question roslaunch a plugin and an executable

Hi !

I would like to use only one command to launch a rqt plugin (an interface interacting with an executable, I would like to open rqt in fact), the executable, a ros serial command and roscore.I supposed that I must use roslaunch and create a launch file but I don't find anything explaining how launching that type of things. The tutorial only talks about nodes. How can I launch rqt ? how can I launch the command line ? I have already looked on this and this. Is there any help somewhere ?

Thank you !

2016-07-13 16:24:12 -0500 commented answer Impossible to make a plugin with the tutorial

I have said that in other questions.And then if you didn't claime that, stop redirecting people to it.

2016-07-12 16:51:20 -0500 commented answer Impossible to make a plugin with the tutorial

If all you can do is redirect me to a tutorial, this will not be a big loss thank you.

2016-07-12 16:49:13 -0500 commented answer Impossible to make a plugin with the tutorial

Then maybe you should stop thinking that people haven't searched before posting a question in this forum. And maybe you should realise that the tutorials of ROS are not perfect, incomplete, and sometimes difficult to understand so it's not helpfull to redirect people to iit.

2016-07-11 19:22:03 -0500 received badge  Notable Question (source)
2016-07-11 17:15:36 -0500 received badge  Supporter (source)
2016-07-11 17:01:09 -0500 answered a question How to connect a signal to a publisher

I finally succeeded. Here are my different files, I hope it will help some users.

In fact I had to create a SLOT, in which one I put a publisher to send a message containing a value. This publisher is made following the tutorial but there are differencies. The subscriber is in another file and made following the tutorial too. In the cpp file my_plugin.cpp, you can add everything you want to design your Qt interface, like new signals, slots, layout...

The "outputVal(int)" SLOT is a SLOT that enables me to put the value of the cursor in a defined variable. This variable is charged in the message in the slot "publier()".

My header file :

#ifndef rqt_mypkg__my_plugin_H
#define rqt_mypkg__my_plugin_H

#include <rqt_gui_cpp/plugin.h>
#include <rqt_mypkg/ui_my_plugin.h>
#include <QWidget>
#include <QString>
#include <QList>

#include <ros/ros.h>
#include "std_msgs/String.h"
#include <std_msgs/Int8.h>


namespace rqt_mypkg {

class MyPlugin
  : public rqt_gui_cpp::Plugin
{
  Q_OBJECT
public:
  MyPlugin();
  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
  virtual void shutdownPlugin();
  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);

  // Comment in to signal that the plugin has a way to configure it
  //bool hasConfiguration() const;
  //void triggerConfiguration();

private:
  Ui::MyPluginWidget ui_;
  QWidget* widget_;

  ros::NodeHandle ros_node_handle_;
  ros::Publisher my_publisher_;
  ros::Subscriber my_suscriber_;


public Q_SLOTS:

  virtual void publier();
  virtual void outputVal(double val);

protected:
  int value;


};
} // namespace
#endif // rqt_mypkg_my_plugin_H

My cpp file, my_plugin.cpp :

#include "rqt_mypkg/my_plugin.h"
#include <pluginlib/class_list_macros.h>
#include "ros/ros.h"

#include <QStringList>
#include "std_msgs/String.h"
#include <sstream>
#include <std_msgs/Int8.h>


namespace rqt_mypkg {

MyPlugin::MyPlugin()
  : rqt_gui_cpp::Plugin()
  , widget_(0)
{
  // Constructor is called first before initPlugin function, needless to say.

  // give QObjects reasonable names
  setObjectName("MyPlugin");
}

void MyPlugin::initPlugin(qt_gui_cpp::PluginContext& context)
{
  // access standalone command line arguments
  QStringList argv = context.argv();
  // create QWidget
  widget_ = new QWidget();
  // extend the widget with all attributes and children from UI file
  ui_.setupUi(widget_);
  // add widget to the user interface
  context.addWidget(widget_);

connect(ui_.m_hSlider, SIGNAL(valueChanged(int)), this, SLOT(outputVal(int)));

connect(ui_.m_bouton, SIGNAL(clicked()), this, SLOT(publier()));

}

void MyPlugin::outputVal (int val)
{
  value = val;
}

void MyPlugin::publier ()
{

 my_publisher_ = ros_node_handle_.advertise<std_msgs::Int8>("chatter", 1000);
  if (ros::ok() && my_publisher_)
    {
      // below it is to wait forsubscriber. Otherwise the first publication will not be heard by the subscriber. 
      ros::Rate poll_rate(100);
      while(my_publisher_.getNumSubscribers() == 0)
      {
          poll_rate.sleep();
      }

      // I create my message 
      std_msgs::Int8 msg;

      msg.data = value

      my_publisher_.publish(msg);

      ROS_INFO("%d", msg.data);

      ros::spinOnce();

   }
}
void MyPlugin::shutdownPlugin()
{
}

void MyPlugin::saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const
{
}

void MyPlugin::restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings)
{
}


} // namespace
PLUGINLIB_DECLARE_CLASS(rqt_mypkg, MyPlugin, rqt_mypkg::MyPlugin, rqt_gui_cpp::Plugin)

My ui file, my_plugin.ui :

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MyPluginWidget</class>
 <widget class="QWidget" name="MyPluginWidget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>741</width>
    <height>531</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QSlider ...
(more)
2016-07-11 16:46:03 -0500 edited question How to connect a signal to a publisher

Hi,

I am using a rqt plugin made with the tutorial and I have made a simple GUI composed with a slider and a button. I would like to connect the button, to send the value of the slider to a message. This message which contents a integer, would be publish when the button is clicked. Then in another file I have made a "listener" based on the tutorial and I would like to see on my screen the integer.

I can't catkin_make it because I have many errors. I know that I am mixing GUI and ros things, and signals and messages, I am lost. Can someone helpme with that ?

This is my header file :

#ifndef rqt_mypkg__my_plugin_H
#define rqt_mypkg__my_plugin_H

#include <rqt_gui_cpp/plugin.h>
#include <rqt_mypkg/ui_my_plugin.h>
#include <QWidget>
#include <QString>
#include <QList>

#include <ros/ros.h>

#include "std_msgs/String.h"
#include <std_msgs/Int8.h>


namespace rqt_mypkg {

class MyPlugin
  : public rqt_gui_cpp::Plugin
{
  Q_OBJECT


   public:

  MyPlugin();
  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
  virtual void shutdownPlugin();
  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);

  // Comment in to signal that the plugin has a way to configure it



//bool hasConfiguration() const;
  //void triggerConfiguration();

private:
  Ui::MyPluginWidget ui_;
  QWidget* widget_;

  ros::NodeHandle ros_node_handle;
  ros::Publisher my_publisher;
  ros::Subscriber sub;


public Q_SLOTS:

  virtual void publier();



};
} // namespace
#endif // rqt_mypkg_my_plugin_H

This is my cpp file :

(I know that the thing I've done with the "dac=0 and dac=1" is not working and stupid but I wanted to test it.)

#include "rqt_mypkg/my_plugin.h"
#include <pluginlib/class_list_macros.h>
#include "ros/ros.h"
#include <QStringList>
#include "std_msgs/String.h"
#include <sstream>
#include <std_msgs/Int8.h>

int dac= 0;

namespace rqt_mypkg {

MyPlugin::MyPlugin()
  : rqt_gui_cpp::Plugin()
  , widget_(0)
{

  setObjectName("MyPlugin");
}

void MyPlugin::initPlugin(qt_gui_cpp::PluginContext& context)
{

  QStringList argv = context.argv();
  // create QWidget
  widget_ = new QWidget();



  ui_.setupUi(widget_);
  // add widget to the user interface
  context.addWidget(widget_);

connect(ui_.m_bouton, SIGNAL(clicked()), this, SLOT(publier()));
}

void MyPlugin::publier ()
{
  dac = 1;
}

int main(int argc, char **argv)
{
  ros::init(argc, argv,"envoyeur");
  ros::NodeHandle ros_node_handle;



 ros::Publisher my_publisher = ros_node_hand

le.advertise<std_msgs::Int8>("chatter", 1000);
ros::Rate loop_rate(1);

 int count = 0;
while(ros::ok())
{
  std_msgs::Int8 msg;
std::stringstream ss;
msg.data = ui_.m_hSlider.display(int);

ROS_INFO("%d", msg.data);


if (dac==1) {
  my_publisher.publish(msg);
 }
  ros::spinOnce();
  loop_rate.sleep();
  ++count;
}

return 0;
}


void MyPlugin::shutdownPlugin()
{
}

void MyPlugin::saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const
{
}

void MyPlugin::restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings)
{
}


} // namespace
PLUGINLIB_DECLARE_CLASS(rqt_mypkg, MyPlugin, rqt_mypkg::MyPlugin, rqt_gui_cpp::Plugin)
2016-07-11 16:40:03 -0500 edited answer Impossible to make a plugin with the tutorial

EDIT : I finally created the plugin. For people who would like to create a plugin for rqt with the tutorial, here is part of my code.

My directories are : in /catkin_ws/src/rqt_mypkg : src, plugin.xml, package.xml, CMakeLists.txt, include, script, setup.py

In /catkin_ws/src/rqt_mypkg/src/rqt_mypkg : my_plugin.cpp, my_plugin.ui, receveur.cpp

In /catkin_ws/src/rqt_mypkg/include/rqt_mypkg : my_plugin.h

package.xml :

<?xml version="1.0"?>
<package>
  <name>rqt_mypkg</name>
  <version>0.0.0</version>
  <description>The rqt_mypkg package</description>

  <maintainer email="pierre@todo.todo">pierre</maintainer>

  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>rospy</build_depend>
<build_depend>roscpp</build_depend>
  <build_depend>rqt_gui</build_depend>
  <build_depend>rqt_gui_cpp</build_depend>
  <build_depend>rqt_gui_py</build_depend>
  <build_depend>std_msgs</build_depend>
<run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>rqt_gui</run_depend>
  <run_depend>rqt_gui_cpp</run_depend>
  <run_depend>rqt_gui_py</run_depend>
 <run_depend>std_msgs</run_depend>

  <export>
<rqt_gui plugin="/home/pierre/catkin_ws/src/rqt_mypkg/plugin.xml"/>

  </export>
</package>

My CMakeLists.txt :

cmake_minimum_required(VERSION 2.8.3)
project(rqt_mypkg)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  rospy
roscpp
roslint
  rqt_gui
  rqt_gui_cpp
  rqt_gui_py
std_msgs
genmsg
)

## System dependencies are found with CMake's conventions
 find_package(Qt4 COMPONENTS QtCore QtGUi REQUIRED)

include(${QT_USE_FILE})

 catkin_python_setup()


roslint_cpp()

## Generate added messages and services with any dependencies listed here
 generate_messages(
   DEPENDENCIES
   std_msgs  # Or other packages containing msgs
 )

###################################
## catkin specific configuration ##
###################################
catkin_package(
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS rospy rqt_gui rqt_gui_cpp rqt_gui_py
)

set (rqt_mypkg_SRCS
  src/rqt_mypkg/my_plugin.cpp
)

set(rqt_mypkg_HDRS
  include/rqt_mypkg/my_plugin.h
)

set(rqt_mypkg_UIS
  src/rqt_mypkg/my_plugin.ui
)

qt4_wrap_cpp(rqt_mypkg_MOCS ${rqt_mypkg_HDRS})
qt4_wrap_ui(rqt_mypkg_UIS_H ${rqt_mypkg_UIS})
###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
include
${CMAKE_CURRENT_BINARY_DIR}/..
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
add_library(${PROJECT_NAME}
    ${rqt_mypkg_SRCS}
    ${rqt_mypkg_MOCS}
   ${rqt_mypkg_UIS_H}
)


## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}
   ${catkin_LIBRARIES}
  ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
 )


install(FILES plugin.xml
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(PROGRAMS scripts/rqt_mypkg
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)