Socket Server
The Socket Server module provides a generic interface for Socket based (network) clients. The Socket Server module allows you to receive and send data from any network accessible client. Note that this is a generic module in that you will need to adhere to the data protocol of the external client.More specialized communications (like HTTP) have their own modules but cannot be used in servers that are not known to RoboRealm or created as custom products. This module provides the underlying basic network server connection for remote clients but requires that you specify what and how data is transmitted and received.
Note that this module provides yet another way of integrating RoboRealm with external applications. For a more comprehensive overview please have a look at our Integration documentation.
Interface
Instructions
1. Settings - Specify the port number the server should listen on for connections.
2. Method - Specify what protocol you would like to use when sending information. Note that TCP/IP should work in most cases across the Internet as it is a standard protocol with built in error checking. UPD is quicker (has less overhead) than TCP but does NOT guarantee delivery of the information and should only be used on local networks as most routers will block UDP traffic.
3. Console - If a client connects to the server you will start to see a large amount of numbers scrolling by in the console. This
shows the current values being read from the client
and provides a log of the ongoing communication activities. The red text are characters received from
the client while the green text are characters sent by RoboRealm to the client.
To copy the log click on the Copy button, likewise to clear it click on the Clear button. Note that the
console log only shows several lines at a time with older information being discarded.
You can switch the output to various formats for better viewing:
4. Send Now - often you need to quickly test the client by sending a certain sequence of characters. To
do so just type in the character sequence (using
5. Refresh Rate - to slow the scrolling of the numbers select a different refresh rate for the console. This will just slow down
how quickly RoboRealm reads information from the server.
6. Initialization Sequence - The initialization data sequence sends the provided string to the client
on initialization of communication. You may want to use
this to command the receiving client into a specific mode ready for communication with RoboRealm. This initialization
sequence is sent each time the communication is reset. This happens when you click on the "Stop" button in
this interface or when the RoboRealm starts running for the
first time. It is NOT sent when the Run button in the main RoboRealm interface is toggled.
7. Send sequence - Used to enter commands sent per pipeline loop (i.e. image processed) by RoboRealm. You can
use this sequence to transmit variables created by other RoboRealm modules to the
client. Each time an image is captured and processed the Socket Server module will
interpret the Send Sequence text and send the result to the server.
See the Text Formats page for additional information about the text string format.
8. Enable - Allows you to temporarily disable sending text to the server while performing
edits. Note that the Send Sequence textarea will turn red to indicate this setting.
9. Send Rate - Some clients cannot handle rapid data streams. Use this
dropdown to select how quickly you want the data to be sent. At AFAP (As Fast As Possible) the data
will be sent out about 30 times a second (this assumes a camera running at 30 fps).
10. Send only on change - If your data does need to be sent out to your client every iteration
through the processing pipeline loop this selection will prevent the same data from being sent to the
client that was last sent. This is also an elegant way to reduce the data bandwidth to the
client if your sequence does not change rapidly.
11. Receive sequence - used to receive and parse text send from the client. The
text string is matched against the incoming bytes. When a match is found
variables are added into RoboRealm for use in other modules. Reading into variables just
requires adding in a variable at the appropriate spot within the receive string similar to the
scanf routine in C/C++. The Receive sequence works similar to an expect string, i.e. you need to
specify patterns that match the incoming text and substitute the areas that need to be
fed into variables with the [ variable_nane ] format. Note that even if you are missing
one space or newline the patter will not match and the variable will be zero or blank.
See the Text Formats page for additional information about the text string format.
1. Download the Sensor Data Streamer
for your iPhone/iPad and enter in your PC ip address and port 9090.
2. Launch RoboRealm, click on the Search tab, and enter in Socket Server. Double Click on Socket_Server
that will add this module to the pipeline.
3. Select UDP as the method
4. Enter in one line
5. This example shows how external applications can send data to RoboRealm. The Sensor Data Streamer will send
UDP packets of accelerometer, gyro, etc. information collected on the iPhone/iPad to the PC over the network.
This data stream is then interpreted by RoboRealm given the receive sequence. This shows how RoboRealm can be
configured to receive information from external applications that have their own data protocol.
Note, if you add a Watch module you can see the specific variables change when you move
your device.
As the Sensor Data Streamer app uses UDP you MAY not be able to receive packets from your iPhone as UDP packets
are often blocked in WIFI networks. Also note that UPD is NOT a guaranteed protocol and without a CRC (checksum)
there is no guarantee that the data from the iPhone is correct. Its very possible that only half the message be
received which may cause momentary corruption of the data. Care should be taken when using this technique
to steer or control large machinery!
Example
FS\w[ver]\f[acc_x]\f[acc_y]\f[acc_z]\f[gyro_x]\f[gyro_y]\f[gyro_z]\F[tes_x]\F
[tes_y]\F[tes_z]\F[mag_head]\F[true_head]\F[latitude]\F[longitude]\F[altitude]
into the Receive Sequence text box and press the START button to start the module.
See Also
Socket Client
Serial
USB HID
New Post
Socket_Server Related Forum Posts Last post Posts Views
Real time sending data to socket - 4ms
Welcome.
I have a question about real time sending data to server socket. I'm working on use Roborealm software to...9 year
2
1975
Socket Server
Hi Steven.
I tried to connect my PIC32 (Via Ethernet Controller) with RR using socket server. I managed to get the...9 year
15
3618
Sensor stream/ Compass into RR
EZ=Robot does a nice job of importing the sensor stream compass data which seems to be a very smooth and stable heading from the...9 year
5
3018