c++ on TXT

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
bluatigro
Beiträge: 22
Registriert: 25 Jun 2018, 15:44

c++ on TXT

Beitrag von bluatigro » 13 Mär 2020, 09:18

i have decided that i wil use c++ on the TXT
because python is not posible on a mobile robot

i know the folowing :
i need eclipse
how can i find out if i need the 32 or the 64 bit version ?
how de i set ecipse so that i can use it for TXT ?
where can i find the *.h and *.cpp file[s] i need ?
how do i get the TXT ready for c++ ?
where can i find example code ?

i need a list of instructions for doing this
any help is wekome !

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

Re: c++ on TXT

Beitrag von vleeuwen » 13 Mär 2020, 18:29

That is not so difficult.In order of complexity (little => more):
• Programming for on-line use
• Programming for off-line use
• Programming for SLIs (RoboPro extension elements)

A)
Here is the basis for on-line C / C ++ programs for the TXT from fischertechnik: https://github.com/fischertechnik/txt_demo_c_online.
Under clone / download you can download the complete structure in a .zip and extract it into your solution map. The .sln is the solution file that contains all projects.
For this you need the free MS-Visual Studio 2019 (community version).
You can then compile and test the sample project immediately.
This can also be used as the basis for your own project.

B)
For off-line (local) programs you need Eclipse IDE for C / C ++ Developers, also for free:
Eclipse IDE 2019 12 https://www.eclipse.org/downloads/packa ... developers
In the readme you will find all instructions for downloading, installing and using the cross compiler (tool chain).
Follow those instructions exactly.

Download the https://github.com/fischertechnik/txt_demo_c_download
then place this in the empty workspace you have already created in Eclipse.
Here you will also find example projects.
You also need FIlezilla and Putty; this for uploading the executable to the TXT and monitoring the execution.
Since firmware 4.6.6, uploading is also possible with the web interface on the TXT.

C)
Third, also works in the Eclipse environment.
Drop in another workspace:
https://github.com/fischertechnik/txt_demo_ROBOPro_SLI

Foxi83
Beiträge: 16
Registriert: 01 Feb 2020, 16:12

Re: c++ on TXT

Beitrag von Foxi83 » 15 Mär 2020, 12:52

bluatigro hat geschrieben:
13 Mär 2020, 09:18
because python is not posible on a mobile robot
Why not? No problem with the community firmware. Do I miss the point?

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

Re: c++ on TXT

Beitrag von vleeuwen » 15 Mär 2020, 15:10

With the fischertechnik firmware the use of Python is also not a problem.
Python and FtRoboPy is available and works fine.

However C/C++ gives a lot more possibilities in relation with fischertechnik libraries.

Benutzeravatar
bluatigro
Beiträge: 22
Registriert: 25 Jun 2018, 15:44

Re: c++ on TXT

Beitrag von bluatigro » 16 Mär 2020, 09:10

update :
eclise down load + instalation has hapned

i have more experiance whit c++ than whit python
and whit python you have a indentation of 4 spaces
whit c++ i use 2 spaces for that
i need to have large char's in the IDE
so the line's can not be to long

Cymbaline
Beiträge: 66
Registriert: 01 Nov 2010, 07:28
Wohnort: Reuver, NL

Re: c++ on TXT

Beitrag von Cymbaline » 16 Mär 2020, 10:22

Hi,

In Python you can use any number of spaces you like for indentation.
It just has to be consistent, because Python uses indentation syntactically (for grouping), not just for readability.


Wilbert.
Het leven is hard. Een kokosnoot ook.

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

Re: c++ on TXT

Beitrag von vleeuwen » 16 Mär 2020, 11:31

Both Eclipse and MS-VS have a code formatter, so you don't need to format C/C++ code yourself.
In the general setting there are option to chance the predefined setting their you also able to chose between some semi-standards for code formatting.

In C/C++ but also in C#, spaces new lines and tabs don't have any meaning in your code.
The only exception are the pragma's the words which are starting with "#".
And literal strings.

Foxi83
Beiträge: 16
Registriert: 01 Feb 2020, 16:12

Re: c++ on TXT

Beitrag von Foxi83 » 17 Mär 2020, 21:35

vleeuwen hat geschrieben:
15 Mär 2020, 15:10
However C/C++ gives a lot more possibilities in relation with fischertechnik libraries.
Can you elaborate on this? Is there some documentation regarding it? I'd be interested in using the line seeker, motion, color using the camera without having to deal with RoboPro. Is this available?

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

Re: c++ on TXT

Beitrag von vleeuwen » 17 Mär 2020, 23:28

@Foxi83
As you can see in the FtRoboPy, the video is available at Berkely socket port 65001.

In the fischertechnik GitHub sources you can find camera examples at two places:
In the factory software the TxtCamera shows another way to use the camera in a locale program.
Here you also will find an example of local image processing with OpenCV (also available on the TXT fischertechnik firmware).
In the online Examples is also an example to find about the use of Berkely socket port 65001.(this documentation exist already a very long time.)

The FtRoboPy is socket base interface that works in the on-line and locale mode the same (local mode IP= localhost or 127-0.0.1)
The interesting thing is that FtRoboPy is using the undocumented Berkely socket port 65002 for the I2C, but this can also be done in C/C++.

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

Re: c++ on TXT

Beitrag von vleeuwen » 19 Mär 2020, 12:39

@Foxi83
Additional, in detail:
https://github.com/fischertechnik/txt_t ... Camera.cpp
https://github.com/fischertechnik/txt_t ... xtCamera.h

https://github.com/fischertechnik/txt_d ... ter/Common
See the the header and source file ftProInterface2013TransferAreaCom:

Code: Alles auswählen

bool StartCamera( int width=320, int height=240, int framerate=15, int powerlinefreq=50, const char *port = "65001" );
but also the example: https://github.com/fischertechnik/txt_d ... ter/Camera
For the off-line mode you need to be a little bit creative.

https://github.com/ftrobopy/ftrobopy/bl ... trobopy.py
See line 747 e.v.

Code: Alles auswählen

 def startCameraOnline(self):
I hope that this is the answer on your questions.

Antworten