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

rbaleksandar's profile - activity

2021-10-06 21:55:51 -0500 received badge  Great Answer (source)
2021-10-06 21:55:51 -0500 received badge  Guru (source)
2020-09-21 10:50:28 -0500 received badge  Nice Question (source)
2019-09-20 02:19:30 -0500 marked best answer Rqt command line interface - killing plugins and switching perspectives

Hi everyone! :)

I am struggling with the (probably considered) advanced features of rqt namely using the command line interface in order to control a running rqt instance using IPC (inter-process communication). This question consists of two parts:

  • Killing plugins started as separate processes
  • Switching perspectives

System: Ubuntu 14.04, ROS Indigo (I think it was updated 2-3 months ago)


Killing plugins started as serparate processes

The question here is to find a workaround of the problem described in this section of the post.

Looking at the --help of rqt I got the following (do feel free to correct me if I'm wrong):

  • -m (long: --multi-process) - starts each rqt plugin as a separate process which means that I can get the PID of every pluging in order to manipulate it somehow using UNIX signals. Tested and working as described.
  • --command-pid RQT_PID - used in a combination with other --command-* terminal parameters to control the running rqt instance (oldest one by default which is not something that I need to consider since my use case involves running just a single instance of rqt). Tested and working as described.

    • --command-pid RQT_PID --command-start-plugin RQT_PLUGIN_NAME - given the PID of the running rqt I can pass the name of a rqt plugin I want to start. Tested and working as described.

      Example: rqt --command-pid 10816 --command-start-plugin rqt_rviz/RViz adds rviz the my running rqt

So far so good. The problem is when I want to stop a plugin everything turns into...well...you know what. I was unable to find a rqt-friendly way of doing that (there is for example no such command as --command-stop-plugin RQT_PLUGIN_NAME) hence the only way that I have found so far is to send a SIGTERM to the PID of the respective plugin.

I have tried using SIGINT but it doesn't seem to work at all and also even when I use SIGTERM the plugin still seems to be running (second image). I wrote seems since the processes is actually no longer there however the plugin (without its content!) remains and also under Running in the menu I can still see Close RQT_PLUGIN_NAME (see third image). Clicking on it doesn't do anything and the entry in the menu doesn't disappear. To be honest I find it very unlikely that anything but kill is to be used to close externally such plugins because of the absence of a --command-stop-plugin ... and the fact that the --command-start-plugin ... takes just the rqt plugin's name which begs the question "What will happen if I want to start and then stop N instances of the same plugin next to each other?"

Before SIGTERM to RViz plugin image description

After SIGTERM to RViz plugin (the plugin is still partially there) image description

After SIGTERM to RViz plugin (the plugin is still registered as a running plugin) image description

Things get even weirder when I reopen rqt (without --clean-config enable of course) - the "corrupted" plugin is loaded and (of course) it appears as one would expect from a pluging that ...

(more)
2019-09-03 10:42:09 -0500 received badge  Famous Question (source)
2019-08-30 04:20:09 -0500 received badge  Famous Question (source)
2019-08-30 04:20:09 -0500 received badge  Notable Question (source)
2018-06-04 08:47:13 -0500 received badge  Famous Question (source)
2018-04-13 07:53:16 -0500 marked best answer Raspberry Pi 2, ROS and GPIO access

Hi!

I just created two nodes:

  • One is on my notebook to send status updates of a LED (the message is of type Bool)
  • The other is on my RPi2 and sets the GPIO 17 to high/low according to value in the Bool message received

Both platforms are running ROS Indigo (notebook has Debian Jessie and RPi2 has Raspbian Wheezy). I'm also using only Python (especially on the RPi2 this seems to be the much easier way to do things related to the GPIO).

My problem is the GPIO access requires superuser privileges, which rosrun doesn't seem to like (in fact rosrun obviously is not a known command when using sudo). My question is in what best way am I to handle this situation? Should ROS on such an embedded system actually be installed as root because of all the low level access to the hardware underneath or is it possible to execute rosrun in superuser temporarily just for that the time the specific node that requires such privileges is running?

2017-10-04 03:16:37 -0500 commented answer Display PointCloud2 in Rviz

It's been a while so I might be wrong but looking at the code in my answer you can see that I pass it as a parameter wit

2017-08-22 15:31:20 -0500 asked a question Running rosversion through Python subprocess.Popen() leads to encoding error

Running rosversion through Python subprocess.Popen() leads to encoding error Running the following line of Python code (

2017-08-22 15:15:12 -0500 commented question Timing to start simple action server and client

It's been a while. I have forgotten if I found a solution or not. Sorry. Apologies.

2017-07-13 12:56:13 -0500 received badge  Good Answer (source)
2017-06-08 15:46:14 -0500 received badge  Nice Question (source)
2017-06-06 07:17:49 -0500 received badge  Notable Question (source)
2017-04-19 21:35:46 -0500 received badge  Famous Question (source)
2017-04-19 17:52:38 -0500 marked best answer Unable to select model argument for urdf-tutorial package

Hi!

I'm looking into the tutorials on URDF (ROS Indigo), robot_state_publisher etc. In this tutorial it is stated that

roslaunch urdf_tutorial display.launch model:=urdf/01-myfirst.urdf

should start rviz (launch parameters stored inside display.launch) with the selected model. Sadly I'm getting the error that such file cannot be found:

rosuser:~$ roslaunch urdf_tutorial display.launch model:=urdf/01-myfirst.urdf
... logging to /home/rosuser/.ros/log/336d620e-8d02-11e5-b0c5-90fba64806be/roslaunch-latadmin-ros-7550.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/__init__.py", line 298, in main
    p.start()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 260, in start
    self._start_infrastructure()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 209, in _start_infrastructure
    self._load_config()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 124, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default
    loader.load(f, config, verbose=verbose)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 730, in load
    self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 702, in _load_launch
    self._recurse_load(ros_config, launch.childNodes, self.root_context, None, is_core, verbose)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 646, in _recurse_load
    self._param_tag(tag, context, ros_config, verbose=verbose)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 95, in call
    return f(*args, **kwds)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 264, in _param_tag
    value = self.param_value(verbose, name, ptype, *vals)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/loader.py", line 463, in param_value
    with open(textfile, 'r') as f:
IOError: [Errno 2] No such file or directory: u'urdf/01-myfirst.urdf'

I also read the lines below:

This launch file assumes that 01-myfirst.urdf is in the urdf subdirectory of the directory that you type the command in. Otherwise, you should say model:='$(find pkg-name)/urdf/01-myfirst.urdf' where pkg-name is the name of the package that the file is in (single quotes required)

I tried both with an installed version of the package and a fresh download of the package inside my catkin workspace but in both cases I'm getting the same error. I have checked and the urdf folder is there along with the specified file (last line of the following terminal output):

rosuser:/opt/ros/indigo/share/urdf_tutorial$ ls -R
.:
cmake  images  launch  package.xml  urdf  urdf.rviz  urdf.vcg

./cmake:
urdf_tutorialConfig-version.cmake  urdf_tutorialConfig.cmake

./images:
flexible.png  materials.png  multipleshapes.png  myfirst.png  origins.png  visual.png

./launch:
display.launch  gazebo.launch  xacrodisplay.launch

./urdf:
01-myfirst.urdf  02-multipleshapes.urdf  03-origins.urdf  04-materials.urdf  05-visual.urdf  06-flexible ...
(more)
2017-03-16 22:25:44 -0500 marked best answer Display PointCloud2 in Rviz

Hi!

I realize this question has been chewed a lot here but from all the answers I've read nothing seems to work. I'm using ROS Indigo on Ubuntu 14.04 LTS (32bit).

Before I start reading and publishing my own data I decided to check out how things actually work with one of these PCD files.

Here is my publisher:

#include <ros/ros.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <string>

typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;

using std::string;

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

  string pcdFile = "";
  nh.getParam("pcdFile", pcdFile);

  if(pcdFile == "") {
    ROS_ERROR_STREAM("Unable to find file \"" << pcdFile << "\"");
    nh.shutdown();
  }

  ros::Publisher pub = nh.advertise<PointCloud> ("cloud_publisher/cloud_from_file", 1);

  PointCloud::Ptr msg(new PointCloud);
  if (pcl::io::loadPCDFile<pcl::PointXYZ> (pcdFile, *msg) == -1)
  {
    ROS_ERROR_STREAM("Unable to read from file \"" << pcdFile << "\"");
    nh.shutdown();
    return -1;
  }

  ros::Rate r(10);

  while (nh.ok())
  {
    msg->header.frame_id = "/my_frame";
    //msg->header.stamp = ros::Time::now().toNSec();
    pub.publish(msg);
    ros::spinOnce();
    r.sleep();
  }

  return 0;
}

Basically I read a PCD file and send it on its way to the rest of the ROS network. I want to see the result in RViz. Now here is the thing - I get the ever so lovely error

No tf data. Actual error: Fixed Frame [map] does not exist

in my global status of Rviz. I also added a PointCloud2 item to RViz but the moment I selected the topic that my cloud_publisher is publishing roslaunch (I use a launch file to load the PCD file in my node) breaks with another known error the moment I set the topic of my PointCloud2 to cloud_publisher/cloud_from_file:

terminate called after throwing an instance of 'std::runtime_error'
what(): Time is out of dual 32-bit range [cloud_publisher-1] process has died [pid 2015, exit code -6, cmd /home/rosuser/catkin_ws/devel/lib/pcl_misc/cloud_publisher __name:=cloud_publisher __log:=/home/rosuser/.ros/log/32182a0e-3b92-11e5-9e58-001e0ba4cf00/cloud_publisher-1.log]. log file: /home/rosuser/.ros/log/32182a0e-3b92-11e5-9e58-001e0ba4cf00/cloud_publisher-1*.log all processes on machine have died, roslaunch will exit

I read that you have to either provide a transformation (using TF) from the map fixed frame to all others that you publish (in my case I have only my_frame) or simply set my_frame to be the global frame too. Well neither is working due to the crash of my node.

Can you please help me resolve this issue? It is not possible that displaying a single item (in my case a point cloud) in Rviz is that complicated.

Thanks!

EDIT: I just tried using rostopic echo /cloud_publisher/cloud_from_file and my publisher crashed again! It seems the issue is not because of Rviz (although the missing TF data is still bothering me...). Something fishy is going on with the topic itself...

EDIT2: I forgot to mention that I have also tried this solution. I also wrote the wrong architecture. I have a 32bit CPU.

EDIT3: I tried borrowing code from ... (more)

2017-03-16 22:25:44 -0500 received badge  Nice Answer (source)
2017-03-06 21:43:20 -0500 received badge  Good Answer (source)
2017-03-06 21:43:20 -0500 received badge  Enlightened (source)
2017-01-24 03:27:59 -0500 received badge  Famous Question (source)
2017-01-24 03:27:59 -0500 received badge  Notable Question (source)
2017-01-23 14:40:41 -0500 received badge  Famous Question (source)
2017-01-12 05:57:00 -0500 received badge  Popular Question (source)
2017-01-12 05:57:00 -0500 received badge  Famous Question (source)
2017-01-12 05:57:00 -0500 received badge  Notable Question (source)
2016-12-08 22:10:51 -0500 received badge  Notable Question (source)
2016-10-30 13:31:18 -0500 received badge  Good Answer (source)
2016-10-14 09:05:04 -0500 received badge  Popular Question (source)
2016-10-14 09:05:04 -0500 received badge  Notable Question (source)
2016-09-13 13:24:24 -0500 received badge  Popular Question (source)
2016-08-24 11:08:58 -0500 received badge  Nice Answer (source)
2016-07-08 13:38:14 -0500 received badge  Popular Question (source)
2016-06-28 09:45:51 -0500 commented answer Conversion from sensor_msgs::PointCloud2 to pcl::PointCloud<T>

Here is a project of mine. I'm actually going to convert this to a more generic package and perhaps even propose to include it in ROS since there are not out-of-the-box, easy-to-use packages.

2016-06-28 04:51:00 -0500 received badge  Necromancer (source)
2016-06-27 09:18:19 -0500 marked best answer Building rqt (plus all plugins) from source - qt_gui_main() can't find any plugins

Hi!

I have just finished building rqt from source for ROS Indigo on my Debian Jessie without any errors. However when I try to run rqt_graph for example I get:

qt_gui_main() found no plugin matching "rqt_graph.ros_graph.RosGraph"

Next thing I did was to open rqt. It opens fine however I can't see a single plugin inside the plugin menu even though I have rqt_graph, rqt_console etc. (full rqt_common_plugins metapackage was installed). The executables are there (that is why the terminal didn't throw an error at me that the command was not found when calling rqt_graph) but there seems to be missing something and I don't know what.

Any ideas what's going on here? All the source war pulled via wstool and rosdep (as described in the tutorial about installing ROS on Debian).

EDIT: Running rqt --list-plugins doesn't return anything at all.

2016-06-27 09:18:19 -0500 received badge  Nice Answer (source)
2016-06-27 06:55:19 -0500 answered a question How to cancel goals from within an action server?

As @Javier mentioned in the comments the cancellation of a goal is done automatically. In order to handle multiple action servers at once you have to create a minimalistic SimpleActionClient for each action server (except for the one that cancels all of the other servers). Such a client will have only one task namely sending an empty goal of type X to the server which processes the respective action. By doing so you are exploiting (in a perfectly decent manner) the automatic preemption of the SimpleActionServer so each of the other action servers will receive it, do nothing but also cancel the goal each is currently executing. I would suggest (I'm also about to test it with my own code) that you trigger a cancel request using all the action clients and send to all the respective action servers. The triggering itself needs to be done inside the callback of the action server that needs to cancel all other servers.

2016-06-27 06:25:29 -0500 commented answer Pausing or aborting movement to a goal

If the received goal is with a higher priority of the currently running goal, the currently running goal needs to be canceled and the new goal is executed.

2016-06-27 06:24:41 -0500 commented answer Pausing or aborting movement to a goal

Is it possible to cancel the goal inside the ActionServer itself without adding a client side to it. I'm adding priorities to my multiple action servers and whenever any of the callbacks is triggered the server has to check if a goal with a higher priority is currently being executed.

2016-06-27 05:16:50 -0500 asked a question Mutex with multiple types of topics as input

I'm currently looking into using the ROS mux (from topic_tools) for controlling an LED system on a mobile platform (similar to the PR2 but without the bulky robot on the top, just the base). Right now I have multiple services and normal topics that are handled by a node which controls the LEDs that are mounted at various locations on the platform. The problem is that there are no priorities. Priorities are essential here since each LED-related message is used to visualize some sort of situation that the user should/has to be aware of. For example minor errors (like object tracking failed in which situation the robot simply stops moving) are of lower priority compared to let's say the crash of a system-critical node (like velocity of the platform has reached a given limit in which case driving it around manually may become dangerous to either or both the user and the platform itself).

I would like to implement a priority-capable mutex (similar to the twist_mux and the cmd_vel_mux) however I would also like to keep the current state of the topic I have. This means that the outputs of the mutex will be of different type.

Here are some examples:

Force direction message (*.msg):

# Gives LED feedback of the direction and magnitude of the force that is applied to the platform by pulling it (can aslo be used
geometry_msgs/WrenchStamped force
std_msgs/ColorRGBA color

Blink action message (*.action):

# Gives LED feedback for a variety of scenarios
int32 blinks                    # Number of flashes (1 flash = 1 time on + 1 time off) - duration: long
int32 fast_blinks               # Number of flashes (1 flash = 1 time on + 1 time off) - duration: short (takes place from one long flash to another)

int32 start_led
int32 end_led

std_msgs/ColorRGBA color_outer
std_msgs/ColorRGBA color_inner

int32 num_inner_leds            # Number of LEDs for EACH inner stripe; it can be <= the half of all LEDs defined by start_led and end_led
---
int32 blinks_left               # Result (if == 0 then really successful); refers to the flashes with LONG duration only
---
int32 fast_blinks_left          # Feedback: number of flashes left until the next flash with long duration
int32 blinks_left               # Feedback: number of flashes left until the goal is completed; refers to the flashes with LONG duration only

Service message (*.srv):

# Turns on/off the LEDs
bool turn_on
std_msgs/ColorRGBA color    # RGB values [0-1] for all LEDs (when turning on)
---
bool success
string message

Obviously I will have to add a priority parameter to all messages (service request, standard topics and action goals) otherwise the mutex will have to decide on its own based on the type of the topic which one should be executed etc.

I'm struggling with the implementation namely how do you process multiple topics of a different type in a generic way? What I envision in my head is something like this:

  1. One of the many client nodes (each client node handles some sort of scenario that is linked indirectly to the LED system) detects the need to send a message that is ...
(more)