Rosanswers logo

I tried running the controller node from pid package http://wiki.ros.org/pid

running from command line with rosrun works fine. but using launch file:

    <node name="linear_controller" pkg="pid" type="controller"
   args="1 6 .001 2000 -tfc lin_effort -tfp lin_state -fc 1000"/>

getting error

    process[linear_controller-3]: started with pid [28035]
*** stack smashing detected ***: /opt/ros/indigo/lib/pid/controller terminated
[linear_controller-3] process has died [pid 28035, exit code -6, cmd /opt/ros/indigo/lib/pid/controller 1 6 .001 2000 -tfc lin_effort -tfp lin_state -fc 1000 __name:=linear_controller __log:=/home/muaz/.ros/log/c6a3233e-3216-11e5-a8c9-20689d31db97/linear_controller-3.log].
log file: /home/muaz/.ros/log/c6a3233e-3216-11e5-a8c9-20689d31db97/linear_controller-3*.log

why it is getting stack smashing and exit code -6?

Originally posted by radzaeem on ROS Answers with karma: 46 on 2015-07-24

Post score: 1


1 Answer 1


Rosanswers logo


I think this thread has the answer. Roslaunch is adding additional arguments, which screws up the pid node. It expects a particular order for the first 4 arguments.


I'm not sure what the workaround is yet. Perhaps I could re-release the package so the command is:

$ rosrun pid controller -Kp 2 -Ki 0.1 -Kd 0.05 -rate 200

It sucks to make the command even longer, though...

Originally posted by AndyZe with karma: 2331 on 2015-07-26

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by gvdhoorn on 2015-07-26:
A ROS node should be able to handle these args properly. See ros::removeROSArgs(..).

Comment by AndyZe on 2015-07-26:
Alright, that worked. Thanks. I'm pushing new versions of the package to ROS (takes ~1 month), or you can get it directly from my repo in the meantime. There's a launch file with the package now. https://bitbucket.org/AndyZe/pid/src/ab80beaa7e265213c4dfb37e7b99870c2cc84b41?at=master

Comment by gvdhoorn on 2015-07-26:
I think if you called check_user_input(..) after ros::init(argc, argv, node_name), the 'additional arguments' should already have been parsed and removed by ROS. Are things like remapping still working correctly the way you set things up?

Comment by AndyZe on 2015-07-26:
Yes, remapping appears to work. It might have been easier to put check_user_input(..) after ros::init(argc, argv, node_name), but I'm not sure how that would affect node_name (since the node name needs to be parsed).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.