Main Content

timetable

Create timetable for selected message properties in ROS bag file

Since R2024a

Description

tb = timetable(bag) returns a timetable object tb for all the numeric and scalar message properties in the BagSelection or rosbagreader object, bag. The first column of the timetable consists of timestamps and the rest of the columns consist of message property values for all messages in bag.

You can use the returned timetable object with all the time-specific functions to align, combine, and perform calculations with other timetables. The returned timetable object is memory-efficient because it only stores specific message properties and not whole messages.

example

tb = timetable(bag,property) creates a timetable for a specific message property, property. Property names can also be nested, for example, Pose.Pose.Position.X for the x-axis position of a robot.

example

tb = timetable(bag,property,...,propertyN) creates a timetable for range-specific message properties. Each property is a different column in the timetable object.

example

Examples

collapse all

Load the ROS bag file. Specify the file path.

bagrdr = rosbagreader("ex_multiple_topics.bag");

Select a specific topic. Timetable supports only single topics.

bagSel = select(bagrdr,Topic="/odom");

Create a timetable for all the fields in the /odom topic.

tt1 = timetable(bagSel)
tt1=11998×16 timetable
       Time       /odom_Header.Stamp.Sec    /odom_Header.Stamp.Nsec    /odom_Header.Seq    /odom_Pose.Pose.Position.X    /odom_Pose.Pose.Position.Y    /odom_Pose.Pose.Position.Z    /odom_Pose.Pose.Orientation.X    /odom_Pose.Pose.Orientation.Y    /odom_Pose.Pose.Orientation.Z    /odom_Pose.Pose.Orientation.W    /odom_Twist.Twist.Linear.X    /odom_Twist.Twist.Linear.Y    /odom_Twist.Twist.Linear.Z    /odom_Twist.Twist.Angular.X    /odom_Twist.Twist.Angular.Y    /odom_Twist.Twist.Angular.Z
    __________    ______________________    _______________________    ________________    __________________________    __________________________    __________________________    _____________________________    _____________________________    _____________________________    _____________________________    __________________________    __________________________    __________________________    ___________________________    ___________________________    ___________________________

    201.34 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.35 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.36 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.37 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.38 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec          {1x1 cell}                {1x1 cell}              {1x1 cell}               {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                       {1x1 cell}                       {1x1 cell}                       {1x1 cell}                      {1x1 cell}                    {1x1 cell}                    {1x1 cell}                    {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
      ⋮

Create a new timetable for the Pose.Pose.Position.X property in the /odom topic.

tt2 = timetable(bagSel,"Pose.Pose.Position.X")
tt2=11998×1 timetable
       Time       /odom_Pose.Pose.Position.X
    __________    __________________________

    201.34 sec            {1x1 cell}        
    201.35 sec            {1x1 cell}        
    201.36 sec            {1x1 cell}        
    201.37 sec            {1x1 cell}        
    201.38 sec            {1x1 cell}        
    201.41 sec            {1x1 cell}        
    201.41 sec            {1x1 cell}        
    201.41 sec            {1x1 cell}        
    201.46 sec            {1x1 cell}        
    201.46 sec            {1x1 cell}        
    201.46 sec            {1x1 cell}        
    201.46 sec            {1x1 cell}        
    201.46 sec            {1x1 cell}        
    201.49 sec            {1x1 cell}        
    201.49 sec            {1x1 cell}        
    201.49 sec            {1x1 cell}        
      ⋮

Create a new timetable for all the angular Twist properties in the /odom topic.

tt3 = timetable(bagSel,"Twist.Twist.Angular.X","Twist.Twist.Angular.Y", "Twist.Twist.Angular.Z")
tt3=11998×3 timetable
       Time       /odom_Twist.Twist.Angular.X    /odom_Twist.Twist.Angular.Y    /odom_Twist.Twist.Angular.Z
    __________    ___________________________    ___________________________    ___________________________

    201.34 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.35 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.36 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.37 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.38 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.41 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.46 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
    201.49 sec            {1x1 cell}                     {1x1 cell}                     {1x1 cell}         
      ⋮

Input Arguments

collapse all

Index of the messages in the rosbag, specified as a BagSelection or rosbagreader object. You can get a BagSelection object by calling rosbag.

Property names, specified as a string scalar or character vector. You can specify multiple properties. Each property name is a separate input and represents a different column in the time series object.

Output Arguments

collapse all

Timetable containing the message properties, returned as a timetable object. The first column of the timetable consists of timestamps and the rest of the columns consist of message property values for all messages in bag.

Version History

Introduced in R2024a