Logged Messages Player
[Logging]

This module plays recorded messages via IPC. The module is compromised of two diferent programs, player and playback. The playbacl works in the v1.X log format (1 header file ASCII, 1 data file binary), the player works in the v2.X log format (1 header XML, various data files, binary). More...

Collaboration diagram for Logged Messages Player:

Data Structures

struct  TYPE_shm
struct  logger_callback_t
struct  struct_message
struct  logged_message_type
struct  linked_list
struct  struct_message_types
struct  struct_window
struct  struct_gui_config
struct  struct_combo
class  playback
struct  playback_command_message
 This is a test message, Here you insert the description of the entity, in this case the struct. More...
struct  playback_status_message
 This is a test message, Here you insert the description of the entity, in this case the struct. More...
struct  struct_reduced_message
struct  list
struct  player_config_message
struct  player_messages_message
 Private message for this module. More...
struct  player_contig_message
 Private message for this module. More...

Files

file  playback.cpp
file  player.cpp
 

Player main file.


file  player.h
 

Player main header, global vars and prototypes.


file  player_common.h
 

Common header of tghe player module.


file  player_functions.cpp
 

Playback class source code.


file  player_functions.h
 

Playback class header file.


file  player_gui.cpp
 

Player GUI source code.


file  player_gui.h
 

Player GUI header.


file  player_interface.cpp
 

Interface file for this module.


file  player_interface.h
 

Interface headers for this module.


file  player_messages.h
 

messages.h file for this module. Defines messages this module publishes or serves to others.


Defines

#define MAX_LINE_LENGTH   3000000
#define CLF_READ_DOUBLE(str)   strtod(*(str), (str))
#define CLF_READ_INT(str)   (int)strtol(*(str), (str), 10)
#define CLF_READ_HEX(str)   (char)strtol(*(str), (str), 16)
#define CLF_READ_CHAR(str)   (char) ( ( (*str)++)[0] )
#define MAX_NUMBER_MESSAGE_TYPES   20
 Maximum number of messages types.
#define null   NULL
 Same as NULL.
#define null   NULL
 Same as NULL.
#define perr(a)   _perr(__FUNCTION__,__LINE__,(a));
 Custom error print function, this function prints a error message in the formagt: Error!! (__FUNCTION__,__LINE__) custom_message.
#define pwarn(a)   _pwarn(__FUNCTION__,__LINE__,(a));
 Custom warning print function, this function prints a warning message in the formagt: Warning!! (__FUNCTION__,__LINE__) custom_message.
#define pdeb(a)   _pdeb(__FUNCTION__,__LINE__,(a));
 Custom debug print function, this function prints a debug message in the formagt: Debug! (__FUNCTION__,__LINE__) custom_message.
#define p(a)   _p(a);
 Custom print function, this function prints a message in the formagt: MODULE_NAME (__FUNCTION__,__LINE__) custom_message.
#define LOG_VERSION   "v2.14"
 Log_recorder version.
#define PLAYBACK_RESET_OCCURRED_NAME   "playback_reset_occurred"
 Control message to pass to the process control module. Always capitals finishes with _RESET_OCCURRED_NAME and the value is small letters the same without the suffix name.
#define PLAYBACK_RESET_COMMAND_NAME   "playback_reset_command"
 Control message to pass to the process control module. Always capitals finishes with _RESET_COMMAND_NAME and the value is small letters the same without the suffix name.
#define PLAYER_CONFIG_MESSAGE_NAME   (char*)"player_config"
 Name of the message passed to IPC.
#define PLAYER_CONFIG_MESSAGE_FMT   (char*)"{double,double,uint,<string:3>}"
 Format of the message passed to IPC.
#define PLAYBACK_COMMAND_MESSAGE_NAME   (char*)"playback_command"
 Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.
#define PLAYBACK_COMMAND_MESSAGE_FMT   (char*)"{int,double,int,double,string}"
 Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.
#define PLAYBACK_STATUS_MESSAGE_NAME   (char*)"playback_status"
 Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.
#define PLAYBACK_STATUS_MESSAGE_FMT   (char*)"{double,int,int,double,string}"
 Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.
#define PLAYER_LIST_MESSAGE_NAME   (char*)"player_list"
 Name of the message passed to IPC.
#define PLAYER_LIST_MESSAGE_FMT   (char*)"{uint,<{double,uint}:1>}"
 Format of the message passed to IPC.

Typedefs

typedef char *(* converter_func )(char *, void **, char *, FORMATTER_PTR)
typedef linked_list mlist
typedef carmen_default_message playback_reset_occurred_message
typedef carmen_default_message playback_reset_command_message
typedef struct list player_list_message

Enumerations

enum  enum_status {
  STOP, PLAY, SEEK, FORWARD,
  BACKWARD, SPEED, STEP_FORWARD, STEP_BACKWARD
}
enum  enum_publish_commands { ACTIVATE = 50, DEACTIVATE }

Functions

void ipm_query_shminfo_handler (MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *clientData)
char * lar_ipm_shm_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR fmt)
char * auxiliar_ipm_shm_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR)
char * auxiliar_firei_server_3_shm_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR)
char * auxiliar_hokuyo_shm_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR fmt)
void query_laser_handler (MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *clientData)
char * data_file_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR)
void print_playback_status (void)
void playback_command_handler (carmen_playback_command_message *command)
void register_ipc_messages (void)
void wait_for_timestamp (double ts)
int read_message (int message_num, int publish)
void main_playback_loop (void)
void usage (char *fmt,...)
void read_parameters (int argc, char **argv)
void shutdown_playback_module (int sig)
void initialize_playback_format ()
void firei_server_n3_query_shminfo_handler (MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
void hokuyo_server_query_shminfo_handler (MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
void subscribe_ipm_initial_data (void)
void subscribe_camera_3_initial_data (void)
void subscribe_hokuyo_initial_data (void)
int main (int argc, char **argv)
char * lar_unified_string_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR fmt)
int first_wordlength (char *str)
void copy_host_string (char **host, char **string)
char * auxiliar_unified_string_to_message (char *string, void **message, char *logger_message_name, FORMATTER_PTR fmt, carmen_FILE *datafile)
void PublishConfigMessage (void)
 Publish a configure message to the gui. This function sends a configure message to the GUI. It waits for it to be ready.
void command_handler (playback_command_message *command_message)
 Handle command messages This function handles command messages sent by the GUI.
void manager_shutdown_module (int x)
void read_line (FILE *buffer, char *line)
 Reads a line from a buffer.
void printf_usage (char *argv)
 Prints this module usage.
void _perr (const char *function_name, unsigned int line, const char *text)
 Print Error This function prints a error message using the name of the calling function, the line it was called and a custom message.
void _pwarn (const char *function_name, unsigned int line, const char *text)
 Print warning This function prints a warning message using the name of the calling function, the line it was called and a custom message.
void _pdeb (const char *function_name, unsigned int line, const char *text)
 Print debug This function prints a debug message using the name of the calling function, the line it was called and a custom message.
void _p (const char *text)
 Print This function prints a message using the name of the module and a custom message.
void print_xpath_nodes (xmlNodeSetPtr nodes, FILE *output)
int StartGui (int argc, char **argv)
 Main GUI function This function starts the GUI.
gint timeout_callback (gpointer)
 GTK timeout. This function forces the GUI to sleep.
void ConfigGui (struct_gui_config *config)
 Default variables This function sets the default values for some variables,.
void MarkHighlitedType (struct_combo *combo)
 Changes the background on the selected message type.
void WaitForFirstMessage (struct_gui_config *config)
 Waits for first message.
void button_callback (GtkButton *button, gpointer data)
 Main button callback This function is a callback for all buttons.
void MoveScrollBar (struct_combo *combo)
 Move the scroll bar This function moves the horizontal scroll bar if the autoscroll is enabled.
gboolean h_scroll_moved (GtkRange *, GtkScrollType, gdouble, gpointer data)
 Callback for scroll bar moves This function checks if it was i that moved the scroll bar and if not we turn off the autoscroll. When the used moves the scroll bar by hand the autoscroll is disabled.
gboolean zoom_change (GtkRange *, gpointer data)
 Callback for zoom change This function redraws widgets based on the new zoom level.
void CreatMainWindow (struct_window *gtk, struct_gui_config *config)
 Create main window. This function packs all widgets together.
void checkbutton_toggled (GtkToggleButton *button, gpointer)
 Callback for checkbuttons Activates or deactivates a message type.
gboolean speed_change (GtkRange *range, gpointer)
 Callback for speed change Gets the new value and sends it to the manager.
gboolean on_destroy (GtkWidget *, gpointer)
 Destroy callback Kill it self and the father.
void CreateMarker (struct_combo *combo)
 Create marker Create a marker at the current time position.
gboolean mouse_over (GtkWidget *, GdkEventCrossing *event, gpointer data)
 Mouse over callback Change marker background color.
void LayoutTimebar (struct_window *gtk, struct_gui_config *config)
 Layout labels with the time Draws a serires of labels on the GUI timestamps.
gboolean zone_pressed_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
 Function called when a zone was pressed Seeks to the position seleted and changes the highlited_type.
void CreateDrawingArea (GtkWidget **widget, struct_combo *combo)
 Create drawing area Create the underlying drawing area of the zone.
gboolean motion_event_callback (GtkWidget *, GdkEventMotion *event, gpointer data)
 Drags the marker Drags the marker to a new position making a seek in the manager.
gboolean drag_event_callback (GtkWidget *, GdkEventButton *event, gpointer data)
 Draw event callback Sets or resets drawing state. If the marker was pressed begin drawing else stop draging.
gboolean expose_event_callback (GtkWidget *widget, GdkEventExpose *, gpointer data)
 Redraw the underlying widget and timebars.
int ColorShort2Long (int input)
void status_handler (playback_status_message *msg)
void MoveMarker (struct_combo *combo, double time)
 Move the marker to a new position.
void gui_shutdown_module (int x)
gboolean force_redraw (GtkWidget *widget)
int playback_subscribe_command (playback_command_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes playback_command_message messages. Uses broadcast to all subscribers. Can be used by other modules.
int playback_publish_command (playback_command_message *msg)
 Publishes playback_command_message messages. Uses broadcast to all subscribers. Usually is only used by playback.
int playback_subscribe_status (playback_status_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes playback_status_message messages. Uses broadcast to all subscribers. Can be used by other modules.
int playback_publish_status (playback_status_message *msg)
 Publishes playback_status_message messages. Uses broadcast to all subscribers. Usually is only used by playback.
int player_subscribe_config (player_config_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes player_config_message messages.
int player_publish_config (player_config_message *msg)
 Publishes player_config_message messages.
int player_subscribe_list (player_list_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes player_messages_message messages. Uses broadcast to all subscribers. Can be used by other modules.
int player_publish_list (player_list_message *msg)
 playback::playback ()
 PLayback constructur. Stars a new playback class.
 playback::~playback ()
 PLayback deconstructur.
int playback::OpenLogFile (char *filename)
 Open log file.
void playback::CountMessages (char *filename)
void playback::CountHandler (xmlTextReaderPtr reader)
void playback::LowLevelIndex (char *filename)
void playback::IndexHandler (xmlTextReaderPtr reader)
int playback::IndexMessagesXML ()
 Index the xml header file.
int playback::CloseLogXml (void)
 Close the log header.
int playback::RegisterMessages (void)
 Register IPC messages.
int playback::ReadMessageFromFile (int message_number)
 Read message from data file.
int playback::SendMessage (int message_number)
 Send message via IPC.
int playback::PlaySingleMessage (int message_number)
 Play single message.
int playback::Play (void)
 Play mode.
int playback::SetStatus (enum_status new_status)
 Sets the status variable.
int playback::SetDirection (enum_status new_status)
 Sets the direction variable.
int playback::SetSpeed (double new_speed)
 Sets the speed variable.
int playback::Dispatch (void)
 Dispatch new recived status.
int playback::Stop (void)
 Stop the player.
int playback::StepForward (double type)
 Steps one message forward.
int playback::StepBackward (double type)
 Steps one message backward.
int playback::Activate (int id)
 Activate the publish of a specific type of messages.
int playback::Deactivate (int id)
 Deactivate the publish of a specific type of messages.
void playback::Sleep (double time)
 Sleep function.
int playback::Seek (double time)
 Jump to a specific time.
int playback::PublishStatus (playback_status_message *msg, bool force=FALSE)
 Publish a status message.
void playback::GetName (xmlTextReaderPtr reader)
void playback::GetValue (xmlTextReaderPtr reader)
void playback::GetAttribute (xmlTextReaderPtr reader, const xmlChar *name)

Variables

carmen_FILE * logfile = NULL
carmen_FILE * datafile = NULL
carmen_logfile_index_p logfile_index = NULL
double playback_starttime = 0.0
double last_logfile_time = 0.0
double playback_speed = 1.0
int current_position = 0
int offset = 0
int paused = 1
int fast = 0
int advance_frame = 0
int rewind_frame = 0
int basic_messages = 0
double playback_timestamp
FORMATTER_PTR format
robot_motion_command_messagemotion_command
robot_lights_command_messagelights_command
TYPE_laser3d_pointcloud_messagelaser3d_message
xb3_3dpointcloud_messagexb3_message
xb3_stereoimage_messagexb3_image_message
xsens_data_messagexsens_message
camera_image_messagecamera_n0
camera_image_messagecamera_n1
camera_image_messagecamera_n2
ipm_data_messageipm_data_msg
ipm_heartbeat_messageipm_heartbeat
camera_image_messagecamera_n3
camera_heartbeat_messagecamera_n3_heartbeat
carmen_laser_laser_message * hokuyo_message
hokuyo_utm_heartbeat_messagehokuyo_heartbeat
gps_gpgga_data_messagegpgga
gps_gprmc_data_messagegprmc
hokuyo_pointcloud_messagehokuyo_3d
TYPE_ipm_expert_params ipm_params
TYPE_shm ipm_shm
TYPE_shm firei_server_n3_shm
TYPE_shm hokuyo_server_shm
IplImage * ipmauxiliar = NULL
logger_callback_t logger_callbacks []
playback control
playback_command_message command_message
playback_status_message status_message
playback_status_message status_message
struct_combodata
 Pointer to a global structure containing a representation of the GUI.
playback_command_message command_message
playback_status_message status_message

Detailed Description

This module plays recorded messages via IPC. The module is compromised of two diferent programs, player and playback. The playbacl works in the v1.X log format (1 header file ASCII, 1 data file binary), the player works in the v2.X log format (1 header XML, various data files, binary).

Author:
jalmeida
Version:
2.14
Date:
18 May 2010

Define Documentation

#define CLF_READ_CHAR ( str   )     (char) ( ( (*str)++)[0] )
#define CLF_READ_DOUBLE ( str   )     strtod(*(str), (str))
#define CLF_READ_HEX ( str   )     (char)strtol(*(str), (str), 16)
#define CLF_READ_INT ( str   )     (int)strtol(*(str), (str), 10)
#define LOG_VERSION   "v2.14"

Log_recorder version.

Referenced by logger::logger(), and logger::StartLog().

#define MAX_LINE_LENGTH   3000000

Referenced by read_message().

#define MAX_NUMBER_MESSAGE_TYPES   20

Maximum number of messages types.

Todo:
not include message types that have 0 messages
#define null   NULL

Same as NULL.

#define null   NULL
#define p (  )     _p(a);
#define pdeb (  )     _pdeb(__FUNCTION__,__LINE__,(a));

Custom debug print function, this function prints a debug message in the formagt: Debug! (__FUNCTION__,__LINE__) custom_message.

#define perr (  )     _perr(__FUNCTION__,__LINE__,(a));
#define PLAYBACK_COMMAND_MESSAGE_FMT   (char*)"{int,double,int,double,string}"

Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.

#define PLAYBACK_COMMAND_MESSAGE_NAME   (char*)"playback_command"

Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.

#define PLAYBACK_RESET_COMMAND_NAME   "playback_reset_command"

Control message to pass to the process control module. Always capitals finishes with _RESET_COMMAND_NAME and the value is small letters the same without the suffix name.

#define PLAYBACK_RESET_OCCURRED_NAME   "playback_reset_occurred"

Control message to pass to the process control module. Always capitals finishes with _RESET_OCCURRED_NAME and the value is small letters the same without the suffix name.

#define PLAYBACK_STATUS_MESSAGE_FMT   (char*)"{double,int,int,double,string}"

Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.

#define PLAYBACK_STATUS_MESSAGE_NAME   (char*)"playback_status"

Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.

#define PLAYER_CONFIG_MESSAGE_FMT   (char*)"{double,double,uint,<string:3>}"

Format of the message passed to IPC.

#define PLAYER_CONFIG_MESSAGE_NAME   (char*)"player_config"

Name of the message passed to IPC.

#define PLAYER_LIST_MESSAGE_FMT   (char*)"{uint,<{double,uint}:1>}"

Format of the message passed to IPC.

#define PLAYER_LIST_MESSAGE_NAME   (char*)"player_list"

Name of the message passed to IPC.

#define pwarn (  )     _pwarn(__FUNCTION__,__LINE__,(a));

Custom warning print function, this function prints a warning message in the formagt: Warning!! (__FUNCTION__,__LINE__) custom_message.

Referenced by playback::IndexHandler(), logger::InstallParameters(), and logger::ReadFormatsFromFile().


Typedef Documentation

typedef char*(* converter_func)(char *, void **, char *, FORMATTER_PTR)
typedef linked_list mlist
typedef carmen_default_message playback_reset_command_message
typedef carmen_default_message playback_reset_occurred_message
typedef struct list player_list_message

Enumeration Type Documentation

Enumerator:
ACTIVATE 

Activate the publish of a message type.

DEACTIVATE 

Deactivatge the publish of a message type.

Enumerator:
STOP 

Stoped status.

PLAY 

Playing status.

SEEK 

Seek status.

FORWARD 

The player is going forward.

BACKWARD 

The player is going backward.

SPEED 

Speed change.

STEP_FORWARD 

Step one message forward.

STEP_BACKWARD 

Step one message backward.


Function Documentation

void _p ( const char *  text  ) 

Print This function prints a message using the name of the module and a custom message.

void _pdeb ( const char *  function_name,
unsigned int  line,
const char *  text 
)

Print debug This function prints a debug message using the name of the calling function, the line it was called and a custom message.

void _perr ( const char *  function_name,
unsigned int  line,
const char *  text 
)

Print Error This function prints a error message using the name of the calling function, the line it was called and a custom message.

void _pwarn ( const char *  function_name,
unsigned int  line,
const char *  text 
)

Print warning This function prints a warning message using the name of the calling function, the line it was called and a custom message.

int playback::Activate ( int  id  )  [inherited]

Activate the publish of a specific type of messages.

Parameters:
id message type to activate.
Returns:
error code Messages of this type will be played.

References playback::message_types, struct_message_types::publish, and TRUE.

char * auxiliar_firei_server_3_shm_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR   
)
char * auxiliar_hokuyo_shm_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR  fmt 
)
char * auxiliar_ipm_shm_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR   
)
char* auxiliar_unified_string_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR  fmt,
carmen_FILE *  datafile 
)
void button_callback ( GtkButton *  button,
gpointer  data 
)

Main button callback This function is a callback for all buttons.

Get the pointer to the config structure

play button pressed

stop button pressed

step forward button pressed

step forward button pressed

void checkbutton_toggled ( GtkToggleButton *  button,
gpointer   
)

Callback for checkbuttons Activates or deactivates a message type.

Get the widget name

int playback::CloseLogXml ( void   )  [inherited]

Close the log header.

Returns:
error code This function closes the log header file.

Cleanup of XPath data

Free the document

int ColorShort2Long ( int  input  ) 
void command_handler ( playback_command_message command_message  ) 

Handle command messages This function handles command messages sent by the GUI.

void ConfigGui ( struct_gui_config config  ) 

Default variables This function sets the default values for some variables,.

void copy_host_string ( char **  host,
char **  string 
)
void playback::CountHandler ( xmlTextReaderPtr  reader  )  [inherited]

References playback::GetName(), playback::number_message_types, playback::text, and playback::total_messages.

Referenced by playback::CountMessages().

Here is the call graph for this function:

Here is the caller graph for this function:

void playback::CountMessages ( char *  filename  )  [inherited]

References playback::CountHandler(), perr, and ret.

Referenced by playback::IndexMessagesXML().

Here is the call graph for this function:

Here is the caller graph for this function:

void CreateDrawingArea ( GtkWidget **  widget,
struct_combo combo 
)

Create drawing area Create the underlying drawing area of the zone.

Create new drawing area

Connect to the expose event

Set widget events

Todo:
Create the handlers for some of the events

Set the drawing area size

void CreateMarker ( struct_combo combo  ) 

Create marker Create a marker at the current time position.

Set the drawing area size

Connect to the expose event

Set widget events

Todo:
Create the handlers for some of the events

void CreatMainWindow ( struct_window gtk,
struct_gui_config config 
)

Create main window. This function packs all widgets together.

Creat button hbox

Create the buttons

Create a new hbox that will acomodate the speed indicator

Create the speed label and scale

Pack the speed label and adjustment into the hbox and show them

Create a new hbox that will acomodate the zoom indicator

Create the zoom label and scale

Pack the speed label and adjustment into the hbox and show them

Pack all the buttons to the buttons box and also the speed hbox

Show all the widgets

--------------

Create scrolled window

----------------

Create layout

----------------

Add stuff to the layout

Background color of the drawing areas

Layout the timeline

Put the initial time label with the tooltip

Make checkbuttons

-----------------

Make Drawing areas

Put the drawing areas in the layout and change their background color

Define each drawing area name

Show the widget

Increment the y position

Show the layout

---------------- Create the separation bar

Create the status bar

Create main vbox

----------------

Create window

Put a icon on the window

-------------

char * data_file_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR  fmt 
)

References CLF_READ_DOUBLE, CLF_READ_INT, datafile, and i.

int playback::Deactivate ( int  id  )  [inherited]

Deactivate the publish of a specific type of messages.

Parameters:
id message type to deactivate.
Returns:
error code Messages of this type will not be played.

References FALSE, playback::message_types, and struct_message_types::publish.

int playback::Dispatch ( void   )  [inherited]

Dispatch new recived status.

Returns:
error code This function acts on a message recived.

References playback::Play(), PLAY, and playback::status.

Here is the call graph for this function:

gboolean drag_event_callback ( GtkWidget *  ,
GdkEventButton *  event,
gpointer  data 
)

Draw event callback Sets or resets drawing state. If the marker was pressed begin drawing else stop draging.

Get the pointer to the config structure

gboolean expose_event_callback ( GtkWidget *  widget,
GdkEventExpose *  ,
gpointer  data 
)

Redraw the underlying widget and timebars.

Static segments and initialise flag

Get the pointer to the config structure

Get the total number of time ticks to use

Get the widget name

If initialise alloc the segments and set their values from the timestamps

Alloc the pointers

Go through all the message types

Alloc all the segments

Set all the segments values

Alloc time ticks

Go through all the message types

Set all the segments values

Alloc time ticks

transform the name into an id

Create the message bar color and tick color

Draw the segments correspondig to the zone being redrawn

Draw the time ticks

void firei_server_n3_query_shminfo_handler ( MSG_INSTANCE  msgRef,
BYTE_ARRAY  callData,
void *   
)
int first_wordlength ( char *  str  ) 
gboolean force_redraw ( GtkWidget *  widget  ) 
void playback::GetAttribute ( xmlTextReaderPtr  reader,
const xmlChar *  name 
) [inherited]

References playback::text.

Referenced by playback::IndexHandler().

Here is the caller graph for this function:

void playback::GetName ( xmlTextReaderPtr  reader  )  [inherited]

References playback::text.

Referenced by playback::CountHandler(), and playback::IndexHandler().

Here is the caller graph for this function:

void playback::GetValue ( xmlTextReaderPtr  reader  )  [inherited]

References playback::text, and value.

Referenced by playback::IndexHandler().

Here is the caller graph for this function:

void gui_shutdown_module ( int  x  ) 
gboolean h_scroll_moved ( GtkRange *  ,
GtkScrollType  ,
gdouble  ,
gpointer  data 
)

Callback for scroll bar moves This function checks if it was i that moved the scroll bar and if not we turn off the autoscroll. When the used moves the scroll bar by hand the autoscroll is disabled.

Get the pointer to the config structure

void hokuyo_server_query_shminfo_handler ( MSG_INSTANCE  msgRef,
BYTE_ARRAY  callData,
void *   
)
void playback::IndexHandler ( xmlTextReaderPtr  reader  )  [inherited]
int playback::IndexMessagesXML ( void   )  [inherited]

Index the xml header file.

Returns:
error code This function reads the xml header file and parses into memory the messages in it.

Alloc message types

Alloc Message structures

References playback::CountMessages(), playback::file_handle, playback::LowLevelIndex(), playback::message_types, playback::messages, playback::struct_file_handle::name, playback::number_message_types, p, and playback::total_messages.

Here is the call graph for this function:

void initialize_playback_format (  ) 

References i.

void ipm_query_shminfo_handler ( MSG_INSTANCE  msgRef,
BYTE_ARRAY  callData,
void *  clientData 
)

References err, TYPE_shm::id, IPM_SERVER_SHMINFO_MESSAGE_NAME, and TYPE_shm::size.

Referenced by auxiliar_ipm_shm_to_message().

Here is the caller graph for this function:

char* lar_ipm_shm_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR  fmt 
)
char * lar_unified_string_to_message ( char *  string,
void **  message,
char *  logger_message_name,
FORMATTER_PTR  fmt 
)
void LayoutTimebar ( struct_window gtk,
struct_gui_config config 
)

Layout labels with the time Draws a serires of labels on the GUI timestamps.

If initialise create the new labels and put them if the right place

If two labels became too close together i separate them and calculate the new total labels

Recalculate dx with the new total and calculate the dt

Alloc all the pointes

Create all the new labels

Referenced by zoom_change().

Here is the caller graph for this function:

void playback::LowLevelIndex ( char *  filename  )  [inherited]

References playback::IndexHandler(), and ret.

Referenced by playback::IndexMessagesXML().

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Check arg count

Do forking and start gui

Start Ipc comm

Catch signals

Open Log file

Index messages and types

Registry message types

Send configuration message to gui (this functions waits untill the gui is connected to the ipc to publish a config message)

Subscribe command messages

Do main loop

void main_playback_loop ( void   ) 
void manager_shutdown_module ( int  x  ) 
void MarkHighlitedType ( struct_combo combo  ) 

Changes the background on the selected message type.

Parameters:
combo general data pointer
gboolean motion_event_callback ( GtkWidget *  ,
GdkEventMotion *  event,
gpointer  data 
)

Drags the marker Drags the marker to a new position making a seek in the manager.

Get the pointer to the config structure

gboolean mouse_over ( GtkWidget *  ,
GdkEventCrossing *  event,
gpointer  data 
)

Mouse over callback Change marker background color.

Get the pointer to the config structure

void MoveMarker ( struct_combo combo,
double  time 
)

Move the marker to a new position.

void MoveScrollBar ( struct_combo combo  ) 

Move the scroll bar This function moves the horizontal scroll bar if the autoscroll is enabled.

void on_destroy ( GtkWidget *  ,
gpointer   
)

Destroy callback Kill it self and the father.

Referenced by main().

Here is the caller graph for this function:

int playback::OpenLogFile ( char *  filename  )  [inherited]

Open log file.

Parameters:
filename Name of the header file.
Returns:
error code This function set the log header file name.

Obtain log folder

References playback::file_handle, playback::struct_file_handle::folder, i, and playback::struct_file_handle::name.

int playback::Play ( void   )  [inherited]

Play mode.

Returns:
error code This function enters play mode. In this mode messages are continuously read from memory and sent. Controls can be sent to the player module to stop this mode.

Check with direction are we going and select the right message

Sleep the required time to reach the next message

Test if this message is to be played or not

reached the end of file

References BACKWARD, playback::current_message, playback::direction, FORWARD, playback::message_types, playback::messages, PLAY, playback::ReadMessageFromFile(), playback::SendMessage(), playback::Sleep(), playback::speed, playback::status, STOP, timediff(), struct_message::timestamp, and playback::total_messages.

Referenced by playback::Dispatch().

Here is the call graph for this function:

Here is the caller graph for this function:

playback::playback (  )  [inherited]
void playback_command_handler ( carmen_playback_command_message *  command  ) 

References advance_frame, current_position, offset, paused, playback_speed, playback_starttime, playback_timestamp, print_playback_status(), and rewind_frame.

Referenced by register_ipc_messages().

Here is the call graph for this function:

Here is the caller graph for this function:

int playback_publish_command ( playback_command_message msg  ) 

Publishes playback_command_message messages. Uses broadcast to all subscribers. Usually is only used by playback.

Parameters:
msg Pointer to message.
Returns:
nothing
int playback_publish_status ( playback_status_message msg  ) 

Publishes playback_status_message messages. Uses broadcast to all subscribers. Usually is only used by playback.

Parameters:
msg Pointer to message.
Returns:
nothing

Referenced by playback::PublishStatus().

Here is the caller graph for this function:

int playback_subscribe_command ( playback_command_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes playback_command_message messages. Uses broadcast to all subscribers. Can be used by other modules.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new command.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.
int playback_subscribe_status ( playback_status_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes playback_status_message messages. Uses broadcast to all subscribers. Can be used by other modules.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new status.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.
int player_publish_config ( player_config_message msg  ) 

Publishes player_config_message messages.

Parameters:
msg Pointer to message.
Returns:
nothing
int player_publish_list ( player_list_message msg  ) 
int player_subscribe_config ( player_config_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes player_config_message messages.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new config.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.
int player_subscribe_list ( player_list_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes player_messages_message messages. Uses broadcast to all subscribers. Can be used by other modules.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new config.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.
int playback::PlaySingleMessage ( int  message_number  )  [inherited]

Play single message.

Parameters:
message_number message to play
Returns:
error code This function reads from the data file a message and sends it with IPC.

References playback::ReadMessageFromFile(), ret, and playback::SendMessage().

Referenced by playback::Seek(), playback::StepBackward(), and playback::StepForward().

Here is the call graph for this function:

Here is the caller graph for this function:

void print_playback_status ( void   ) 

References paused, playback_timestamp, and str.

Referenced by main_playback_loop(), playback_command_handler(), and read_message().

Here is the caller graph for this function:

void print_xpath_nodes ( xmlNodeSetPtr  nodes,
FILE *  output 
)
void printf_usage ( char *  argv  ) 

Prints this module usage.

void PublishConfigMessage ( void   ) 

Publish a configure message to the gui. This function sends a configure message to the GUI. It waits for it to be ready.

Copy all data

Wait for the gui

Wait for the gui

int playback::PublishStatus ( playback_status_message msg,
bool  force = FALSE 
) [inherited]

Publish a status message.

Parameters:
msg IPC message struct.
force force a message to be sent. This function periodicly sends a IPC message containing the player status. This message is recived the the GUI.

References playback::current_message, playback_status_message::message, playback::messages, playback_publish_status(), playback::publish_status_frequency, playback::status, playback_status_message::status, playback_status_message::time, and struct_message::timestamp.

Referenced by playback::Sleep(), playback::StepBackward(), and playback::StepForward().

Here is the call graph for this function:

Here is the caller graph for this function:

void query_laser_handler ( MSG_INSTANCE  msgRef,
BYTE_ARRAY  callData,
void *  clientData 
)
void read_line ( FILE *  buffer,
char *  line 
)

Reads a line from a buffer.

get a full line from the file

Parameters:
buffer File buffer.
line pointer to a place where the line will be placed.

Referenced by load_pts(), and module_from_file().

Here is the caller graph for this function:

int read_message ( int  message_num,
int  publish 
)

References basic_messages, command, logger_callback_t::conv_func, err, i, logfile, logfile_index, MAX_LINE_LENGTH, playback_timestamp, print_playback_status(), and wait_for_timestamp().

Referenced by main_playback_loop().

Here is the call graph for this function:

Here is the caller graph for this function:

void read_parameters ( int  argc,
char **  argv 
)

References basic_messages, fast, index, paused, and usage().

Here is the call graph for this function:

int playback::ReadMessageFromFile ( int  message_number  )  [inherited]

Read message from data file.

Parameters:
message_number message to read
Returns:
error code This function reads from the data file a specific message corresponding to the number message_number.

Allocs the byte array with the known message size

Moves the file pointer to the start of the message

Reads the message from the data file

Free the last message

Unmarshall the message to the storage area

Free the byte array

References fp, i, struct_message::id, struct_message_types::message_storage, playback::message_types, playback::messages, null, playback::start_time, timestamp, and playback::total_messages.

Referenced by playback::Play(), and playback::PlaySingleMessage().

Here is the caller graph for this function:

void register_ipc_messages ( void   ) 
int playback::RegisterMessages ( void   )  [inherited]

Register IPC messages.

Returns:
error code This function registers IPC message formats.

References err, i, playback::message_types, and playback::number_message_types.

int playback::Seek ( double  time  )  [inherited]

Jump to a specific time.

Parameters:
time time to seek. Finds the time in the timesteps and moves the current_message.

References playback::current_message, i, playback::messages, playback::PlaySingleMessage(), and timestamp.

Here is the call graph for this function:

int playback::SendMessage ( int  message_number  )  [inherited]

Send message via IPC.

Parameters:
message_number message to send
Returns:
error code Sends a message via IPC corresponding to message_number.

Publish message

References playback::message_types, and playback::messages.

Referenced by playback::Play(), and playback::PlaySingleMessage().

Here is the caller graph for this function:

int playback::SetDirection ( enum_status  new_status  )  [inherited]

Sets the direction variable.

Parameters:
new_status new direction to be set
Returns:
error code This function sets the direction variable. The direction variable indicates in which direction are messages being played.

References playback::direction.

int playback::SetSpeed ( double  new_speed  )  [inherited]

Sets the speed variable.

Parameters:
new_speed new set to be used
Returns:
error code This function sets the speed variable.

References playback::speed.

int playback::SetStatus ( enum_status  new_status  )  [inherited]

Sets the status variable.

Parameters:
new_status new status to be set
Returns:
error code This function sets the status variable. The status variable indicates if the player is playing or stoped, and a change in it's value forces the player to go to that status.

References playback::status.

void shutdown_playback_module ( int  sig  ) 

References TYPE_shm::data, and TYPE_shm::id.

void playback::Sleep ( double  time  )  [inherited]

Sleep function.

Parameters:
time time to sleep. When the player is playing this function is used to perform the sleep between messages.

References playback::PublishStatus(), and status_message.

Referenced by playback::Play().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean speed_change ( GtkRange *  range,
gpointer   
)

Callback for speed change Gets the new value and sends it to the manager.

Get the current range position

If greater than 0 send a forward message and set speed

If 0 send a stop message

Else send a backward message and the speed value

int StartGui ( int  argc,
char **  argv 
)

Main GUI function This function starts the GUI.

Start Ipc comm

Catch signals

Set the config default values

With for the rest of the configuration from the father process

Subscribe status messages

void status_handler ( playback_status_message msg  ) 
int playback::StepBackward ( double  type  )  [inherited]

Steps one message backward.

Parameters:
type message type to step.
Returns:
error code Jumps one message of a defined type, messages of other types that stand in the way are published disregarding their timestamp.

References playback::current_message, playback::messages, playback::PlaySingleMessage(), playback::PublishStatus(), status_message, and TRUE.

Here is the call graph for this function:

int playback::StepForward ( double  type  )  [inherited]

Steps one message forward.

Parameters:
type message type to step.
Returns:
error code Jumps one message of a defined type, messages of other types that stand in the way are published disregarding their timestamp.

References playback::current_message, playback::messages, playback::PlaySingleMessage(), playback::PublishStatus(), status_message, playback::total_messages, and TRUE.

Here is the call graph for this function:

int playback::Stop ( void   )  [inherited]

Stop the player.

Returns:
error code Same as SetStatus(STOP);

References playback::status, and STOP.

void subscribe_camera_3_initial_data ( void   ) 
void subscribe_hokuyo_initial_data ( void   ) 
void subscribe_ipm_initial_data ( void   ) 
gint timeout_callback ( gpointer   ) 

GTK timeout. This function forces the GUI to sleep.

void usage ( char *  fmt,
  ... 
)

Referenced by read_parameters().

Here is the caller graph for this function:

void wait_for_timestamp ( double  ts  ) 

References fast, paused, playback_speed, and playback_starttime.

Referenced by read_message().

Here is the caller graph for this function:

void WaitForFirstMessage ( struct_gui_config config  ) 

Waits for first message.

Parameters:
config general config This function waits for the player to send it a configuration message.

Get the layout width and log lenght, also set the unresticted_maximum_zoom config variable

Alloc the messages data structures

Copy the names and set the number of messages to zero

Get the number of messages

Malloc the messages timestamps

Create local counter of messages

Get the timestamps

gboolean zone_pressed_callback ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
)

Function called when a zone was pressed Seeks to the position seleted and changes the highlited_type.

Get the pointer to the config structure

Get the widget name

gboolean zoom_change ( GtkRange *  range,
gpointer  data 
)
playback::~playback (  )  [inherited]

PLayback deconstructur.


Variable Documentation

int advance_frame = 0
int basic_messages = 0

Referenced by read_message(), and read_parameters().

Pointer to a global structure containing a representation of the GUI.

Referenced by main().

carmen_FILE* datafile = NULL
int fast = 0
FORMATTER_PTR format
carmen_laser_laser_message* hokuyo_message

Referenced by heartbeat_handler(), and main().

IplImage* ipmauxiliar = NULL
double last_logfile_time = 0.0
carmen_FILE* logfile = NULL

Referenced by read_message().

carmen_logfile_index_p logfile_index = NULL

Referenced by main_playback_loop(), and read_message().

Initial value:
 {
    {(char*)ROBOT_MOTION_COMMAND_NAME,(char*)ROBOT_MOTION_COMMAND_FMT, (converter_func)data_file_to_message, (void**)&motion_command, 0,NULL},
    {(char*)ROBOT_LIGHTS_COMMAND_NAME,(char*)ROBOT_LIGHTS_COMMAND_FMT, (converter_func)data_file_to_message, (void**)&lights_command, 0,NULL},
    {(char*)LASER3D_POINTCLOUD_MESSAGE_NAME,(char*)LASER3D_POINTCLOUD_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&laser3d_message, 0,NULL},
    {(char*)CAMERA_N0_IMAGE_NAME,(char*)CAMERA_N0_IMAGE_FMT, (converter_func)data_file_to_message, (void**)&camera_n0, 0,NULL},
    {(char*)CAMERA_N1_IMAGE_NAME,(char*)CAMERA_N1_IMAGE_FMT, (converter_func)data_file_to_message, (void**)&camera_n1, 0,NULL},
    {(char*)CAMERA_N2_IMAGE_NAME,(char*)CAMERA_N2_IMAGE_FMT, (converter_func)data_file_to_message, (void**)&camera_n2, 0,NULL},
    {(char*)CAMERA_N3_IMAGE_NAME,(char*)CAMERA_N3_IMAGE_FMT, (converter_func)data_file_to_message, (void**)&camera_n3, 0,NULL},
    {(char*)IPM_HEARTBEAT_MESSAGE_NAME,(char*)IPM_HEARTBEAT_MESSAGE_FMT, (converter_func)auxiliar_ipm_shm_to_message, (void**)&ipm_heartbeat, 0,NULL},
    {(char*)CAMERA_N3_HEARTBEAT_NAME,(char*)CAMERA_N3_HEARTBEAT_FMT, (converter_func)auxiliar_firei_server_3_shm_to_message, (void**)&camera_n3_heartbeat, 0,NULL},
    {(char*)HOKUYO_UTM_HEARTBEAT_NAME,(char*)HOKUYO_UTM_SERVER_DATA_FMT, (converter_func)auxiliar_hokuyo_shm_to_message, (void**)&hokuyo_heartbeat, 0,NULL},
    {(char*)XSENS_DATA_MESSAGE_NAME,(char*)XSENS_DATA_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&xsens_message, 0,NULL},
    {(char*)XB3_3DPOINTCLOUD_MESSAGE_NAME,(char*)XB3_3DPOINTCLOUD_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&xb3_message, 0,NULL},
    {(char*)XB3_STEREOIMAGE_MESSAGE_NAME,(char*)XB3_STEREOIMAGE_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&xb3_image_message, 0,NULL},
    {(char*)GPS_GPGGA_DATA_MESSAGE_NAME,(char*)GPS_GPGGA_DATA_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&gpgga, 0,NULL},
    {(char*)GPS_GPRMC_DATA_MESSAGE_NAME,(char*)GPS_GPRMC_DATA_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&gprmc, 0,NULL},
    {(char*)HOKUYO_POINTCLOUD_MESSAGE_NAME,(char*)HOKUYO_POINTCLOUD_MESSAGE_FMT, (converter_func)data_file_to_message, (void**)&hokuyo_3d, 0,NULL}
}
int offset = 0
int paused = 1
double playback_speed = 1.0
double playback_starttime = 0.0
int rewind_frame = 0
Generated on Wed Jun 2 12:43:14 2010 for LAR Atlas by  doxygen 1.6.3