Skip to content Skip to sidebar Skip to footer

Ros Catkin_init_workspace Not Found When Spawned As Process By Php

Let me elaborate: I am trying to spawn the catkin_init_workspace from PHP, using the proc_open like so: touch( '$dir/stderr.txt' ); chmod( '$dir/stderr.txt', 0755 ); $fp = fopen('$

Solution 1:

As you already figured out, source /opt/ros/indigo/setup.bash has to be called in advance, otherwise your environment is not set up to find the ROS commands.

When you did this in PHP, I guess you used something like an additional proc_open or exec call or something similar before you call proc_open("catkin_init_workspace", ...)? By doing this, the environment is probably only set up for this single call and it is not kept until you run catkin_init_workspace in another proc_open-call.

Possible Solution

I cannot test this here right now (no PHP installed), but the following should work:

  1. Create a simple bash script with the following content:

    #!/bin/bashsource /opt/ros/indigo/setup.bash
    catkin_init_workspace
    
  2. In PHP, call this script instead of catkin_init_workspace

Post a Comment for "Ros Catkin_init_workspace Not Found When Spawned As Process By Php"