Create simple ROS package

Build ROS package

Command “rosmake” builds the package and all packages it depends on

rosmake example1

ROSRosmakeExample1Start
. . .
ROSRosmakeExample1End

 hint Build multiple packages

Specifying multiple packages as arguments of the command “rosmake” allows to build them at ones

rosmake package1 package2 package3

During building process new folders “bin”, “build” and “lib” have been created in the folder of the built package. The folder “build” contains plenty of subfolders and files related to performed build.

 hint Look for specific text in text files

Powerful command grep searches a plain-text data sets with regular expressions (also known as “regex”). “grep” = “globally search a regular expression and print”.

This command can search recursively in a hierarchy of folders, starting search from a folder specified as an argument, as an input it can take an output of another command, searches case-sensitive or not,  etc. Command “man grep” describes more features of the “grep”.

Example

roscd example1
grep -ri ./build -e “ho \”built.*run”

UnbuntuGrepSearchInFolder

  • From arbitrary folder the command “roscd example1” sets the folder of the package “example” as current
  • Command “grep” starts searching from the folder “build” – which is located in the current folder
  • Options defined with “-” (“dash”) define: “r” – search recursively in subfolders; “i” – ignore case of letters
  • Option “-e” defines using following text as a regex-pattern
  • Last argument is a pattern which is searched in text of files located in the folder “build” and its subfolders. This pattern can be a plain text like “target run” or a more complex regex-pattern like presented in the example:

ho – end of the word “echo”, followed by symbol “space”;

\”escape-character – when it’s needed to add to the text a special symbol like “tab”, “new-line”, etc. In this example symbols “quote” expected by command-line as decoration of the pattern’s content but when the “quote” follows the backslash it is taken as a part of the content;

built – text following the “quote”

. – “dot” (or “full stop”) in regex represents any one symbol;

* – “star” in regex defines than the symbol in front of it can be repeated multiple times. In this case two symbols “.*” define “any one symbol can be repeated multiple time” before the text “run” is found (see below)

run – text which is expected in the searching text fragments

In total the command requires to find text fragments in files matching criteria:

search recursively, case-insensitive, starting from the folder “build”, look for a text fragments which start with text “ho” followed by “space”, followed by “quote” , followed by “build”, followed by any symbols before the text “run” found

 

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail