cajun Namespace Reference

Namespaces

namespace  gtk_utils

Classes

class  cb_time_t
class  conf_t
class  csv_parser_t
class  frequency_counter_t
class  grid_t
class  grid_base_t
class  grid_publisher_t
class  interp_table_t
class  proj_t
class  quaternion_t
class  rect_filler_t
class  route_t
class  spline_t

Typedefs

typedef std::string conf_entry_t
typedef std::vector
< std::vector< std::vector
< double > > > 
spline_curve_t
 Spline curve is stored in this structure.
typedef xmlDocPtr xml_doc_t
 A pointer to an XML document.
typedef xmlNodePtr xml_node_t
 A pointer to an XML node which may be contained within a document.
typedef xmlAttrPtr xml_node_attr_t
 A pointer to an XML node attribute.

Functions

std::string make_bot_config_filename (std::string const &name)
std::string make_config_filename (std::string const &name)
std::string make_bin_filename (std::string const &name)
std::string make_docs_filename (std::string const &name)
std::string make_support_filename (std::string const &name)
double gettstamp (void)
 Returns time in seconds.
double parse_human_time (char const *str)
std::string human_time_str (double tstamp)
double clipangle (double angle)
 clips given angle to value between 0 to 2 * M_PI
double angular_deviation (double ref_angle, double angle)
 Returns the angular difference between ref_ang and angle and maps the value to -M_PI to +M_PI.
bool get_file_tstamp (char const *fname, unsigned &tstamp_)
bool within_rect_region (double x1, double y1, double x2, double y2, double width, double x, double y)
 returns true if (x, y) is within lane segment (x1, y1)-> (x2, y2) within 'width' distance away
double atrack_distance (double x1, double y1, double x2, double y2, double x, double y)
 returns the atrack distance of point (x, y) to point (x2, y2) along the line (x1, y1) -> (x2, y2)
double xtrack_distance (double x1, double y1, double x2, double y2, double x, double y)
 returns the xtrack distance (perpendicular) of point (x, y) to line (x1, y1) -> (x2, y2)
bool inter_lane_seg (double x11_, double y11_, double x12_, double y12_, double x21_, double y21_, double x22_, double y22_)
bool are_same_points (double x1_, double y1_, double x2_, double y2_)
 Performs linear interpolation from (start_x, start_y) to (end_x, end_y) through inter_points_.
bool are_too_close_points (double x1_, double y1_, double x2_, double y2_, double dis_)
bool are_equal (double val1_, double val2_)
bool are_close (double val1_, double val2_, double max_diff_)
 Returns true if values val1_, and val2_ are off by atmost max_diff_.
double dist_to_track (double x_, double y_, double beg_x_, double beg_y_, double end_x_, double end_y_)
void multiply_4x4_4x4 (double a[4][4], double b[4][4], double results[4][4])
void multiply_4x4_4x1 (double a[4][4], double b[4], double results[4])
void compute_transformation_matrix (double roll, double heading, double pitch, double tx, double ty, double tz, double results[4][4])
void compute_global_velocity (double vel_x, double vel_y, double sog, double heading, double *velocity, double *velocity_angle)
double interpolate (double t, double t0, double v0, double t1, double v1)
double interpolate_angle (double t, double t0, double v0, double t1, double v1)
void tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delims)
 Tokenize an input string into substrings based on a set of delimiters.
bool xml_doc_is_valid (xml_doc_t doc)
 Test if an xml_doc_t is valid.
bool xml_node_is_valid (xml_node_t node)
 Test if an xml_node_t is valid.
bool xml_node_attr_is_valid (xml_node_attr_t node_attr)
 Test if an xml_node_attr_t is valid.
xml_doc_t xml_new_doc ()
 Create a new XML v1 document.
xml_doc_t xml_parse_doc (const char *filename)
 Load and parse the XML document specified by filename.
bool xml_save_doc (xml_doc_t doc, const char *filename)
 Save the XML document to the filename specified.
xml_node_t xml_new_node (const char *name)
 Create an new node not associated with any document.
void xml_remove_node (xml_node_t curr_node)
 Detach the current node from the document it is associated with.
void xml_remove_and_free_node (xml_node_t curr_node)
 Detach the current node from the document it is associated with and free the associated memory.
void xml_remove_node_by_name (xml_node_t start_node, const char *name)
 Perform a lookup from start_node of its children until name is reached, remove the first node found from the document it is associated with.
void xml_remove_and_free_node_name (xml_node_t start_node, const char *name)
 Perform a lookup from start_node of its children until name is reached, remove the first node found from the document it is associated with and free the associated memory.
xml_node_t xml_get_root_node (xml_doc_t doc)
 Get the root node of the specified document.
xml_node_t xml_set_root_node (xml_doc_t doc, xml_node_t root)
 Set the root node of the specified document.
bool xml_is_doc_type (xml_node_t root_node, const char *type)
 Determine if the root node of a document matches the given type.
xml_node_t xml_get_node_by_name (xml_node_t start_node, const char *name)
 Search for a child node by name.
const char * xml_node_get_contents_from_name (xml_node_t start_node, const char *name)
 Search for a child node by name and retrieve its contents.
void xml_node_set_contents_from_name (xml_node_t start_node, const char *name, const char *val)
 Search for a child node by name and set its contents.
const char * xml_node_get_contents (xml_node_t curr_node)
 Retrieve the contents of a node.
void xml_node_set_contents (xml_node_t curr_node, const char *val)
 Set the contents of a node.
bool xml_node_has_child (xml_node_t curr_node)
 Test if the given node has any children.
xml_node_t xml_node_get_child (xml_node_t curr_node)
 Retrieve the first child of the specified node.
bool xml_node_has_next (xml_node_t curr_node)
 Test if the given node has a next (sibling) node.
xml_node_t xml_node_get_next (xml_node_t curr_node)
 Retrieve the next (sibling) node.
bool xml_node_matches (xml_node_t curr_node, const char *name)
 Test if the current node matches the given name.
const char * xml_node_name (xml_node_t curr_node)
 Retrieve the name of the current node.
xml_node_t xml_node_add_child (xml_node_t curr_node, const char *name)
 Add a new child node to the current node without contents.
xml_node_t xml_node_add_child (xml_node_t curr_node, const char *name, const char *content)
 Add a new child node to the current node with contents.
xml_node_attr_t xml_node_add_prop (xml_node_t curr_node, const char *prop_name, const char *prop_val)
 Add a new property to the current node.
const char * xml_node_get_prop (xml_node_t curr_node, const char *prop_name)
 Retrieve the named property from the current node.
const char * xml_node_get_prop_from_name (xml_node_t start_node, const char *node_name, const char *prop_name)
 Retrieve the named property from a named child of start_node.
xml_node_attr_t xml_node_set_prop (xml_node_t curr_node, const char *prop_name, const char *prop_val)
 Set the named property at the current node.
bool xml_node_has_prop (xml_node_t curr_node, const char *prop_name)
 Test if the given node has the named property.

Typedef Documentation

typedef std::string cajun::conf_entry_t
typedef std::vector< std::vector< std::vector <double> > > cajun::spline_curve_t

Spline curve is stored in this structure.

typedef xmlDocPtr cajun::xml_doc_t

A pointer to an XML document.

typedef xmlAttrPtr cajun::xml_node_attr_t

A pointer to an XML node attribute.

typedef xmlNodePtr cajun::xml_node_t

A pointer to an XML node which may be contained within a document.


Function Documentation

double cajun::angular_deviation ( double  ref_angle,
double  angle 
)

Returns the angular difference between ref_ang and angle and maps the value to -M_PI to +M_PI.

Referenced by atrack_distance(), interpolate_angle(), within_rect_region(), and xtrack_distance().

bool cajun::are_close ( double  val1_,
double  val2_,
double  max_diff_ 
)

Returns true if values val1_, and val2_ are off by atmost max_diff_.

bool cajun::are_equal ( double  val1_,
double  val2_ 
)

References CLOSE_TO_ZERO.

bool cajun::are_same_points ( double  x1_,
double  y1_,
double  x2_,
double  y2_ 
)

Performs linear interpolation from (start_x, start_y) to (end_x, end_y) through inter_points_.

References CLOSE_TO_ZERO.

bool cajun::are_too_close_points ( double  x1_,
double  y1_,
double  x2_,
double  y2_,
double  dis_ 
)
double cajun::atrack_distance ( double  x1,
double  y1,
double  x2,
double  y2,
double  x,
double  y 
)

returns the atrack distance of point (x, y) to point (x2, y2) along the line (x1, y1) -> (x2, y2)

References angular_deviation().

double cajun::clipangle ( double  angle  ) 

clips given angle to value between 0 to 2 * M_PI

void cajun::compute_global_velocity ( double  vel_x,
double  vel_y,
double  sog,
double  heading,
double *  velocity,
double *  velocity_angle 
)
void cajun::compute_transformation_matrix ( double  roll,
double  heading,
double  pitch,
double  tx,
double  ty,
double  tz,
double  results[4][4] 
)

References multiply_4x4_4x4().

double cajun::dist_to_track ( double  x_,
double  y_,
double  beg_x_,
double  beg_y_,
double  end_x_,
double  end_y_ 
)

References dx, and dy.

bool cajun::get_file_tstamp ( char const *  fname,
unsigned &  tstamp_ 
)
double cajun::gettstamp ( void   ) 

Returns time in seconds.

Returns:
Returns time in seconds

Referenced by cajun::cb_time_t::curr_time(), and cajun::frequency_counter_t::visit().

string cajun::human_time_str ( double  tstamp  ) 
bool cajun::inter_lane_seg ( double  x11_,
double  y11_,
double  x12_,
double  y12_,
double  x21_,
double  y21_,
double  x22_,
double  y22_ 
)

References xtrack_distance().

double cajun::interpolate ( double  t,
double  t0,
double  v0,
double  t1,
double  v1 
)
double cajun::interpolate_angle ( double  t,
double  t0,
double  v0,
double  t1,
double  v1 
)

References angular_deviation().

std::string cajun::make_bin_filename ( std::string const &  name  ) 
std::string cajun::make_bot_config_filename ( std::string const &  name  ) 

Referenced by main().

std::string cajun::make_config_filename ( std::string const &  name  ) 
std::string cajun::make_docs_filename ( std::string const &  name  ) 
std::string cajun::make_support_filename ( std::string const &  name  ) 
void cajun::multiply_4x4_4x1 ( double  a[4][4],
double  b[4],
double  results[4] 
)
void cajun::multiply_4x4_4x4 ( double  a[4][4],
double  b[4][4],
double  results[4][4] 
)
double cajun::parse_human_time ( char const *  str  ) 
void cajun::tokenize ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delims 
)

Tokenize an input string into substrings based on a set of delimiters.

Parameters:
[in] str Input string to tokenize.
[out] tokens Vector to store tokens.
[in] delims String of delimiters used for splitting.
bool cajun::within_rect_region ( double  x1,
double  y1,
double  x2,
double  y2,
double  width,
double  x,
double  y 
)

returns true if (x, y) is within lane segment (x1, y1)-> (x2, y2) within 'width' distance away

References angular_deviation().

bool cajun::xml_doc_is_valid ( cajun::xml_doc_t  doc  ) 

Test if an xml_doc_t is valid.

Parameters:
doc The doc to test.
Returns:
True if doc != NULL.
cajun::xml_node_t cajun::xml_get_node_by_name ( cajun::xml_node_t  start_node,
const char *  name 
)

Search for a child node by name.

Parameters:
start_node The parent node to start at the search.
name The desired name of the node to search for.
Returns:
The node with the specified name or null if it is not found.

Referenced by xml_node_get_contents_from_name(), xml_node_get_prop_from_name(), xml_node_set_contents_from_name(), xml_remove_and_free_node_name(), and xml_remove_node_by_name().

cajun::xml_node_t cajun::xml_get_root_node ( cajun::xml_doc_t  doc  ) 

Get the root node of the specified document.

Parameters:
doc The document from which the root node is desired.
Returns:
The xml_node_t representing the root of the document or NULL.
bool cajun::xml_is_doc_type ( cajun::xml_node_t  root_node,
const char *  type 
)

Determine if the root node of a document matches the given type.

Parameters:
root_node The root node of a document.
type The document type to compare against.
Returns:
True if the root_node is not null and the node type matches the specified type.
cajun::xml_doc_t cajun::xml_new_doc (  ) 

Create a new XML v1 document.

Returns:
The xml_doc_t associated with the new doc.
cajun::xml_node_t cajun::xml_new_node ( const char *  name  ) 

Create an new node not associated with any document.

Parameters:
name The name of the node.
Returns:
The new named node in the default namespace.
cajun::xml_node_t cajun::xml_node_add_child ( cajun::xml_node_t  curr_node,
const char *  name,
const char *  content 
)

Add a new child node to the current node with contents.

Parameters:
curr_node The node for which a child will be added. An assertion failure will be raised if curr_node is null.
name The name of the new child node.
content The contents to set for the new child node.
Returns:
The new node that has been added as a child of the current node.
cajun::xml_node_t cajun::xml_node_add_child ( cajun::xml_node_t  curr_node,
const char *  name 
)

Add a new child node to the current node without contents.

Parameters:
curr_node The node for which a child will be added. An assertion failure will be raised if curr_node is null.
name The name of the new child node.
Returns:
The new node that has been added as a child of the current node.
cajun::xml_node_attr_t cajun::xml_node_add_prop ( cajun::xml_node_t  curr_node,
const char *  prop_name,
const char *  prop_val 
)

Add a new property to the current node.

Parameters:
curr_node The node for which a new property will be added. An assertion failure will be raised if curr_node is null.
prop_name The name of the new property.
prop_val The value of the new property.
Returns:
The new node attribute (property) that has been added to the current node.
bool cajun::xml_node_attr_is_valid ( cajun::xml_node_attr_t  node_attr  ) 

Test if an xml_node_attr_t is valid.

Parameters:
node_attr The node attribute to test.
Returns:
True if node_attr != NULL.
cajun::xml_node_t cajun::xml_node_get_child ( cajun::xml_node_t  curr_node  ) 

Retrieve the first child of the specified node.

Parameters:
curr_node The node parent node of which the child should be retrieved. An assertion failure will be raised if curr_node is null.
Returns:
The first child node if the given node has at least one child, or null.
const char * cajun::xml_node_get_contents ( cajun::xml_node_t  curr_node  ) 

Retrieve the contents of a node.

Parameters:
curr_node The node to retrieve the contents from. An assertion failure will be raised if curr_node is null.
Returns:
The contents of the node if it is not null, or null.
const char * cajun::xml_node_get_contents_from_name ( cajun::xml_node_t  start_node,
const char *  name 
)

Search for a child node by name and retrieve its contents.

Parameters:
start_node The parent node to start at the search.
name The desired name of the node to search for.
Returns:
The contents of the node with the specified name or null if it is not found.

References xml_get_node_by_name().

cajun::xml_node_t cajun::xml_node_get_next ( cajun::xml_node_t  curr_node  ) 

Retrieve the next (sibling) node.

Parameters:
curr_node The node from which to retrieve the next sibling node. An assertion failure will be raised if curr_node is null.
Returns:
The next sibling node if it exists or null.
const char * cajun::xml_node_get_prop ( cajun::xml_node_t  curr_node,
const char *  prop_name 
)

Retrieve the named property from the current node.

Parameters:
curr_node The node for which the named property will be retrieved. An assertion failure will be raised if curr_node is null.
prop_name The name of the property.
Returns:
The string representing the attribute (property) from the current node if it exists, or null.

Referenced by xml_node_get_prop_from_name().

const char * cajun::xml_node_get_prop_from_name ( xml_node_t  start_node,
const char *  node_name,
const char *  prop_name 
)

Retrieve the named property from a named child of start_node.

Parameters:
start_node The parent node to start at in the search.
node_name The desired name of the node to search for.
prop_name The name of the property to retrieve.
Returns:
The string representing the attribute (property) from the node if the property exists and the node was found, or null if the property didn't exist but the node was found. An assertion failure will be raised if the node couldn't be found, so be careful with this method.

References xml_get_node_by_name(), and xml_node_get_prop().

bool cajun::xml_node_has_child ( cajun::xml_node_t  curr_node  ) 

Test if the given node has any children.

Parameters:
curr_node The node to test. An assertion failure will be raised if curr_node is null.
Returns:
True if the given node has at least one child.
bool cajun::xml_node_has_next ( cajun::xml_node_t  curr_node  ) 

Test if the given node has a next (sibling) node.

Parameters:
curr_node The node from which to test for a next. An assertion failure will be raised if curr_node is null.
Returns:
True if the next sibling node exists.
bool cajun::xml_node_has_prop ( cajun::xml_node_t  curr_node,
const char *  prop_name 
)

Test if the given node has the named property.

Parameters:
curr_node The node to test for the named property. An assertion failure will be raised if curr_node is null.
prop_name The name of the property to test for.
Returns:
True if the given node has the named property.
bool cajun::xml_node_is_valid ( cajun::xml_node_t  node  ) 

Test if an xml_node_t is valid.

Parameters:
node The node to test.
Returns:
True if node != NULL.
bool cajun::xml_node_matches ( cajun::xml_node_t  curr_node,
const char *  name 
)

Test if the current node matches the given name.

Parameters:
curr_node The node to test. An assertion failure will be raised if curr_node is null.
name The supposed name of the current node.
Returns:
True if the name of the current node matches the given name.
const char * cajun::xml_node_name ( cajun::xml_node_t  curr_node  ) 

Retrieve the name of the current node.

Parameters:
curr_node The node from which the name is desired. An assertion failure will be raised if curr_node is null.
Returns:
The name of the node.
void cajun::xml_node_set_contents ( cajun::xml_node_t  curr_node,
const char *  val 
)

Set the contents of a node.

Parameters:
curr_node The node to set the contents of. An assertion failure will be raised if curr_node is null.
val The contents to set for the node.
void cajun::xml_node_set_contents_from_name ( cajun::xml_node_t  start_node,
const char *  name,
const char *  val 
)

Search for a child node by name and set its contents.

Parameters:
start_node The parent node to start at the search. An assertion failure will be raised if start_node is null.
name The desired name of the node to search for. An assertion failure will be raised if the named node cannot be found.
val The contents to set for the node.

References xml_get_node_by_name().

cajun::xml_node_attr_t cajun::xml_node_set_prop ( cajun::xml_node_t  curr_node,
const char *  prop_name,
const char *  prop_val 
)

Set the named property at the current node.

Parameters:
curr_node The node for which the named property will be set. An assertion failure will be raised if curr_node is null.
prop_name The name of the property.
prop_val The value to set for the property.
Returns:
The node attribute (property) that has been set on the current node.
cajun::xml_doc_t cajun::xml_parse_doc ( const char *  filename  ) 

Load and parse the XML document specified by filename.

Parameters:
filename The XML document to load.
Returns:
The xml_doc_t associated with the file loaded or NULL.
void cajun::xml_remove_and_free_node ( cajun::xml_node_t  curr_node  ) 

Detach the current node from the document it is associated with and free the associated memory.

Parameters:
curr_node The desired node to detach and free.

Referenced by xml_remove_and_free_node_name().

void cajun::xml_remove_and_free_node_name ( cajun::xml_node_t  start_node,
const char *  name 
)

Perform a lookup from start_node of its children until name is reached, remove the first node found from the document it is associated with and free the associated memory.

Parameters:
start_node The parent node to start at in the search.
name The desired name of the child node to search for, detach and free.

References xml_get_node_by_name(), and xml_remove_and_free_node().

void cajun::xml_remove_node ( cajun::xml_node_t  curr_node  ) 

Detach the current node from the document it is associated with.

Parameters:
curr_node The desired node to detach.

Referenced by xml_remove_node_by_name().

void cajun::xml_remove_node_by_name ( cajun::xml_node_t  start_node,
const char *  name 
)

Perform a lookup from start_node of its children until name is reached, remove the first node found from the document it is associated with.

Parameters:
start_node The parent node to start at in the search.
name The desired name of the child node to search for and detach.

References xml_get_node_by_name(), and xml_remove_node().

bool cajun::xml_save_doc ( cajun::xml_doc_t  doc,
const char *  filename 
)

Save the XML document to the filename specified.

Parameters:
doc The xml_doc_t associated with the document.
filename The file to save the XML data to.
Returns:
True if doc != NULL and the number of bytes written is greater than -1.
cajun::xml_node_t cajun::xml_set_root_node ( cajun::xml_doc_t  doc,
cajun::xml_node_t  root 
)

Set the root node of the specified document.

Parameters:
doc The document for which the root node will be set.
root The node that will used as the root.
Returns:
The xml_node_t representing the root of the document.
double cajun::xtrack_distance ( double  x1,
double  y1,
double  x2,
double  y2,
double  x,
double  y 
)

returns the xtrack distance (perpendicular) of point (x, y) to line (x1, y1) -> (x2, y2)

References angular_deviation().

Referenced by inter_lane_seg().


Generated on Fri Apr 9 10:45:11 2010 for cbutils by  doxygen 1.6.1