-
Notifications
You must be signed in to change notification settings - Fork 4
ROS Commands
Hara edited this page Feb 10, 2022
·
6 revisions
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})
srcの部分はrosdepを実行したいディレクトリを指定
rosdep install -i --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>
using namespace std;
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
}