ROS foundation - the basic concepts and simple tools (1)

1. What is ROS?

Robot operating System, simply robot operating system, the framework of weak coupling distributed processes, message passing between processes and management. Hardware abstraction and device control.

2, the node (node)

  • ROS node is the core entity.
  • ROS program period
  • ROS communicate using middleware
  • Can independently start and stop between nodes

3, and related concepts node

  • message
  • topic
  • roscore :
  1. There is one and only one can run roscore
  2. You must first start roscore
  3. Responsible for scheduling communications
  4. Roscore publisher nodes and communications (e.g., to initialize a topic)
  • publisher、subscriber

4, tool

  catkin_create_pkg: Creating a package

  catkin_make: Compile ROS program

  rosrun: Run the program ros

  rostopic: topics related to command

      rostopic list; rostopic Hz topic1; rostopic topic1 bw; rostopic info topic1; rostopic echo topic1

  rosnode list: to see a list of nodes running production

  roslaunch: .launch by editing the file automatically start multiple nodes

  rosbag: record and playback data on the topic

      rosbag record topic1

      rosbag play   name1.bag

         rqt_plot: for visualization of the results

5, common tools Details

catkin_create_pkg:

  catkin_create_pkg   [packageNmae] [dependency]

  

 

  Dependencies: roscpp: using c ++ compiler, c ++ compatible interfaces; std_msgs: ros predefined data types

  

 

 

catkin_make:

  package.xml : Organization ROS package, the package naming names, dependencies

         <name></name>

         <build_depend></build_depend>

         <run_depend></run_depend>

         

  The CMakeLists.txt  : A simple example is as follows

cmake_minimum_required(VERSION 2.8.3)
project(demo-proj1-nodes) # package name

find_package(catkin REQUIRED COMPONENTS
    roscpp
    std_msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES my_minimal_nodes
#  CATKIN_DEPENDS roscpp std-msgs
#  DEPENDS system_lib
)

include_directories(
 include ${catkin_INCLUDE_DIRS}
)

add_executable(my_minimal_publisher src/minimal_publisher.cpp)
add_executable(my_minimal_publisher2 src/sleep_minimal_publisher.cpp)


target_link_libraries(my_minimal_publisher
   ${catkin_LIBRARIES}
)
target_link_libraries(my_minimal_publisher2
   ${catkin_LIBRARIES}
)
View Code

  Compile command: catkin_make

  

 

   After compilation there, devel and build two folders

rosrun:

  At the outset environment variables: source ./devel/setup.bash

         rosrun [Package-name] [executable name]

 

  

  

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/feihu-h/p/11839316.html