#include <iostream>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
#include <OPENR/ObjcommMessages.h>
#include <OPENR/OObserver.h>
#include <OPENR/OSubject.h>
#include <ModuleData.h>
#include <Platform.h>
#include <Primitives.h>
#include "main.h"
#include "helper.h"
#include "opensdkAPI.h"
Go to the source code of this file.
Defines | |
#define | NEW_SYSTEM_OBJ(func) |
#define | MOD_DATA(x) (PTS->x) |
#define | GET_DOUBLE(str) n = strtod(buf+sizeof(str)-1, NULL) |
#define | SET_VALUE(id, val) |
#define | FILL_INFO(idx, s, sprev) |
Functions | |
void * | VirtualRobotComm (void *PTS) |
void * | VirtualRobotComm_sensor (void *PTS) |
void * | VirtualRobotComm_image (void *PTS) |
void | sigalrm_handler (int) |
void * | process_sensor_readings (void *) |
void * | process_images (void *) |
void | processVectorData (OCommandInfo *info, OCommandData *data) |
void | init_virtual_robot_comm (void) |
slongword | VirtualRobotComm_get_sensor_reading (int id) |
void | send_server (char *str) |
Variables | |
OSubject * | subject |
long | frameNumber = 0 |
unsigned int | tick_number = 0 |
OSensorFrameVectorData * | SensorFrameData |
pthread_mutex_t | sensorFrameData_mutex = PTHREAD_MUTEX_INITIALIZER |
const unsigned int | numVectorData = num_of_primitives |
const size_t | SensorFrameData_size = sizeof(OSensorFrameVectorData) + (sizeof(OSensorFrameInfo) + sizeof(OSensorFrameData)) * numVectorData |
OSubject * | img_subject |
longword | img_frame_number = 0 |
|
Value: { \ OFbkImageInfo *info = data->GetInfo(idx); \ info->primitiveID = 18; \ info->type = odataFBK_YCrCb; \ info->dataSize = IMG_SIZE/((s)*(s)); \ info->width = IMG_WIDTH/(s); \ info->height = IMG_HEIGHT/(s); \ info->dataOffset = sizeof(ODataVectorInfo) + sizeof(OFbkImageInfo)*IMG_LAYERS + (sprev); \ } Definition at line 446 of file OVirtualRobotComm.cc. Referenced by process_images(). |
|
Definition at line 305 of file OVirtualRobotComm.cc. Referenced by process_sensor_readings(). |
|
Definition at line 80 of file OVirtualRobotComm.cc. Referenced by __wrap_strtok(), osyslog(), RegisterServiceEntry(), VirtualRobotComm(), VirtualRobotComm_image(), VirtualRobotComm_sensor(), and WhoAmI(). |
|
Value: id = ThreadsList.size(); \ data = new perThreadStruct(id); /* deleted in cleanup() */ \ \ if (pthread_create(&(data->threadId), NULL, func, data)) { \ cerr << "Couldn't create a new thread for the " << #func << " system object" << endl; \ exit(0x77); \ } \ ThreadsList.push_back(data); Definition at line 46 of file OVirtualRobotComm.cc. Referenced by init_virtual_robot_comm(). |
|
Value: { \
pthread_mutex_lock(&sensorFrameData_mutex); \
SensorFrameData->GetData(id)->frame[tick_number].value = (slongword)(val * 1000000.0); \
pthread_mutex_unlock(&sensorFrameData_mutex); \
}
Definition at line 306 of file OVirtualRobotComm.cc. Referenced by process_sensor_readings(). |
|
starts the threads to handle the requests to OVirtualRobotComm system objects Definition at line 58 of file OVirtualRobotComm.cc. References NEW_SYSTEM_OBJ, process_images(), process_sensor_readings(), VirtualRobotComm(), VirtualRobotComm_image(), and VirtualRobotComm_sensor(). Referenced by main(). |
|
read camera images and forward them to the observers Definition at line 458 of file OVirtualRobotComm.cc. References BLOCK_SIGNALS, FILL_INFO, socketList_t::fp_client, IMG_LAYERS, IMG_SIZE, img_subject, and socketList. Referenced by init_virtual_robot_comm(). |
|
connect to the sensor server and process its messages Definition at line 313 of file OVirtualRobotComm.cc. References BLOCK_SIGNALS, socketList_t::fp_client, GET_DOUBLE, SET_VALUE, and socketList. Referenced by init_virtual_robot_comm(). |
|
process joint/leds/.. instructions from user-land code and forward them to the simulator Definition at line 508 of file OVirtualRobotComm.cc. References send_server(). Referenced by VirtualRobotComm(). |
|
send a string to the server (e.g. a simulator) Definition at line 370 of file OVirtualRobotComm.cc. References socketList_t::fd_client, sock, and socketList. Referenced by processVectorData(). |
|
SIGALRM handler called in the OVirtualComm.sensor thread Definition at line 277 of file OVirtualRobotComm.cc. References frameNumber, SensorFrameData, sensorFrameData_mutex, SensorFrameData_size, subject, and tick_number. Referenced by VirtualRobotComm_sensor(). |
|
thread that handles the requests to move joints, change LEDs status, etc.. Definition at line 83 of file OVirtualRobotComm.cc. References __DoInitCompleted, BLOCK_SIGNALS, MOD_DATA, message::msg, opensdk_yield, perThreadKey, processVectorData(), RegisterServiceEntry(), and USECONDS_TICK. Referenced by init_virtual_robot_comm(). |
|
retrieve the latest sensor/joint reading Definition at line 186 of file OVirtualRobotComm.cc. References SensorFrameData, sensorFrameData_mutex, and slongword. Referenced by GetJointValue(), and GetSensorValue(). |
|
thread that sends camera images to registered observers Definition at line 388 of file OVirtualRobotComm.cc. References __DoInitCompleted, BLOCK_SIGNALS, message::entry, img_subject, MOD_DATA, message::msg, opensdk_yield, perThreadKey, and RegisterServiceEntry(). Referenced by init_virtual_robot_comm(). |
|
thread that sends the sensor readings to registered observers Definition at line 195 of file OVirtualRobotComm.cc. References __DoInitCompleted, BLOCK_SIGNALS_EXCEPT, message::entry, MOD_DATA, message::msg, numVectorData, opensdk_yield, perThreadKey, RegisterServiceEntry(), SensorFrameData, SensorFrameData_size, sigalrm_handler(), subject, and USECONDS_TICK. Referenced by init_virtual_robot_comm(). |
|
the number of the current sensor frame data Definition at line 178 of file OVirtualRobotComm.cc. Referenced by sigalrm_handler(). |
|
Definition at line 384 of file OVirtualRobotComm.cc. |
|
FbkImageSensor system object Definition at line 383 of file OVirtualRobotComm.cc. Referenced by process_images(), and VirtualRobotComm_image(). |
|
Definition at line 182 of file OVirtualRobotComm.cc. Referenced by VirtualRobotComm_sensor(). |
|
Definition at line 180 of file OVirtualRobotComm.cc. Referenced by sigalrm_handler(), VirtualRobotComm_get_sensor_reading(), and VirtualRobotComm_sensor(). |
|
Definition at line 181 of file OVirtualRobotComm.cc. Referenced by sigalrm_handler(), and VirtualRobotComm_get_sensor_reading(). |
|
Definition at line 183 of file OVirtualRobotComm.cc. Referenced by sigalrm_handler(), and VirtualRobotComm_sensor(). |
|
the subject pointer used by sensor data sender thread Definition at line 177 of file OVirtualRobotComm.cc. Referenced by parse_connect_cfg(), sigalrm_handler(), and VirtualRobotComm_sensor(). |
|
the tick frame number Definition at line 179 of file OVirtualRobotComm.cc. Referenced by sigalrm_handler(). |