-
Notifications
You must be signed in to change notification settings - Fork 4
ROS Commands
Shunya Hara edited this page Jun 24, 2024
·
6 revisions
ssh-keygen -t rsa && cat ~/.ssh/id_rsa.pub
catkin_create_pkg rospackage_test roscpp rospy std_msgs tf
add_executable(sample_node src/sample_node.cpp)
target_link_libraries(sample_node ${catkin_LIBRARIES})
function(create_node node_name)
add_executable(${node_name} src/${node_name}.cpp)
target_link_libraries(${node_name} ${catkin_LIBRARIES})
endfunction()
#使うとき
create_example_node(hogehoge)
srcの部分はrosdepを実行したいディレクトリを指定
rosdep install -i -y --from-paths src
rosbag record -a
rosbag record /topic1 /topic2
rosbag record -O file.bag
rosbag play robot_bag.bag -r 2.0 --clock
rosbag play robot_bag.bag -l
rosbag play *.bag --clock --topic /velodyne_points
/**
* @file sample.cpp
* @brief node
* @author Shunya Hara
* @date 2021.mm.dd
* @details
*/
#include <ros/ros.h>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
int main(int argc, char **argv){
ros::init(argc, argv, "wp_loader_node");
ros::NodeHandle n;
//制御周期10Hz
ros::Rate loop_rate(10);
//param setting
ros::NodeHandle pn("~");
while (n.ok()) {
ros::spinOnce();//subsucriberの割り込み関数はこの段階で実装される
loop_rate.sleep();
}
return 0;
}
Control + Shift + Pでコマンド画面を出してC/C++ Edit Configuratons (JSON)を開く
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/catkin_ws/devel/include/**",
"/opt/ros/melodic/include/**",
"/usr/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}