分类 ROS开发 下的文章

在使用rosbag record录制rosbag时,有时节点异常中断后,会生成以.bag.active为后缀的文件,无法正常播放,提示 xxxxxx is unindexed. Run rosbag reindex.




修复方法:

rosbag reindex xxx.bag.active




此时会生成一个 .bag.org.active 后缀的中间文件,不用管。然后运行:

rosbag fix xxx.bag.active rename.bag

rename.bag 为输出的修复rosbag


1、 package.xml

 

<?xml version="1.0"?>
<package format="2">
  <name>novatel_msgs</name>
  <version>1.0.0</version>
  <description>
    This package provides foo capability.
  </description>
  <license>BSD</license>
  <maintainer email="ivana@willowgarage.com">Ivana Bildbotz</maintainer>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>message_generation</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <build_export_depend>sensor_msgs</build_export_depend>
  <build_export_depend>message_generation</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>sensor_msgs</exec_depend>
  <exec_depend>message_runtime</exec_depend>
</package>


2、CommonHeader.msg

   # On the wire, this header is preceeded by three sync bytes,
# which are 0xAA 0x44 0x12, and a uint8 which is the header length.

# Message ID of the log being output.
uint16 id

# Measurement source, format, response bit.
uint8 msg_type

uint8 port_addr
uint16 length
uint16 sequence

uint8 idle_time
uint8 time_status

uint16 gps_week
uint32 gps_week_seconds

# Table 3 in the SPAN on OEM6 manual.
# See: http://www.novatel.com/assets/Documents/Manuals/OM-20000144UM.pdf#page=13
uint32 receiver_status
uint32 RECEIVER_STATUS_ERROR=1
uint32 RECEIVER_STATUS_TEMPERATURE_WARNING=2
uint32 RECEIVER_STATUS_VOLTAGE_SUPPLY_WARNING=4
uint32 RECEIVER_STATUS_ANTENNA_UNPOWERED=8
uint32 RECEIVER_STATUS_LNA_FAILURE=16
uint32 RECEIVER_STATUS_ANTENNA_OPEN=32
uint32 RECEIVER_STATUS_ANTENNA_SHORTED=64
uint32 RECEIVER_STATUS_CPU_OVERLOADED=128
uint32 RECEIVER_STATUS_COM1_BUFFER_OVERRUN=256
uint32 RECEIVER_STATUS_COM2_BUFFER_OVERRUN=512
uint32 RECEIVER_STATUS_COM3_BUFFER_OVERRUN=1024
uint32 RECEIVER_STATUS_LINK_OVERLOAD=2048
uint32 RECEIVER_STATUS_AUX_TRANSMIT_OVERRUN=8192
uint32 RECEIVER_STATUS_AGC_OUT_OF_RANGE=16384
uint32 RECEIVER_STATUS_INS_RESET=65536
uint32 RECEIVER_STATUS_ALMANAC_INVALID=262144
uint32 RECEIVER_STATUS_POSITION_SOLUTION_INVALID=524288
uint32 RECEIVER_STATUS_POSITION_NOT_FIXED=1048576
uint32 RECEIVER_STATUS_CLOCK_STEERING_DISABLED=2097152
uint32 RECEIVER_STATUS_CLOCK_MODEL_INVALID=4194304
uint32 RECEIVER_STATUS_EXTERNAL_OSCILLATOR_LOCKED=8388608
uint32 RECEIVER_STATUS_SOFTWARE_RESOURCE_WARNING=16777216
uint32 RECEIVER_STATUS_AUXILIARY3_EVENT=536870912
uint32 RECEIVER_STATUS_AUXILIARY2_EVENT=1073741824
uint32 RECEIVER_STATUS_AUXILIARY1_EVENT=2147483648

uint16 reserved
uint16 software_version



3、INSPVAX.msg

  # message 1465
#include  CommonHeader.msg
novatel_msgs/CommonHeader header

# Table 29 in the SPAN on OEM6 manual:
# See: http://www.novatel.com/assets/Documents/Manuals/OM-20000144UM.pdf#page=121
uint32 ins_status
uint32 INS_STATUS_INACTIVE=0
uint32 INS_STATUS_ALIGNING=1
uint32 INS_STATUS_HIGH_VARIANCE=2
uint32 INS_STATUS_SOLUTION_GOOD=3
uint32 INS_STATUS_SOLUTION_FREE=6
uint32 INS_STATUS_ALIGNMENT_COMPLETE=7
uint32 INS_STATUS_DETERMINING_ORIENTATION=8
uint32 INS_STATUS_WAITING_INITIALPOS=9

# Table 30 in the SPAN on OEM6 manual:
# See: http://www.novatel.com/assets/Documents/Manuals/OM-20000144UM.pdf#page=124
uint32 position_type
uint32 POSITION_TYPE_NONE=0
uint32 POSITION_TYPE_SBAS=52
uint32 POSITION_TYPE_PSEUDORANGE_SINGLE_POINT=53
uint32 POSITION_TYPE_PSEUDORANGE_DIFFERENTIAL=54
uint32 POSITION_TYPE_RTK_FLOAT=55
uint32 POSITION_TYPE_RTK_FIXED=56
uint32 POSITION_TYPE_OMNISTAR=57
uint32 POSITION_TYPE_OMNISTAR_HP=58
uint32 POSITION_TYPE_OMNISTAR_XP=59
uint32 POSITION_TYPE_PPP_CONVERGING=73
uint32 POSITION_TYPE_PPP=74

float64 latitude
float64 longitude
float64 altitude

float32 undulation

float64 north_velocity
float64 east_velocity
float64 up_velocity

float64 roll
float64 pitch
float64 azimuth

float32 latitude_std
float32 longitude_std
float32 altitude_std

float32 north_velocity_std
float32 east_velocity_std
float32 up_velocity_std

float32 roll_std
float32 pitch_std
float32 azimuth_std

uint32 extended_status
uint32 EXTENDED_STATUS_POSITION_UPDATE_APPLIED=1
uint32 EXTENDED_STATUS_PHASE_UPDATE_APPLIED=2
uint32 EXTENDED_STATUS_ZUPT_APPLIED=4
uint32 EXTENDED_STATUS_WHEEL_SENSOR_APPLIED=8
uint32 EXTENDED_STATUS_HEADING_UPDATE_APPLIED=16
uint32 EXTENDED_STATUS_INS_SOLUTION_CONVERGED=64

uint16 seconds_since_update





3、CMakeLists.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(novatel_msgs)
add_compile_options(-std=c++14)


find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  roscpp
  std_msgs
  rosbag
  sensor_msgs
  grid_map_core
  grid_map_msgs
  grid_map_ros
  image_transport
  message_generation
)



find_package(Eigen3 3.3.4 REQUIRED)
#find_package(PCL  REQUIRED)




#Add to message files
add_message_files(
  DIRECTORY   ${CMAKE_CURRENT_SOURCE_DIR}/novatel_msgs
  FILES   CommonHeader.msg  INSPVAX.msg
)


#Add to message generator
generate_messages(DEPENDENCIES  std_msgs  sensor_msgs)

# Declare that this catkin package's runtime dependencies
catkin_package(
   CATKIN_DEPENDS message_runtime std_msgs sensor_msgs
)


include_directories(${EIGEN3_INCLUDE_DIRS}
   ${PCL_INCLUDE_DIRS}
   ${roscpp_INCLUDE_DIRS}
   ${std_msgs_INCLUDE_DIRS}
   )


FILE(GLOB SRC_FILES "./*.cpp")


add_executable (ros_demo   ${SRC_FILES})
target_link_libraries (ros_demo
  ${PCL_LIBRARIES}
  ${roscpp_LIBRARIES}
  ${std_msgs_LIBRARIES}
  ${rosbag_LIBRARIES}
  ${catkin_LIBRARIES}
  ${message_filters_LIBRARIES}
)


add_dependencies(ros_demo  ${catkin_EXPORTED_TARGETS})





































































一、按topic过滤

   1、只保留单个topic,比如: /tf

       rosbag    filter      input.bag     output.bag    " topic == '/tf' "

   

   2、只保留: /velodyne_point_cloud 和  /front/image  两个topic

       rosbag    filter      input.bag     output.bag    " topic == ' /velodyne_point_cloud' or  topic == '/front/image'  "


   3、remov 删掉 /velodyne_point_cloud 和 /front_image两个topic

      

       rosbag    filter      input.bag     output.bag    " topic != ' /velodyne_point_cloud' and  topic != '/front/image'  "



一、按topic过滤

   1、只保留单个topic,比如: /tf

       rosbag    filter      input.bag     output.bag    " topic == '/tf' "

   

   2、只保留: /velodyne_point_cloud 和  /front/image  两个topic

       rosbag    filter      input.bag     output.bag    " topic == ' /velodyne_point_cloud' or  topic == '/front/image'  "


   3、remov 删掉 /velodyne_point_cloud 和 /front_image两个topic

      

       rosbag    filter      input.bag     output.bag    " topic != ' /velodyne_point_cloud' and  topic != '/front/image'  "