#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cstdarg>
#include <unistd.h>
#include <netdb.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <pthread.h>
#include <signal.h>
#include "config.h"
#include "images.h"
#include <Platform.h>
#include <Primitives.h>
#include <OPENR/ODataFormats.h>
Go to the source code of this file.
Defines | |
#define | USARSIM |
#define | CHECK_SYSCALL(val, msg) if ((val) < 0) { perror(msg); exit(4); } |
Enumerations | |
enum | team_type { NO_TEAM, TEAM_BLUE, TEAM_RED } |
Functions | |
const char * | team_str (void) |
bool | connect_to_usarsim (int *sock, int port=usarsim_port, bool read_init_msg=true) |
int | connect_to_opensdk_sensor (const char *MSdir, const char *socket_name) |
int | connect_to_opensdk_actuator (const char *MSdir) |
void | send_usarsim (int sock, const char *format,...) PRINTF_FORMAT |
void * | read_usarsim_messages (void *) |
void * | read_usarsim_images (void *MSdir) |
void | read_opensdk_messages (void) |
void | sigalrm_handler (int) |
int | main (int argc, char *argv[]) |
Variables | |
team_type | team = DEFAULT_USARSIM_ROBOT_TEAM |
const char * | usarsim_host = DEFAULT_USARSIM_HOST |
short | usarsim_port = DEFAULT_USARSIM_PORT |
short | usarsim_imgserver_port = DEFAULT_USARSIM_IMGSERVER_PORT |
const char * | usarsim_robot = DEFAULT_USARSIM_ROBOT |
const char * | usarsim_location = DEFAULT_USARSIM_LOCATION |
const char * | usarsim_ball_location = DEFAULT_USARSIM_BALL_LOCATION |
bool | display_fps = DEFAULT_DISPLAY_IMAGE_FPS |
int | usarsim_socket |
int | usarsim_ball_socket |
FILE * | usarsim_imgserver_socket |
int | actuators_socket |
FILE * | sensors_socket |
double | joint_values [num_of_primitives] = {INT_MIN} |
|
Definition at line 46 of file servers/usarsim/main.cc. |
|
Definition at line 42 of file servers/usarsim/main.cc. |
|
Definition at line 50 of file servers/usarsim/main.cc. |
|
createa Unix socket so that openSDK can connect to it (for actuators) Definition at line 168 of file servers/usarsim/main.cc. References ACTUATORS_SERVER_SOCKET, CHECK_SYSCALL, and sock. Referenced by main(). |
|
connect to a openSDK sensors Unix socket, located in the MS dir Definition at line 141 of file servers/usarsim/main.cc. References opensdk_yield. Referenced by main(), and read_usarsim_images(). |
|
connect to the usarsim server. returns true on success or false otherwise. Definition at line 88 of file servers/usarsim/main.cc. References memcpy(), sock, and usarsim_host. Referenced by main(), and read_usarsim_images(). |
|
|
receive messages from openSDK and process them (and forward them to USARSim in appropriate) Definition at line 402 of file servers/usarsim/main.cc. References actuators_socket, and joint_values. Referenced by main(). |
|
read images sent by the USARSim image server and feed them back to openSDK Definition at line 279 of file servers/usarsim/main.cc. References byte, connect_to_opensdk_sensor(), connect_to_usarsim(), IMAGE_SERVER_SOCKET, IMG_HEIGHT, IMG_SIZE, IMG_WIDTH, RGB_to_YCbCr(), shrink_frame(), usarsim_imgserver_port, and usarsim_imgserver_socket. Referenced by main(). |
|
receive messages from USARSim and process them (and forward them to openSDK if appropriate) Definition at line 215 of file servers/usarsim/main.cc. References sensors_socket, and usarsim_socket. Referenced by main(). |
|
send data to the USARSim server. If debugging is active it also prints the string sent Definition at line 193 of file servers/usarsim/main.cc. References sock. Referenced by main(), and sigalrm_handler(). |
|
Definition at line 425 of file servers/usarsim/main.cc. References joint_values, memcpy(), send_usarsim(), sensors_socket, and usarsim_socket. Referenced by main(). |
|
return a string corresponding to the chosen team Definition at line 75 of file servers/usarsim/main.cc. References NO_TEAM, TEAM_BLUE, and TEAM_RED. Referenced by main(). |
|
Definition at line 68 of file servers/usarsim/main.cc. Referenced by main(), and read_opensdk_messages(). |
|
Definition at line 63 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 71 of file servers/usarsim/main.cc. Referenced by read_opensdk_messages(), and sigalrm_handler(). |
|
Definition at line 69 of file servers/usarsim/main.cc. Referenced by main(), read_usarsim_messages(), and sigalrm_handler(). |
|
Definition at line 56 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 62 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 66 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 57 of file servers/usarsim/main.cc. Referenced by connect_to_usarsim(), and main(). |
|
Definition at line 59 of file servers/usarsim/main.cc. Referenced by read_usarsim_images(). |
|
Definition at line 67 of file servers/usarsim/main.cc. Referenced by read_usarsim_images(). |
|
Definition at line 61 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 58 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 60 of file servers/usarsim/main.cc. Referenced by main(). |
|
Definition at line 65 of file servers/usarsim/main.cc. Referenced by main(), read_usarsim_messages(), and sigalrm_handler(). |