Ask Your Question

Hardware communication fails after ros::init

asked 2011-05-13 02:10:11 -0500

Wouter van Teijlingen gravatar image

updated 2011-06-17 10:54:28 -0500

kwc gravatar image

Dear list,

I've a couple of packages for communicating with our delta robot. This is sample code, it's ugly, but it's for demonstration purposes only:

std::cout << "par_trajectory_planning." << std::endl;
ros::init(argc, argv, "par_trajectory_planning");
//ros::NodeHandle n;
modbus_t* ctx = modbus_new_rtu("/dev/ttyS0", 115200, 'N', 8, 1); 
par_trajectory_planning::commands cmd;
stepperMotor = new StepperMotor(ctx);

If i run this program with the following command:

rosrun par_trajectory_planning par_planning

It seems to block the hardware. I get messages like the following:

ANGLE: -41.5733
Waiting for a confirmation...
errno: File exists

There errno is the problem. If i disable this line in the sample code:

ros::init(argc, argv, "par_trajectory_planning");

The program works as expected; we start it with the same command. Of course no ROS integration, but it communicates with the hardware as expected. What happens in ros::init that alters the behavior of our program? We make use of libmodbus ( ) in this package and it works fine; but if we integrate it in ROS it doesn't work.

I tried to start everything as root, but that doesn't change errors. Thanks.

edit retag flag offensive close merge delete


Total shot in the dark: ros::init edits argc and argv; are you possibly sending command-line arguments that look like ROS arguments?
Mac gravatar image Mac  ( 2011-06-17 10:52:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-06-17 11:16:37 -0500

Straszheim gravatar image

You're going to need to find the very first point at which execution diverges from the working and nonworking versions. At this point you could ask, "why does ros::init change this specific behavior", but with what is here it is hard to say.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-05-13 02:10:11 -0500

Seen: 152 times

Last updated: Jun 17 '11