点击(此处)折叠或打开

  1. catkin_make 编译指定的包.
  2. $ catkin_make -DCATKIN_WHITELIST_PACKAGES="package1;package2"

  3. 恢复编译所有的包
  4. $ catkin_make -DCATKIN_WHITELIST_PACKAGES=""
执行roslaunch命令行时,会自动运行roscore命令,因此使用启动文件运行节点时不需要新开终端运行roscore。

点击(此处)折叠或打开

  1. rostopic list #列出话题
  2. rostopic echo 话题 #接收话题

编译时出现 .msg: Invalid declaration: 类型 变量. 切记 <类型 变量>之间的分割为空格 不能是tab.

Built-in types:

Primitive Type

Serialization

C++

Python2

Python3

bool (1)

unsigned 8-bit int

uint8_t (2)

bool

int8

signed 8-bit int

int8_t

int

uint8

unsigned 8-bit int

uint8_t

int (3)

int16

signed 16-bit int

int16_t

int

uint16

unsigned 16-bit int

uint16_t

int

int32

signed 32-bit int

int32_t

int

uint32

unsigned 32-bit int

uint32_t

int

int64

signed 64-bit int

int64_t

long

int

uint64

unsigned 64-bit int

uint64_t

long

int

float32

32-bit IEEE float

float

float

float64

64-bit IEEE float

double

float

string

ascii string (4)

std::string

str

bytes

time

secs/nsecs unsigned 32-bit ints

ros::Time

rospy.Time

duration

secs/nsecs signed 32-bit ints

ros::Duration

rospy.Duration


查看两个frame的坐标系转化关系
rosrun tf tf_echo base_link map
rosrun tf tf_monitor base_link map

命令行发布一个topic
rostopic pub /crash_jump_cmd std_msgs/Empty

ROS_INFO等没有输出的情况:
https://stackoverflow.com/questions/28020473/how-to-output-the-following-result-to-terminal 

点击(此处)折叠或打开

  1. 制作文件 custom_rosconsole.conf

  2. # Set the default ros output to warning and higher
  3. log4j.logger.ros=WARN
  4. # Override my package to output everything (Change the level to fit your needs)
  5. log4j.logger.ros.你的包名=DEBUG

  6. 1. 在bash环境下
  7. export ROSCONSOLE_CONFIG_FILE=<config_file_path>/custom_rosconsole.conf

  8. 2. 或者在 launch 文件中.
  9. <launch>
  10.   <env name="ROSCONSOLE_CONFIG_FILE"
  11.        value="$(find mypackage)/custom_rosconsole.conf"/>
  12.   <node pkg="mypackage" type="mynode" name="mynode" output="screen"/>
  13. </launch>

  14. 还有一种是在代码中设置.
  15. #include <ros/console.h>
  16. if (ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug)) { // Change the level to fit your needs
  17.    ros::console::notifyLoggerLevelsChanged();
  18. }





10-26 01:21
查看更多