carmen_radians_to_degrees
and carmen_degrees_to_radians
.carmen_normalize_theta
.asin
, acos
or atan
to recover angles distances. Always use atan2
(3). theta = atan2(y, x);
theta = atan(y/x);
hypot
(3) -- do not take the sum of squares and find the square root. hypot
(3) should be used for code clarity.carmen_point_t
carmen_traj_point_t
carmen_map_point_t
carmen_world_point_t
making sure that you use the right data structure to store the right kind of data.map_interface.h
and global.h
.global_graphics.h
.
carmen_{module-name}
. e.g., carmen_base_subscribe_odometry
.carmen_test_alloc
that facilitates memory checking. CVS will not allow code to be committed to core CARMEN that contains a call to malloc/calloc/realloc and does not have a call to carmen_test_alloc
on the subsequent line.
char
buffer[11] for a string of length 10. char
buffer[1024] for a string of length 10.
fd = open(filename, O_RDONLY); if (fd < 0) return -1;
if ((fd = open(filename, O_RDONLY)) < 0) return -1;
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) ... max_x = MAX(X++, Y++);
inline int max_int(int x, int y) { return (x > y ? x : y); }
-O
, these two code fragments are compiled identically under gcc, but the macro has unexpected side-effects.carmen_int_random
, carmen_uniform_random
or carmen_gaussian_random
. Consult the documentation for these functions to find out which random algorithm they use.carmen_randomize
. This function randomizes by reading a seed from /dev/random
.carmen_initialize_ipc
.
{module}_messages.h
-- this contains the IPC message definitions. {module}_interface.h
-- this contains the function prototypes for communicating with your module. {module}_interface.c
-- this contains the actual functions for communicating with your module. This file should be compiled into a library.
carmen_get_tenchar_host_name()
to generate the hostname.carmen_get_time_ms()
to generate the timestamp as a double.
Notice that none of the core robot functionality (base_services
, robot
, navigator
, localize
) link against graphics libraries. This is for multiple reasons: