Instrument control: TCP how to send command on one port and receive response on another port ?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everybody,
I have been a matlab user for 15 years, but a beginner when it comes to interfacing instruments. I would like to control a TOF camera (TOFcam-660) with the functions offered in the Instrument Control toolbox.
I have already tried many possibilities (pnet.m, client.m, ...) with no success.
I have two questions:
1) the TOFcam-660 camera uses different ports for transmission (50660) and reception (50661) (see figures attached). I couldn't find any example corresponding to this kind of situation. Is it enough to open the two ports as below:
ts = tcpclient('10.0.0.180',50660,"Timeout",10,"ConnectTimeout",15);
tr = tcpclient('10.0.0.180',50661,"Timeout",10,"ConnectTimeout",15);
The netstat command does show that both ports are open:
system('netstat -at | grep 5066');
tcp 0 0 tomothecho:52960 10.0.0.180:50660 ESTABLISHED
tcp 0 0 tomothecho:49836 10.0.0.180:50661 ESTABLISHED
2) my second question is about sending a command payload through port 50660 to ask the camera to send some information. Again, what to do seems more complex than what I find in the examples.
Typically, what to send is something like:
{start marker 4 bytes, payload size 4 bytes, payload, end marker 4 bytes}
With start marker = 0xFFFFAA55 and end marker = 0xFFFF55AA
The content of the payload depends on the type of response desired (typically a command number in uint16 followed by some parameters).
Despite many attempts, I was unable to send this type of information to the camera.
My hope was to use the writebinblock function, after generating a serialized sequence with getByteStreamFromArray:
c37BytePacket = getByteStreamFromArray({0xFFFFAA55,uint32(2),uint16(37),0xFFFF55AA});
writebinblock(ts,c37BytePacket,"uint8")
Does anyone have an idea on how to do this?
Thank you so much,
Dominique.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Instrument Control Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!