ROBO Pro + Arduino ?

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

ROBO Pro + Arduino ?

Beitrag von ft-ninja » 23 Dez 2012, 19:18

Hello Folks!

Is it possible to control Arduino UNO board from the ROBO Pro programm in Online mode?

Bild

Any ideas?

UPD 26.12.2012
Now I have logged traffic data between RP and TX-C - link.

UPD 28.12.2012
Now we know all command codes that used in simple session. Also we have identified structures for INPUT and OUTPUT update packets. First sketch for FishX1 parser in pseudo-code is ready.
link.

UPD 31.12.2012
At this moment the first release of fx1parser is working. Youtube demo-clip recorded.
link

UPD 04.01.2013
Finally we have fx1-arduino-parser ready for testing for everyone. Enjoy!
link

UPD 20.05.2015
Project fx1-arduino-parser moved to GitHub due to Google Code closure.
link

UPD 03.09.2015
fx1-arduino-parser v0.2 released on GitHub.
link

UPD 12.08.2016
fx1-arduino-parser v0.3 released on GitHub.
link

UPD 19.02.2021
Tested with ROBO Pro 4.6.6. Download here https://github.com/mr-kubikus/fx1-arduino-parser
Zuletzt geändert von ft-ninja am 09 Aug 2021, 17:49, insgesamt 16-mal geändert.
==
ft-ninja

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von vleeuwen » 23 Dez 2012, 19:33

Yes:
*) in case you implement the functionality as describt in the FtMscLib library and the FtMscLib can connected itself to the Anduino.
*) or you to implement the RS485 bus protocol in away that your Anduino will behaive itself as an TX-C slave device.
*) or use the Andruine as a I2C slave. ( In the online mode the I2C communication is rather slow.)
Zuletzt geändert von vleeuwen am 23 Dez 2012, 19:40, insgesamt 2-mal geändert.

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von ft-ninja » 23 Dez 2012, 19:39

1) Requires detailed dscription for protocol between ROBO Pro and TX-C. Do you know any related information sources?
2) For this soluition I need TX-C between ROBO Pro and Arduino. Its not good because my main idea is to control Arduino directly from RP.
3) Same situation as point 2.
==
ft-ninja

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von vleeuwen » 23 Dez 2012, 21:32

About 1)
The api has been describt in the documentation.
But you will need to hack the USB or BT communication, which has not been dodcumented

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von ft-ninja » 23 Dez 2012, 23:16

Hello Rei Vilo,
Thank you for recomendation. But my objective is to control Arduino board directly from RP.

As I found - it's posible to select any com port that is avaible in the OS in the ROBO Pro's USB-COM menu. Arduino, when it connected to PC, also appears as virtual COM port. So we can cheat RP and gethim to send data to Arduino directly. We only need to write parser for FishX1 protocol for Arduino side.

May be you could help me to find any info about FishX1 protocol?
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von ft-ninja » 24 Dez 2012, 10:00

Hello Rei,

Thanks for links provided.
using the RoboPro environment to develop for an Arduino board is extremely difficult, if not impossible
I do not think so and I will try to reverse engineer communications protocol between RP and TX-C in ONLINE mode. The official data package "PC Programming ROBO TX Controller Version 1.5 PC_Programming_RoboTXC" will helps in this task. In the contents of that package I've found PDF file PC_Programming_RoboTXC_en_V1-5.pdf with section describing a parts of FishX1 protocol - 13.1 Fish.X1 interface protocol.

Following header files from data package PC_Programming_RoboTXC also will help us:
common.h
ftErrCode.h
ROBO_TX_FW.h
ftMscLib.h

Ahead we have a long holidays and lot of time to experiment with RP and Arduino.
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von ft-ninja » 24 Dez 2012, 10:53

I looked at the documentation and It seems that PC_Programming_RoboTXC doc doesn't contain all info about FishX1. I can't find values for Fish.X1 command code that is located at the PACKET[16] offset.

Description for this field from documentation:
Fish.X1 command code (tele-code), 4 bytes (L,H)
Defines a unique request or reply code. The command code thus describes the
supplied data structure in the payload.
Now I'm searching for a tool or method to grab all traffic between RP and TX-C in ONLINE mode. After I will have the traffic log then I will be able to analyze it and find respective values for Fish.X1 command code (tele-code) field in the data packet.
Zuletzt geändert von ft-ninja am 24 Dez 2012, 15:32, insgesamt 1-mal geändert.
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino

Beitrag von ft-ninja » 24 Dez 2012, 14:44

Illustration for my previous post:

Bild

Here you can see the point where I want to grab and log the traffic between RP and TX-C. May be you know any free-ware tools that allows to connect to existing com-port and sniff traffic?
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 24 Dez 2012, 20:40

Good news!

I've found freeware tool to capture binary data from COM-port - RealTerm:
Realterm is a terminal program specially designed for capturing, controlling and debugging binary and other difficult data streams
Bild
It allows me to connect to the TX-C and send commands in the shell mode. It also has nice feature to save all data from terminal screen to text file. But I can't connect to the same COM-port when RP works in ONLINE mode. When I tryed to do that following message box was appeared:

Bild
Damn!

I continue to look for a way to grab the data from active serial connection between RP and TX-C.
Zuletzt geändert von ft-ninja am 10 Aug 2021, 11:14, insgesamt 1-mal geändert.
==
ft-ninja

thkais
Beiträge: 381
Registriert: 31 Okt 2010, 21:45

Re: ROBO Pro + Arduino ?

Beitrag von thkais » 25 Dez 2012, 08:18

Hi ft-ninja,

have a look at "VSPE" - with this tool you may generate a "copy" of a serial port.
The search term "serial port monitor" should also help...
Gruß
Thomas

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 25 Dez 2012, 11:59

Hello Thomas,

Thanks for the link to VSPE. It's a goot tool to create a "copy" of serial port, but for 64bit Win 7 it costs $24.95 :(.

Good news!

I have found (thanks to Ad2) another freeware tool - com0com. Which allows me to create a virtual COM port pair and use them to connect RP to Realterm and then to TX-C. With com0com I've success with grabbing the data traffic. I've used following structure:

Bild

Now I need a time to analyze logged data. Stay tuned!
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 25 Dez 2012, 20:58

After playing several hours with com0com and Realterm I came to solution that allows me to log a data stream between RP and TX-C. For this purpose I created a dummy RP program that has only several blocks:
Bild

At the first step I configured the com0com to emulate 2 virtual COM-ports, connected together through virtual null-modem cable. It was COM10 and COM11 (please see the picture from previous post). The RP was connected to COM10. Then I started the Realterm and opened COM11 for listening.
In the ECHO PORT tab I configured the Echo function to forward all traffic from the RP to COM1, which is a virtual TX-C COM-port. This functiona also forwards a traffic from COM1 to COM11 in reverse direction. Then I started Capture function and pressed the Start button in RP. After the RP program was finished I got the binary log file. When converted to ascii hex format it looks like:

Code: Alles auswählen

02 55 00 14 02 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 FF E7 03 02 55 00 14 02 
00 00 00 02 00 00 00 01 00 01 00 65 00 00 00 00 00 00 00 FF 81 03 02 55 00 58 02 00 00 00 02 00 
00 00 02 00 01 00 6A 00 00 00 01 00 00 00 00 00 00 00 52 4F 42 4F 20 54 58 2D 33 37 37 00 00 00 
00 00 00 30 30 3A 31 33 3A 37 42 3A 35 34 3A 37 45 3A 31 39 00 00 04 02 00 20 00 00 70 30 00 00 
0D 00 43 00 00 00 00 01 01 1E 01 01 01 08 01 01 01 04 F7 74 03 02 55 00 18 02 00 00 00 01 00 00 
00 03 00 01 00 07 00 00 00 01 00 00 00 00 00 00 00 FF D9 03 02 55 00 30 02 00 00 00 02 00 00 00 
03 00 01 00 6B 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 FF 5C 03 0D 67 65 74 5F 73 65 72 5F 6E 75 6D 0D 0D 0A 52 4F 42 4F 20 54 
58 2D 33 37 37 2F 55 53 42 3E 67 65 74 5F 73 65 72 5F 6E 75 6D 0D 0A 30 30 30 32 31 33 31 30 34 
38 0D 0A 52 4F 42 4F 20 54 58 2D 33 37 37 2F 55 53 42 3E 02 55 00 48 02 00 00 00 01 00 00 00 01 
00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 00 01 01 01 81 81 81 81 81 81 81 81 01 01 01 01 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FB 
9F 03 02 55 00 18 02 00 00 00 02 00 00 00 01 00 02 00 69 00 00 00 01 00 00 00 00 00 00 00 FF 77 
03 02 55 00 44 02 00 00 00 01 00 00 00 02 00 02 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 FF B2 03 02 55 00 48 02 00 00 00 02 00 00 00 02 00 02 00 66 00 00 00 
01 00 00 00 00 00 00 00 00 00 00 00 59 00 6D 00 C9 0B C9 0B 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FC DB 03 02 55 00 44 02 
00 00 00 01 00 00 00 03 00 02 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 FF B1 03 02 55 00 48 02 00 00 00 02 00 00 00 03 00 02 00 66 00 00 00 01 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 48 03 02 55 00 44 02 00 00 00 01 00 00 
00 04 00 02 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF B0 03 
02 55 00 48 02 00 00 00 02 00 00 00 04 00 02 00 66 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 FF 47 03 02 55 00 44 02 00 00 00 01 00 00 00 05 00 02 00 02 
00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF AF 03 02 55 00 48 02 00 
00 00 02 00 00 00 05 00 02 00 66 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 FF 46 03 02 55 00 44 02 00 00 00 01 00 00 00 06 00 02 00 02 00 00 00 01 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF AE 03 02 55 00 48 02 00 00 00 02 00 00 00 
06 00 02 00 66 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
FF 45 03 

Here I cut the rest of file.
At the next step I used information from PC_Programming_RoboTXC.PDF to manually extract FishX1 packets fram raw data. As we know - every packet starts with 0x0255 signature and ends with 0x03 byte. After I finished this task I got following result:

Code: Alles auswählen

02 55 00 14 02 00 00 00 01 00 00 00 01 00 00 00 
01 00 00 00 00 00 00 00 FF E7 03

02 55 00 14 02 00 00 00 02 00 00 00 01 00 01 00 
65 00 00 00 00 00 00 00 FF 81 03

02 55 00 58 02 00 00 00 02 00 00 00 02 00 01 00
6A 00 00 00 01 00 00 00 00 00 00 00 52 4F 42 4F
20 54 58 2D 33 37 37 00 00 00 00 00 00 30 30 3A
31 33 3A 37 42 3A 35 34 3A 37 45 3A 31 39 00 00
04 02 00 20 00 00 70 30 00 00 0D 00 43 00 00 00
00 01 01 1E 01 01 01 08 01 01 01 04 F7 74 03

02 55 00 18 02 00 00 00 01 00 00 00 03 00 01 00
07 00 00 00 01 00 00 00 00 00 00 00 FF D9 03

02 55 00 30 02 00 00 00 02 00 00 00 03 00 01 00
6B 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 FF 5C 03

0D 67 65 74 5F 
73 65 72 5F 6E 75 6D 0D 0D 0A 52 4F 42 4F 20 54
58 2D 33 37 37 2F 55 53 42 3E 67 65 74 5F 73 65
72 5F 6E 75 6D 0D 0A 30 30 30 32 31 33 31 30 34 
38 0D 0A 52 4F 42 4F 20 54 58 2D 33 37 37 2F 55
53 42 3E 

02 55 00 48 02 00 00 00 01 00 00 00 01 00 00 00
05 00 00 00 01 00 00 00 00 00 00 00 00 01 01 01
81 81 81 81 81 81 81 81 01 01 01 01 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 FB 9F 03

02 55 00 18 02 00 00 00 02 00 00 00 01 00 02 00
69 00 00 00 01 00 00 00 00 00 00 00 FF 77 03 

02 55 00 44 02 00 00 00 01 00 00 00 02 00 02 00
02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 FF B2 03 

02 55 00 48 02 00 00 00 02 00 00 00 02 00 02 00
66 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 
59 00 6D 00 C9 0B C9 0B 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 FC DB 03 

02 55 00 44 02 00 00 00 01 00 00 00 03 00 02 00
02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 FF B1 03 

02 55 00 48 02 00 00 00 02 00 00 00 03 00 02 00
66 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 FF 48 03 

02 55 00 44 02 00 00 00 01 00 00 00 04 00 02 00
02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 FF B0 03

Here I cut the rest of file.
Now I going to split every packet on header and payload. Payload is more interesting for us because it's poorly documented in PC_Programming_RoboTXC.PDF.
Zuletzt geändert von ft-ninja am 26 Dez 2012, 07:50, insgesamt 2-mal geändert.
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 26 Dez 2012, 19:21

Hello Rei,
Thank you for the link provided. Going to be more open - it’s a right way to keep your community growing.

Let’s look what I have for current moment.

I’ve analyzed captured packets and extracted command codes and payload size from each packet:

Code: Alles auswählen

************************************************************************
 FishX1 packets
 
 STX, Header, CRC and ETX was removed.

 Designations:
 
 Request from RP to TX-C - REQ
 Reply from TX-C to RP   - RPL
 Fish.X1 command code    - CMD
 Payload size (bytes)    - PL
************************************************************************     

REQ, CMD=0x01, PL=0

RPL, CMD=0x65, PL=0

RPL, CMD=0x6A, PL=64
52 4F 42 4F 20 54 58 2D 33 37 37 00 00 00 00 00
00 30 30 3A 31 33 3A 37 42 3A 35 34 3A 37 45 3A
31 39 00 00 04 02 00 20 00 00 70 30 00 00 0D 00
43 00 00 00 00 01 01 1E 01 01 01 08 01 01 01 04

REQ, CMD=0x07, PL=0

RPL, CMD=0x6B, PL=24
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00

REQ, CMD=?
0D 67 65 74 5F 73 65 72 5F 6E 75 6D 0D

RPL, CMD=?
0D 0A 52 4F 42 4F 20 54 58 2D 33 37 37 2F 55 53 
42 3E 67 65 74 5F 73 65 72 5F 6E 75 6D 0D 0A 30
30 30 32 31 33 31 30 34 38 0D 0A 52 4F 42 4F 20
54 58 2D 33 37 37 2F 55 53 42 3E

REQ, CMD=0x05, PL=48
00 01 01 01 81 81 81 81 81 81 81 81 01 01 01 01
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

RPL, CMD=0x69, PL=0
 
REQ, CMD=0x02, PL=44
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00

RPL, CMD=0x66, PL=48
00 00 00 00 59 00 6D 00 C9 0B C9 0B 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

REQ, CMD=0x02, PL=44
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00

RPL, CMD=0x66, PL=48
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

REQ, CMD=0x02, PL=44
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00

RPL, CMD=0x66, PL=48
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
In captured data we have 9 different commands:
001(0x01)
101(0x65)
106(0x6A)
007(0x07)
107(0x6B)
005(0x05)
105(0x69)
002(0x02)
102(0x66)

Now we can compare payload size of captured packets with structures from ROBO_TX_FW.H and find out which structure was used in packets:
106(0x6A) TA_INFO
107(0x6B) ?
005(0x05) TA_CONFIG ?
002(0x02) TA_OUTPUT
102(0x66) TA_INPUT?
? – mean that I can’t identify structure for this command code. Packets without payload not listed.

The most interesting persons in the list above - commands with codes 002 and 102.

Request with CMD=002 used to send new data for TX-C’s outputs. Respective reply with CMD=102 returns states of all TX-C’s inputs.
I have some problems to identify structure for CMD=102 because payload size from captured data did not match TA_INPUT structure size from ROBO_TX_FW.H. To find the packet structure for CMD=102 I've manually connected inputs to 9V or GND and monitored for changes in the data packet. Right structure for CMD=102 payload is following:

Code: Alles auswählen

#define N_CNT                   4           // Number of counters
#define N_UNI                   8           // Number of universal inputs

// Input structure, 48 bytes
typedef struct
{
    unsigned short uni[N_UNI];              // Current values of the universal inputs
    unsigned char  cnt_in[N_CNT];           // Current levels (0 or 1) on the counter inputs according
                                            // to their configuration (normal or inverse)
    unsigned short counter[N_CNT];          // Current values of the counter inputs
    unsigned short display_button_left;     // Number of milliseconds during which the left display button
                                            // is being kept pressed
    unsigned short display_button_right;    // Number of milliseconds during which the right display button
                                            // is being kept pressed
                                            // (distance from output structure) is reached
    char           reserved[16];
} TA_INPUT;
Now I have almost all information to write parser for the FishX1 protocol. Stay tuned! :twisted:
Zuletzt geändert von ft-ninja am 05 Sep 2015, 12:12, insgesamt 1-mal geändert.
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 27 Dez 2012, 20:52

Good news!

I have developed c-like pseudo-code for fx1parser library for Arduino. There we have several functions:

Code: Alles auswählen

//
// Global variables
//
UBYTE8   x1FSMState;      // Current parser's FSM state.
UBYTE8   nPacketLength;   // Current packet lenght
UBYTE8   pRXPacketData[256];     
//
// Reset parser internal data structures to defined state.
//
fx1ParserInit()
{
        x1FSMState = FSM_WAIT_STX;
        nPacketLength = 0;
}

//
// Receive and parse one symbol from serial port.
// Parser function realized as Finite State Machine.
//
fx1ParserParse(UBYTE8 symbol)
{
    switch (x1FSMState) {
        case FSM_WAIT_STX:
            if (symbol == 0x02) {
                *(pRXPacketData+nPacketLength) = symbol;
                nPacketLength++;
                x1FSMState = FSM_WAIT_55;
                break;
            }
            break;
        
        case FSM_WAIT_55:
            if (symbol == 0x55) {
                *(pRXPacketData+nPacketLength) = symbol;
                nPacketLength++;
                x1FSMState = FSM_WAIT_LEN1;
                break;
            } else {
                x1FSMState = FSM_WAIT_STX;
                break;
            }
            break;
        
        ...
        ...
        ...
                
        case FSM_WAIT_ETX:
            if (symbol == 0x03) {
                fx1ParserProcPacket(pRXPacketData);
                x1FSMState = FSM_WAIT_STX
                break;
            } else {
                x1FSMState = FSM_WAIT_STX;
                break;
            }
            break;
            
        default:
            break;
    }
}

//
// Execute callback functions according to command code CMD in received packet.
//
fx1ParserProcPacket(pData) {
    CMD = pData[OFFSET_CMD];
    switch (CMD) {
        case CMD_1:
            fx1ParserCMD1(pData);
            break;
            
        case CMD_2:
            fx1ParserCMD2(pData);
            break;
        
        ...
        ...
        ...

        case CMD_7:
            fx1ParserCMD7(pData);
            break;

        default:
            break;                   
    }
}
Typical usage in Arduino environment should look like following example:

Code: Alles auswählen

void setup()
{
  // Init UART
  // The ROBO Pro sends data at 38400 bps
  while(!Serial);
  Serial.begin(38400); 

  // Init parser
  fx1ParserInit();

}

void loop()
{
  UBYTE8 s = 0;
  
  // Check and read one symbol from UART
  if (Serial.available() > 0 ) {
    s = Serial.read();
  }
  
  // Parse FishX1 protocol
  fx1ParserParse(s);
}
Now I need a time to code all functions in Arduino environment and then test it with RP.

Don't turn the channel. I'll return very soon!
Zuletzt geändert von ft-ninja am 05 Sep 2015, 12:13, insgesamt 1-mal geändert.
==
ft-ninja

geab
Beiträge: 44
Registriert: 15 Feb 2011, 12:29

Re: ROBO Pro + Arduino ?

Beitrag von geab » 29 Dez 2012, 11:20

Great work Ninja

would this also allow to read out data e.g. from a pressure sensor measured on the TX controller by voltage changes
in online mode ?

Cheers, Geab

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 29 Dez 2012, 20:11

Hello folks,
Thank you for advice ;)

I'm still working on the arduino code fro my fx1parser. It's snowy weather outside the window and I enjoy spending my time on coding with cup of tea. It's so funny.

Dear Geab,
In my library fx1parser for Arduino I want to map Arduino's IO ports to TX IO ports. It means that you can connect any analog sensor to Arduino input A0 and then read sensor value in RP with the Universal input (8.7.1). Just configure it as A10V (Analog Input).
==
ft-ninja

Benutzeravatar
ft-ninja
Beiträge: 113
Registriert: 01 Nov 2010, 14:26
Wohnort: Inner Mongolia
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von ft-ninja » 30 Dez 2012, 21:16

Good news - it works!

It's a good time to show you the result of my work. Please watch it on youtube.

Bild

From diplomatic point of view I'll wait for official permission from FT representative to publish my library source codes. Is there anyone who has contact with FT?

By the way, it was very happy to realize this project.
Zuletzt geändert von ft-ninja am 30 Dez 2012, 22:20, insgesamt 1-mal geändert.
==
ft-ninja

Masked
Beiträge: 500
Registriert: 18 Okt 2010, 18:19

Re: ROBO Pro + Arduino ?

Beitrag von Masked » 30 Dez 2012, 21:22

Hi ft-ninja,
Good work!
There a two possibilities, I would prefer the first one:
- You can open a thread with the link to this thread in the "An fischertechnik"-category here in the forum.
- Or contact fischertechnik by e-mail, but I don't know who would be the correct contact person, perhaps Hartmut Knecht.
Greetings,
Martin
And let me guess, the answer of fischertechnik will probably be "No".

Benutzeravatar
Defiant
Beiträge: 354
Registriert: 31 Okt 2010, 21:42
Wohnort: Narn Homeworld
Kontaktdaten:

Re: ROBO Pro + Arduino ?

Beitrag von Defiant » 31 Dez 2012, 11:11

You have to check your countries law, but usually there is no issue with uncommercial reverse engineering.
"Propaganda does not deceive people; it merely helps them to deceive themselves."
E Hoffer

Ad2
Beiträge: 306
Registriert: 31 Okt 2010, 22:20

Re: ROBO Pro + Arduino ?

Beitrag von Ad2 » 31 Dez 2012, 11:18

But nobody prevents you from putting it on your homepage or googlecode, sourceforce, github or whatever

Antworten