Drive Motor with distance

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
hiticlo
Beiträge: 4
Registriert: 02 Nov 2010, 22:14
Wohnort: Orléans (France)
Kontaktdaten:

Drive Motor with distance

Beitrag von hiticlo » 05 Dez 2010, 20:49

Hello

I trying to drive Motors with this code below.
And it not work. The motor not run.
I have to put a break point in -- 1 -- to 'see' my motor running and in -- 2 -- it did not run in the other other way.
I want to drive my motor dynamiclly so Sorties->distance[0] will be modified before the motor have reach the counter value.
Is it necessary to wait (Sleep) after each assignment.


thanks

Code: Alles auswählen

		volatile IF08_TRANSFER *Adresse_Base;
		volatile TA_OUTPUT *Sorties;
		volatile TA_CONFIG *Config;
		volatile TA_INPUT *Entrees;
		INT16 Cpt;
		
		Adresse_Base = GetIF08TransferAddress (Handle_Interface);
		Sorties = &Adresse_Base->ftxTransferArea->output;
		Config = &Adresse_Base->ftxTransferArea->config;
		Entrees = &Adresse_Base->ftxTransferArea->input;

		Config->motor[1] = true;
		
		Cpt = Entrees->counter[0] + 100;
		Sorties->distance[0] = Cpt;
		Sorties->duty[1] = 0;
		Sorties->duty[0] = 512;
		Sleep (100);
		do {
		} while( Entrees->counter[0] != Cpt ); ///    -- 1 --
		Sleep (100);
		
		Cpt = Entrees->counter[0] + 200;
		Sorties->distance[0] = Cpt;
		Sorties->duty[0] = 0;
		Sorties->duty[1] = 512;
		Sleep (100);
		do {
		} while( Entrees->counter[0] != Cpt );///    -- 2 --


	vi_Retour = ftxStopTransferArea(Handle_Interface);
	vi_Retour = ftxCloseDevice(Handle_Interface);
	vi_Retour = ftxCloseLib();

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

Re: Drive Motor with distance

Beitrag von vleeuwen » 05 Dez 2010, 22:45

Redraw by the writer;
the information was out dated.
Zuletzt geändert von vleeuwen am 19 Jan 2011, 21:53, insgesamt 1-mal geändert.

Benutzeravatar
hiticlo
Beiträge: 4
Registriert: 02 Nov 2010, 22:14
Wohnort: Orléans (France)
Kontaktdaten:

Re: Drive Motor with distance

Beitrag von hiticlo » 06 Dez 2010, 08:04

Hello
I want to control my robot dynamically. coordinates came from another application.
I have only one ROBO TX and I use Visual Studio to create my program.

I did not show you all my code (I use ftxIsTransferActiv)

When I wrote
Sorties->duty[1] = 0;
Sorties->duty[0] = 512; //START MOTOR M1
Sorties->distance[0] // DISTANCE FORM THE MOTOR M1
Entrees->counter[0] // COUNTER OF THE M1 MOTOR

I don't understand your notes.
Entrees->counter[0] give me the value of the counter of M1 ?

I will try motor_pos_reached this evening.

The problem is that the motor did not start after :
Sorties->duty[1] = 0;
Sorties->duty[0] = 512;
Sorties->distance[0] = Cpt;



Thanks
Zuletzt geändert von Gast am 06 Dez 2010, 15:10, insgesamt 1-mal geändert.
Grund: Removed full quote

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

Re: Drive Motor with distance

Beitrag von vleeuwen » 06 Dez 2010, 10:26

Redraw by the writer;
the information was out dated.
Zuletzt geändert von vleeuwen am 19 Jan 2011, 21:53, insgesamt 1-mal geändert.

Benutzeravatar
hiticlo
Beiträge: 4
Registriert: 02 Nov 2010, 22:14
Wohnort: Orléans (France)
Kontaktdaten:

Re: Drive Motor with distance

Beitrag von hiticlo » 06 Dez 2010, 16:44

vleeuwen hat geschrieben: Remark:
This is based on the FtMscLib description V1.2.24.(21-09-2009).
The Extended motor control implementation has been changed in the beta 3.0.4 release of RoboPro.
So this example will not work with that new FtMscLib.
I did not test this code!!.
Did the beta release can be downloaded ? (and where)

Or when did it be avalaible in release version ?

I have try Entrees->motor_pos_reached[0]and it work for the first time but not in the second time !!!

to rotate once in one direction and then once in the other I have to reset the counter (->cnt_reset[0] = 1) between the two rotation. But I want to keep the value of the counter to know exactly where is my robot.


Thanks

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

Re: Drive Motor with distance

Beitrag von vleeuwen » 06 Dez 2010, 22:02

Redraw by the writer;
the information was out dated.
Zuletzt geändert von vleeuwen am 19 Jan 2011, 21:53, insgesamt 1-mal geändert.

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

Re: Drive Motor with distance

Beitrag von vleeuwen » 08 Dez 2010, 10:21

Redraw by the writer;
the information was out dated.

Antworten