DGT board C++ interface project

You can discuss all aspects of programming and technical matters here.

Moderators: Harvey Williamson, Watchman

User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

More call examples

Post by sje »

More call examples

Code: Select all

ESCI::WriteString("Send MPD");
ESCI::ReadString(stringvar);
stringvar -> "4r2k/3r3p/p2q1p2/5P1Q/4bR1N/1P5P/P1p3PK/2B5"

ESCI::WriteString("Send FEN");
ESCI::ReadString(stringvar);
stringvar -> "4r2k/3r3p/p2q1p2/5P1Q/4bR1N/1P5P/P1p3PK/2B5 b - - 6 35"

ESCI::WriteString("Send available moves");
ESCI::ReadString(stringvar);
stringvar -> "Ba8 Bb7 Bc6 Bd3 Bd5 Bf3 Bxf5 Bxg2 Kg7 Kg8 Qa3 Qb4 Qb6 Qb8 Qc5 Qc6 Qc7 Qd1 Qd2 Qd3 Qd4 Qd5 Qe5 Qe6 Qe7 Qf8 Qxf4+ Ra7 Ra8 Rb7 Rb8 Rc7 Rc8 Rdd8 Rde7 Re5 Re6 Red8 Ree7 Rf7 Rf8 Rg7 Rg8 a5 h6"
(Note ASCII ascending sort, proper disambiguation, capture indications, and check indications.)
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

The ESCI Command call

Post by sje »

The activities performed by the ESCI and an attached chessboard cand be divided into two kinds:

1. Those which can be completed immediately or nearly so.

2. Those which require a gesture (physical movement of the chessmen).

For the first class, the interface will have the Command call. This call takes two parameters, the input command string and the result string.

The controlling application will block until the activity is completed.

Code: Select all

ESCI::Command("Send FEN", stringvar);
stringvar -> "4r2k/3r3p/p2q1p2/5P1Q/4bR1N/1P5P/P1p3PK/2B5 b - - 6 35"
Each routine in the ESCI will return a value of type bool. A true return value means success, a false return value means failure.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Multiple chessboards, physical and virtual

Post by sje »

Multiple chessboards, physical and virtual

The ESCI will support multiple simultaneous instances of chessboards. Each chessboard will be connected with an Attach() call and disconnected with a Detach() call. The Attach() call will specify the vendor and model of the chessboard and will return a chessboard descriptor. This descriptor is a small, non negative integer which is used to identify that chessboard in all subsequent calls.

One of the different chessboard models available is the virtual chessboard. A virtual board exists only in the interface memory and has no other physical manifestation. A virtual chessboard instance can process all the same activities as a physical chessboard instance, except that no gestures are needed for operation.

A virtual chessboard instance may be useful as a sort of temporary storage for a controlling application. It can assist with move, position, and game verification.

There can be multiple instances of a virtual chessboard, and this can be useful for a controlling application which needs to handle multiple, simultaneous games.

--------

The ESCI will format correct PGN for display and file output. The interface will also have a hash signature generation capability for positions and games, something useful for database software.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Near term plan

Post by sje »

I am told that the DGT XL clock I've ordered will arrive within a week. Once it's here, I'll connect it with my USB DGT board and my Windows 8 notebook to ensure basic operation from end to end.

Once the clock is shown to work with its magical mode 23 serial override, I can then start the most basic of tests with the OS/X and Linux machines. These will involve sending and receiving simple commands and results, done at different rates over extended intervals. I need to know if there are any special circumstances which might cause a lock-up or a data loss condition. Eventually, the ESCI code will include timeout detection and recovery along with a disconnect/reconnect capability.

After that, there'll be a lengthy period of little visible progress as there's much code, already written, which needs to be shoved into place and beaten into submission. OS/X and Linux functionality will be tested concurrently to avoid too many nasty surprises.

Most manual testing will be done with the DGT board and clock with the Novag Citrine taking a back seat for a while. There will be much continuous testing of the virtual chessboard services as this can be done automatically.

Ideally, it would useful to test with two or more DGT boards connected simultaneously. But I won't hold my breath for this to happen.

I'll probably install the voice synthesis code, too. This will help with testing although it will surely annoy the cats. For those wanting to implement a custom voice synthesis scheme, I can have the ESCI assist by returning the natural language long text string for a given move. Note that only American English natural language output will be initially supported; there will be hooks in the source for later additions.

Some point after all of this, I can send the source to a few brave folk who I've been able to trick into being unpaid testers of very early alpha code.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Raspberry Pi Starter Kit

Post by sje »

Raspberry Pi Starter Kit

From the folks at http://makezine.com/category/electronics/raspberry-pi/

For a mere US$130, I got my Raspberry Pi Starter Kit today:

http://www.makershed.com/Raspberry_Pi_S ... msrpik.htm

It's got everything in one box and more than what I needed. For those who already have or don't need some of the parts, a Raspberry Pi board by itself is only about US$40. When the DGT XL clock arrives in a few days, the Linux testing can begin.

Like the PXA320 processor in the Revelation II, the CPU in the RaspPi is a 32 bit ARM SoC (System on a Chip). The RaspPi is clocked slightly slower at 700 MHz vs 806 MHz for the Revelation II.

It will be interesting to port Symbolic to the RaspPi as the program has never been compiled for the ARM architecture. But it has been compiled and run on 32 bit Intel/AMD x86 hardware, so I don't expect many changes will be needed. However, it could be useful to supply ARM specific bitboard manipulation routines.

--------

ESCI project expenditures to date:

DGT USB Board + Ebony Piece Set: US$920
HP Windows 8 Notebook: US$350
Raspberry Pi Starter Kit: US$130
DGT XL Clock: US$90
DGT Carrying Bag: US$90
Fritz 13: US$50

Total: US$1630
shiv
Member
Posts: 57
Joined: Sat Nov 24, 2007 10:32 pm

Re: Near term plan

Post by shiv »

All sounds great. Virtual drivers are a good way for applications to perform integration testing.

I am interested in your stress tests as there are growing reports that picochess has issues after several hours of usage and at times needs to be restarted.

Which library are you considering for voice synthesis?

What do you think about putting up your code on github? It makes it easier for us testers..
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Post by sje »

My suspicions about PicoChess problem reports:

1. The Raspberry Pi is known to have overheating issues when run at length or when overclocked. The problem can be worse if the RaspPi is sitting inside of a case without active ventilation. Adding a heat sink to the Broadcom SoC chip will help. Underclocking will help, but this could affect time control usage.

2. The DGT XL clock uses a simple serial link and is not known (by me, at least) to have error detection and recovery. So only a single bit of electrical noise can result with a freeze. One solution: instead of the DGT clock cable supplied with the board, use a shielded stereo audio cable.

Speaking: At present, the code just calls system() with a say or speak command.

Github: At present, I don't plan on having more than a very few testers, so I'll burn that bridge when I come to it.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Raspberry Pi

Post by sje »

I got my Raspberry Pi Starter Kit and in spite of a number of problems, I managed to get it running -- other than the network interface not yet working.

I copied over the 17 K line C++ source of my chess program Symbolic. Using only the RaspPi native C++ toolchain, I compiled Symbolic with zero source modifications. Amazingly, there were no errors and the program works.

Not yet working is the Linux spd-say speech generator, as it wasn't installed by default. Also, the audio alert is not being handled by the LXTerminal emulator.

Overall, mostly good news.

Further updates will be sporadic at best because of some personal family/medical issues. Please be patient.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Re: Raspberry Pi

Post by sje »

sje wrote:I copied over the 17 K line C++ source of my chess program Symbolic. Using only the RaspPi native C++ toolchain, I compiled Symbolic with zero source modifications. Amazingly, there were no errors and the program works.
Symbolic continues its chess calculation runs on the RaspPi, mostly long perft() computations. These take only a second or so to start and allow me hours for other tasks while the RaspPi churns away. They are useful for the ESCI project:

1. They verify that the RaspPi works and can run for long periods without hanging, so Symbolic and other programs which may use the ESCI can do so on a RaspPi without concern about software compatibility or thermal issues. (My RaspPi is currently running without a case and is air cooled.) However, Symbolic doesn't use any graphics other than the terminal emulator and it doesn't use much floating point, either.

2. They give speed benchmark data. The no-tran, no-bulk perft(7) run took about five hours forty minutes giving a node frequency of about 157 KHz. This is very close to the timing result from an 800 MHz, 32 bit PowerPC chip as seen in a 2002 vintage sunflower Apple iMac. All RaspPi runs are done at 700 MHz, no overclocking.

--------

My DGT XL clock should arrive tomorrow. I can't guarantee that I'll have time to do much with it for a while. At best I'll get PicoChess running for a few long tests if such can be done without much manual intervention.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Re: Raspberry Pi

Post by sje »

sje wrote:2. They give speed benchmark data. The no-tran, no-bulk perft(7) run took about five hours forty minutes giving a node frequency of about 157 KHz. This is very close to the timing result from an 800 MHz, 32 bit PowerPC chip as seen in a 2002 vintage sunflower Apple iMac.
Correction: The actual Mac comparison is with the 2000 vintage Apple PowerMac with a 400 MHz G4 PowerPC CPU, not the 2002 iMac which runs twice as fast.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Long runs with a Raspberry Pi

Post by sje »

Long runs with a naked (no case) Raspberry Pi

My RaspPi recently finished a 15+ hour run calculating perft(9). It produced the correct answer (2,439,530,234,167) and with much exercise of most of the RAM because of the use of transposition table assistance.

At this point, I've no more concerns about the RaspPi itself being a source of instability due to thermal issues when not cased.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

DGT XL clock arrived

Post by sje »

My DGT XL clock has arrived and works solo. I'll be doing basic connectivity and functional testing with it over the next few days.
shiv
Member
Posts: 57
Joined: Sat Nov 24, 2007 10:32 pm

Re: DGT XL clock arrived

Post by shiv »

sje wrote:My DGT XL clock has arrived and works solo. I'll be doing basic connectivity and functional testing with it over the next few days.
Awesome! Thanks for the updates. The error detection and recovery code is likely where Picochess has issues after several hours. I added very rudimentary error recovery code. This can clearly be tightened. I am interested in the results of your tests and looking over this issue again.
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Re: Raspberry Pi

Post by sje »

On my 700 MHz 32 bit ARM RaspPi:
sje wrote:The no-tran, no-bulk perft(7) run took about five hours forty minutes giving a node frequency of about 157 KHz.
On my year 2000 vintage Apple PowerMac 400 MHz 32 bit G4 PowerPC, almost the same (161 KHz):

Code: Select all

[]  pcfull 7
PathFull(7): 3,195,901,860   Pt: 5:19:15.408   Wt: 5:31:21.258   F/P: 160749/6.22086e-06
Total: three billion one hundred ninety-five million nine hundred one thousand eight hundred sixty
User avatar
sje
Full Member
Posts: 639
Joined: Sat Sep 28, 2013 2:28 am
Location: Land of Snow, Mud, and Bugs, NH USA

Re: DGT XL clock arrived

Post by sje »

sje wrote:My DGT XL clock has arrived and works solo. I'll be doing basic connectivity and functional testing with it over the next few days.
At last I've had the chance to try the DGT XL clock with the board. The DGT utility program recognizes the clock, but this takes a power cycle of the clock under some circumstances.

I have a couple of more issues to work out on my Raspberry Pi board, like getting the network interface running. Once these are resolved, I'll load PicoChess on the RaspPi and give it a try.
Post Reply