2

I m a ROS user. With that framework you usually define a working directory:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
// Here create your c++ packages

and then let the system to compile your packages by typing the following:

$ cd ~/catkin_ws/
$ catkin_make

But this means that you should keep at least one more console open, to call the command:

$ catkin_make 

which compiles at once all the packages you ve written in that working directory.

Since I m using Sublime Text 3 to write my software I want to be able to call that function from Sublime I went through this tutorial so many times, but I still don't understand how I can create my building system.

I tried already with the following:

{
    "path": "~/workspace_ros",
    "cmd": ["catkin_make"]
}

but I get the following error message:

[Errno 2] No such file or directory: 'catkin_make'
[cmd: ['catkin_make']]
[dir: /home/will/workspace_ros/src/flight_system/src/include]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
[Finished]

I tried even with the following options:

path
shell_cmd

but still it doesn't recognize catkin as command for compiling

What's wrong?

PS: in the workspace I have already a CMakeLists.txt file. Calling catkin in the shell compiles everything fine.

Community
  • 1
  • 1
Dave
  • 349
  • 4
  • 22

2 Answers2

2

I am not sure if this is the best way to accomplish it, but this is what I did. Keep in mind that I did this for a winros project, so for regular ROS projects, you just need to tweak it a bit.

First, I created a build system for the project as follows (so append this to your project file):

"build_systems":
[
  {
    "name" : "ROS",
    "cmd" : ["$project_path/build.bat"],
    "working_dir" : "$project_path",

    "variants" : [
      {
        "name" : "Run",
        "cmd" : ["$project_path/run.bat"]
      }
    ]
  }
]

I then created the build.bat and run.bat scripts referenced in there in the project's root directory (in your case ~/workspace_ros). I created these scripts because there is more to building/running the nodes than just calling catkin_make. You also need to call the setup scripts first.

Here's build.bat

@ECHO OFF

REM Basically, change the cwd to the project's root dir
SET ws_path=%~dp0
cd /D "%ws_path%"
call setup.bat
winros_make -i

You might want to change this to a bash script for your linux system, and tweak the script itself. The idea is to change your cwd to the project's path and call the setup file and build afterwards.

Here's run.bat

@ECHO OFF

REM Call the setup script and launch the node
call "C:\opt\ros\hydro\x86\setup.bat"
roslaunch eyetracker_talker talker.launch

Again, you might need to change this to a bash script. In my case, I use roslaunch to run the node.

Finally, this gives you two build options (Build and Build: Run). The output of both should be shown in the build output window.

Hope this helps.

Diego Luces
  • 141
  • 2
  • 7
0

I realize this is a bit of an old question, but it is still top on google for using catkin with Sublime, so heres my shameless self plug.

I recently wrote a Sublime 3 Package, Catkin Builder that bulids ROS packages inside Sublime. It uses catkin build as opposed to catkin_make but it might help you out.

Z Taylor
  • 21
  • 3