vrpn
07.33
Virtual Reality Peripheral Network
|
#include <vrpn_Analog_Radamec_SPI.h>
Public Member Functions | |
vrpn_Radamec_SPI (const char *name, vrpn_Connection *c, const char *port, int baud=38400) | |
~vrpn_Radamec_SPI () | |
virtual void | mainloop () |
Called once through each main loop iteration to handle updates. More... | |
![]() | |
vrpn_Serial_Analog (const char *name, vrpn_Connection *connection, const char *port, int baud=9600, int bits=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE, bool rts_flow=false) | |
~vrpn_Serial_Analog () | |
![]() | |
vrpn_Analog (const char *name, vrpn_Connection *c=NULL) | |
void | print (void) |
vrpn_int32 | getNumChannels (void) const |
![]() | |
vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL) | |
Names the device and assigns or opens connection, calls registration methods. More... | |
virtual | ~vrpn_BaseClass () |
![]() | |
vrpn_BaseClassUnique () | |
virtual | ~vrpn_BaseClassUnique () |
Unregister all of the message handlers that were to be autodeleted. More... | |
vrpn_Connection * | connectionPtr () |
Returns a pointer to the connection this object is using. More... | |
Protected Member Functions | |
virtual int | reset (void) |
virtual int | get_report (void) |
virtual void | clear_values (void) |
unsigned char | compute_crc (const unsigned char *head, int len) |
Compute the CRC for the message or report starting at head with length len. More... | |
vrpn_uint32 | convert_24bit_unsigned (const unsigned char *buf) |
Convert a 24-bit value from a buffer into an unsigned integer value. More... | |
vrpn_int32 | convert_16bit_unsigned (const unsigned char *buf) |
Convert a 16-bit unsigned value from a buffer into an integer. More... | |
double | int_to_pan (vrpn_uint32 val) |
----------------— Conversion of encoder indices to values -------------— Pan and tilt axis have an encoder index pulse which resets the value to 7FFFF hex each time the head passes through 0 degrees, the centre of range of the head. More... | |
double | int_to_tilt (vrpn_uint32 val) |
double | int_to_zoom (vrpn_uint32 val) |
double | int_to_focus (vrpn_uint32 val) |
double | int_to_height (vrpn_uint32 val) |
double | int_to_X (vrpn_uint32 mm, vrpn_uint32 frac) |
Convert from the millimeter and fraction-of-millimeter values returned by the device into meters. More... | |
double | int_to_Y (vrpn_uint32 mm, vrpn_uint32 frac) |
double | int_to_orientation (vrpn_uint32 val) |
Convert from the 1/100 degree increments into degrees. More... | |
int | send_command (const unsigned char *cmd, int len) |
Compute the CRC for the message, append it, and send message. Returns 0 on success, -1 on failure. More... | |
virtual void | report_changes (vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY) |
send report iff changed More... | |
virtual void | report (vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY) |
send report whether or not changed More... | |
![]() | |
int | read_available_characters (char *buffer, int bytes) |
![]() | |
virtual int | register_types (void) |
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail. More... | |
virtual vrpn_int32 | encode_to (char *buf) |
virtual void | report_changes (vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW) |
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the value with. More... | |
virtual void | report (vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW) |
Send a report whether something has changed or not (for servers) Optionally, tell what time to stamp the value with. More... | |
![]() | |
virtual int | init (void) |
Initialize things that the constructor can't. Returns 0 on success, -1 on failure. More... | |
virtual int | register_senders (void) |
Register the sender for this device (by default, the name of the device). Return 0 on success, -1 on fail. More... | |
![]() | |
int | register_autodeleted_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER) |
Registers a handler with the connection, and remembers to delete at destruction. More... | |
int | send_text_message (const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL, vrpn_uint32 level=0) |
Sends a NULL-terminated text message from the device d_sender_id. More... | |
SendTextMessageBoundCall | send_text_message (vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL) |
Returns an object you can stream into to send a text message from the device like send_text_message(vrpn_TEXT_WARNING) << "Value of i is: " << i; This use requires including vrpn_SendTextMessageStreamProxy.h. More... | |
void | server_mainloop (void) |
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should be called by all servers in their mainloop() More... | |
void | client_mainloop (void) |
Handles functions that all clients should provide in their mainloop() (warning of no server, for example) Should be called by all clients in their mainloop() More... | |
Protected Attributes | |
int | _status |
int | _camera_id |
int | _numchannels |
unsigned | _expected_chars |
unsigned char | _buffer [512] |
unsigned | _bufcount |
struct timeval | timestamp |
![]() | |
int | serial_fd |
char | portname [1024] |
int | baudrate |
unsigned char | buffer [1024] |
int | bufcounter |
![]() | |
vrpn_float64 | channel [vrpn_CHANNEL_MAX] |
vrpn_float64 | last [vrpn_CHANNEL_MAX] |
vrpn_int32 | num_channel |
struct timeval | timestamp |
vrpn_int32 | channel_m_id |
int | status |
![]() | |
vrpn_Connection * | d_connection |
Connection that this object talks to. More... | |
char * | d_servicename |
Name of this device, not including the connection part. More... | |
vrpn_int32 | d_sender_id |
Sender ID registered with the connection. More... | |
vrpn_int32 | d_text_message_id |
ID for text messages. More... | |
vrpn_int32 | d_ping_message_id |
Ask the server if they are there. More... | |
vrpn_int32 | d_pong_message_id |
Server telling that it is there. More... | |
Additional Inherited Members | |
![]() | |
bool | shutup |
vrpn_MESSAGEHANDLER | handler |
vrpn_int32 | sender |
vrpn_int32 | type |
void * | userdata |
![]() | |
static int | encode_text_message_to_buffer (char *buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char *msg) |
Encodes the body of the text message into a buffer, preparing for sending. More... | |
static int | decode_text_message_from_buffer (char *msg, vrpn_TEXT_SEVERITY *severity, vrpn_uint32 *level, const char *buf) |
Decodes the body of the text message from a buffer from the connection. More... | |
Definition at line 10 of file vrpn_Analog_Radamec_SPI.h.
vrpn_Radamec_SPI::vrpn_Radamec_SPI | ( | const char * | name, |
vrpn_Connection * | c, | ||
const char * | port, | ||
int | baud = 38400 |
||
) |
Definition at line 41 of file vrpn_Analog_Radamec_SPI.C.
References _numchannels, _status, clear_values(), vrpn_Analog::num_channel, and STATUS_RESETTING.
|
inline |
Definition at line 16 of file vrpn_Analog_Radamec_SPI.h.
|
protectedvirtual |
Definition at line 57 of file vrpn_Analog_Radamec_SPI.C.
References _numchannels, vrpn_Analog::channel, and vrpn_Analog::last.
Referenced by vrpn_Radamec_SPI().
|
protected |
Compute the CRC for the message or report starting at head with length len.
This routine will compute the CRC for the message that starts at head and is of length len.
This needs to be added to each message sent to the device, and should be checked for each command received by the device.
The manual states that the CRC is "calculated by subtracting the total sum of each byte of the block from 40H."
Definition at line 75 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report(), and send_command().
|
protected |
Convert a 16-bit unsigned value from a buffer into an integer.
Convert a 16-bit unsigned value from a buffer into an integer value.
The value has the most significant byte first in the buffer.
Definition at line 145 of file vrpn_Analog_Radamec_SPI.C.
References vrpn_unbuffer().
Referenced by get_report().
|
protected |
Convert a 24-bit value from a buffer into an unsigned integer value.
The value has the most significant byte first in the buffer.
Definition at line 123 of file vrpn_Analog_Radamec_SPI.C.
References vrpn_unbuffer().
Referenced by get_report().
|
protectedvirtual |
Definition at line 320 of file vrpn_Analog_Radamec_SPI.C.
References _bufcount, _buffer, _camera_id, _expected_chars, _numchannels, vrpn_Analog::channel, compute_crc(), convert_16bit_unsigned(), convert_24bit_unsigned(), int_to_focus(), int_to_height(), int_to_orientation(), int_to_pan(), int_to_tilt(), int_to_X(), int_to_zoom(), report(), vrpn_Serial_Analog::serial_fd, vrpn_Analog::status, STATUS_READING, STATUS_RESETTING, STATUS_SYNCING, timestamp, vrpn_gettimeofday, VRPN_MSG_ERROR, VRPN_MSG_WARNING, and vrpn_read_available_characters().
Referenced by mainloop().
|
protected |
Definition at line 191 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
protected |
Definition at line 197 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
protected |
Convert from the 1/100 degree increments into degrees.
Definition at line 213 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
protected |
----------------— Conversion of encoder indices to values -------------— Pan and tilt axis have an encoder index pulse which resets the value to 7FFFF hex each time the head passes through 0 degrees, the centre of range of the head.
This is indicated by two red dots on the pan axis, which when aligned show the head is at 0 degrees. Tilt 0 position is when the camera is horizontal. There are 900 encoder counts per degree and the direction corresponding to an increase in count depends on the mechanical orientation of the head and camera but is configurable using the configuration block anyway.
Zoom and focus return an encoder count corresponding to the barrel rotation of the lens. You will have to calibrate this to give a value for field of view for the virtual set. This is not an easy task as lens characteristics are non-linear. All virtual studio system suppliers have varying methods of doing lens calibration, including our own proprietary method used for Radamec Virtual Scenario.
Definition at line 180 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
inlineprotected |
Definition at line 47 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report().
|
protected |
Convert from the millimeter and fraction-of-millimeter values returned by the device into meters.
Definition at line 206 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
inlineprotected |
Definition at line 53 of file vrpn_Analog_Radamec_SPI.h.
|
protected |
Definition at line 185 of file vrpn_Analog_Radamec_SPI.C.
Referenced by get_report().
|
virtual |
Called once through each main loop iteration to handle updates.
This routine is called each time through the server's main loop.
It will take a course of action depending on the current status of the device, either trying to reset it or trying to get a reading from it. It will try to reset the device if no data has come from it for a couple of seconds
Implements vrpn_BaseClass.
Definition at line 518 of file vrpn_Analog_Radamec_SPI.C.
References get_report(), MAX_TIME_INTERVAL, reset(), vrpn_BaseClassUnique::server_mainloop(), vrpn_Analog::status, STATUS_READING, STATUS_RESETTING, STATUS_SYNCING, timestamp, vrpn_gettimeofday, VRPN_MSG_ERROR, and vrpn_TimevalDuration().
|
protectedvirtual |
send report whether or not changed
Definition at line 504 of file vrpn_Analog_Radamec_SPI.C.
References vrpn_Analog::report(), vrpn_Analog::timestamp, and timestamp.
Referenced by get_report().
|
protectedvirtual |
send report iff changed
Definition at line 497 of file vrpn_Analog_Radamec_SPI.C.
References vrpn_Analog::report_changes(), vrpn_Analog::timestamp, and timestamp.
|
protectedvirtual |
Definition at line 228 of file vrpn_Analog_Radamec_SPI.C.
References _camera_id, send_command(), vrpn_Serial_Analog::serial_fd, vrpn_Analog::status, STATUS_SYNCING, timestamp, vrpn_flush_input_buffer(), vrpn_gettimeofday, and VRPN_MSG_WARNING.
Referenced by mainloop().
|
protected |
Compute the CRC for the message, append it, and send message. Returns 0 on success, -1 on failure.
Compute the CRC for the command that is being sent, append that to the message, and send the message.
Returns 0 on success, -1 on failure.
Definition at line 96 of file vrpn_Analog_Radamec_SPI.C.
References compute_crc(), vrpn_Serial_Analog::serial_fd, and vrpn_write_characters().
Referenced by reset().
|
protected |
Definition at line 28 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report().
|
protected |
Definition at line 27 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report().
|
protected |
Definition at line 23 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report(), and reset().
|
protected |
Definition at line 26 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report().
|
protected |
Definition at line 24 of file vrpn_Analog_Radamec_SPI.h.
Referenced by clear_values(), get_report(), and vrpn_Radamec_SPI().
|
protected |
Definition at line 22 of file vrpn_Analog_Radamec_SPI.h.
Referenced by vrpn_Radamec_SPI().
|
protected |
Definition at line 28 of file vrpn_Analog_Radamec_SPI.h.
Referenced by get_report(), mainloop(), report(), report_changes(), and reset().