当前位置:网站首页>ROS command
ROS command
2022-07-16 06:50:00 【2021 Nqq】
List of articles
ROS Huawei source image
Common commands
- ctrl+h: Call hidden file
- ctrl + shift + b: You can compile programs
- ctrl+c: Auto output , It means the end of the program
- **ctrl( On the right hand side )+f:** Adaptively resize the interface
- ros rely on :roscpp rospy std_msgs
- tab: A filling
- rqt_graph: Start the calculation chart
- rostopic echo fang: Print the data published by the current publisher
- pwd: Find the path to the file , You need to click on this file , then Right click and select Open... In the terminal , Input again pwd.
- The source file name is consistent with the mapping name
- argc: Represents the total number of parameters passed in , In this case , The first 1 The first parameter is the program name , The first 2、3 The parameters are 12,34. common 3 Parameters ( Service communications There are examples ).argc[0] It must be the name of the program , Contains the full path where the program is located .
- char* argv[]: Is an array , Each element stores a pointer , It is the address of the parameter that goes in .
- cd demo02_ws: Start the current workspace
- Add space , two tab key , Can appear rosservice call addInts “num1: 0 num2: 0” addInts Later
- Ctrl + ` (esc Key below ) : Open default terminal , The interface remains in the state before closing
- ctrl + alt + T : Open a new terminal
- shift + ctrl + T : Open a new terminal at the same level of the current terminal ( That is, there are two tabs in the same terminal )
- package.xml: You can add dependent function packages ——roscpp,rospy,std_msgs
Run program steps
(1) General situation
roscore
source ./devel/setup.bash —— Refresh environment variable
rosrun + ( file name )hello_vscode( Mapping name ) hello_vscode_c
After revising CMakeLists.txt after
The first run roscore
And then there was cd demo02_ws/
And finally source ./devel/setup.bash
Then rosrun+ Function package name :rosrun plumbing_pub_sub demo01_pub( There is no log output after running )
(2) Multi node file
stay vscode It uses launch File starts multiple nodes at the same time :
source ./devel/setup.bash
roslaunch hello_vscode start_turtle.launch
(3) Python file
scripts At the completion of python After procedure , need Add executable rights , Right click scripts Select open in terminal , Do the following
chmod +x *.py
ll
debugging
rosrun plumbing_pub_sub demo01_pub_p.py
rostopic echo che
Realization
rosrun plumbing_pub_sub demo01_pub_p.py
rosrun plumbing_pub_sub demo02_sub_p.py
find_package effect : If you compile a customized Feature Pack plumbing_pub_sub You have to rely on find_package Function package inside . meanwhile find_package The function package inside depends on catkin_package Function package inside , It is better to add message_runtime
In the terminal that is not closed , Press the up arrow to use the previously entered command
Input main, Then choose No 2 individual , Automatic completion , Get rid of const Modifier , That's all right.
The mouse points to the empty number ,ctrl+shift+ You can see the definition in the space
When creating a new function package , Be sure to add dependencies , Namely ****roscpp rospy std_msgs
add_dependencies(demo03_pub_person${PROJECT_NAME}_generate_messages_cpp) effect : First of all msg Compiled , Then it is called by the main program
tool kit
1. increase
catkin_create_pkg Custom package name Dependency package === Create a new ROS Function pack
sudo apt install xxx === install ROS Function pack
2. Delete
sudo apt purge xxx ==== Delete a feature pack
3. check
rospack list === List all feature packs
rospack find Package name === Find out if a feature package exists , If present, return to the installation path
roscd Package name === Enter a function package
rosls Package name === List the files under a package
apt search xxx === Search for a feature pack
4. Change
rosed Package name file name === Modify the function pack file
Need to install vim
such as :rosed turtlesim Color.msg
File configuration
To configure C++ file
1. vscode To configure
To configure c_cpp_properies.json file , If the workspace has been configured before and has not been changed , You can ignore
{
"configurations": [
{
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/opt/ros/noetic/include/**",
"/usr/include/**",
"/xxx/yyy working space /devel/include/**" // To configure head Path to file
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
Here it is devel In the document , Right click the function package and select open in the terminal , Use pwd You can find the file path .
/home/rosnoetic/demo02_ws/devel/include/plumbing_server_client
2. To configure CMakeList.txt
There are three parts
add_executable(AddInts_Server src/AddInts_Server.cpp)
add_executable(AddInts_Client src/AddInts_Client.cpp)
add_dependencies(AddInts_Server ${
PROJECT_NAME}_gencpp)
add_dependencies(AddInts_Client ${
PROJECT_NAME}_gencpp)
target_link_libraries(AddInts_Server
${
catkin_LIBRARIES}
)
target_link_libraries(AddInts_Client
${
catkin_LIBRARIES}
)
To configure python file
1. vscode To configure
Get into settings.json file , If the workspace has been configured before and has not been changed , You can ignore
{
"python.autoComplete.extraPaths": [
"/opt/ros/noetic/lib/python3/dist-packages",
]
}
2. Set the permissions
Right click scripts, choice Access terminal perform
chmod +x *.py
ll
3. To configure CMakeList.txt
catkin_install_python(PROGRAMS
scripts/AddInts_Server_p.py
scripts/AddInts_Client_p.py
DESTINATION ${
CATKIN_PACKAGE_BIN_DESTINATION}
)
边栏推荐
- Record and analysis of Rac abnormal heartbeat (ipreamsfails)
- Excel-2
- GY-53红外激光测距模块的使用以及pwm模式代码的实现
- How to solve the win10 installer prompt "cannot open the file xxxxx to be written"
- OpenGL 3D graphics development notes, terrain, lighting, shadows, etc
- DHT11和DHT22(AM2302)比较及使用方法
- A complete collection of C language preprocessing instructions
- 01kNN_ Regression
- ES6 let 、const 详解
- Blue Bridge Cup embedded Hal library new project
猜你喜欢
随机推荐
Embedded software development stm32f407 key input standard library version
如何使用Keil5中的虛擬示波器進行軟件仿真
[signal conditioning] example of precision detection circuit and PCB
工作方法小结
SSM图书管理系统
MPU6050的一些使用方法汇总
IIC通讯
[Go语言入门] 05 Go语言分支语句
Promise --- synchronize? Asynchronous?
Record and analysis of Rac abnormal heartbeat (ipreamsfails)
go语言websocket库Gorilla Websocket
01-kNN
蓝桥杯嵌入式-HAL库-TIM_BASE
梯度下降法的向量化
[introduction to go language] 09 detailed explanation of go language slice
Pyopencv basic operation guide
在Colab上训练yolov3(一)
Automation instrumentation and process control (final review)
Summary of working methods
Import word document pictures root file system production and mounting









