Products for USB Sensing and Control
It is currently Thu Aug 28, 2014 9:21 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Aug 05, 2011 12:46 pm 
Offline
Phidgetsian

Joined: Tue Jun 07, 2011 10:59 am
Posts: 11
Hi all,
I have problems when trying to set the position of a servo motor.

I am trying to connect a brushless engine and everything works perfect when using the Phidget Control panel, but when I try to do the same thing from my application, nothing seems to work. I have tried both thru a SBC and directly attached to my USB, but with same result.

The programming language is delphi 6. and I have made a test program:

bla bla
servo: TPhidgetAdvancedServo;
bla bla
log.Lines.Add('Starting');
log.Lines.Add(servo.LibraryVersion);
servo.EnableLogging(10,'c:\phidget_log.txt');
//servo.OpenRemote('phidgetsbc',-1,'');
servo.Open(-1);
log.Lines.Add('After openremote');
servo.WaitForAttachment(5000);
log.Lines.Add('After waitforattachment');
if servo.IsAttached then begin
log.Lines.Add('Attached');
while not servo.Stopped[0] do sleep(500); // vent et halv sekund
servo.Engaged[0]:=false;
servo.ServoType[0]:=PHIDGETCOM_SERVO_HITEC_815BB;
servo.PositionMin[0]:=0;
servo.PositionMax[0]:=180;
servo.Acceleration[0]:=150000;
servo.VelocityLimit[0]:=250;
servo.SpeedRampingOn[0]:=true;
servo.Position[0]:=0;
servo.Engaged[0]:=true;
log.Lines.Add('Engine '+inttostr(0)+' initialised');
log.Lines.Add('position (should be 0) '+floattostr(servo.Position[0]));
log.Lines.Add('Set position to 100');
servo.Position[0]:=100;
log.Lines.Add('position '+floattostr(servo.Position[0]));
end else
log.Lines.Add('not Attached');

The output to my own log is:
log
Starting
Phidget21 - Version 2.1.8 - Built Jun 15 2011 12:46:18
Phidget COM Library 2.1.8 - Built Jun 15 2011 12:47:15
After openremote
After waitforattachment
Attached
Engine 0 initialised
position (should be 0) 0
Set position to 100
position 0

As you can see - The position does not change to 100 as expected, but in the Phidget Control Panel it is working like a dream.

The output to the Phidget log is:
Directly attached to usb
08/05/11 20:03:57,4876,".\clog.c(45)",INFO,"Enabling logging"
08/05/11 20:03:57,2968,".\windows\cusbwindows.c(265)",INFO,"New Phidget found in CUSBBuildList: \\?\hid#vid_06c2&pid_003a#8&2e37a554&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
08/05/11 20:03:58,2968,".\windows\cusbwindows.c(395)",INFO,"Phidget successfully opened in CUSBOpenHandle"
08/05/11 20:03:58,5596,".\cthread.c(354)",INFO,"WriteThread running"
08/05/11 20:03:58,2348,".\cthread.c(236)",INFO,"ReadThread running"
08/05/11 20:04:01,5596,".\cthread.c(399)",INFO,"WriteThread exiting normally (signaled by writeStopFlag)"
08/05/11 20:04:01,2348,".\windows\cusbwindows.c(686)",INFO,"closeReadEvent signalled - cancelling outstanding read..."
08/05/11 20:04:01,2348,".\windows\cusbwindows.c(702)",INFO,"read successfully cancelled"
08/05/11 20:04:01,2348,".\cthread.c(293)",INFO,"ReadThread exiting normally (signaled by CPhidget_close)"
08/05/11 20:04:01,2968,".\cthread.c(225)",INFO,"Central Thread exiting"
08/05/11 20:04:01,4876,".\clog.c(56)",INFO,"Disabling logging"


Attached to SBC
08/05/11 19:58:19,3768,".\clog.c(45)",INFO,"Enabling logging"
08/05/11 19:58:19,6052,".\zeroconf.c(756)",INFO,"DNSServiceBrowse_ws_CallBack: phidgetsbc"
08/05/11 19:58:19,6052,".\zeroconf.c(756)",INFO,"DNSServiceBrowse_ws_CallBack: phidgetsbc (2)"
08/05/11 19:58:19,6052,".\zeroconf.c(756)",INFO,"DNSServiceBrowse_ws_CallBack: phidgetsbc (2)"
08/05/11 19:58:19,6052,".\zeroconf.c(625)",INFO,"DNSServiceBrowse_sbc_CallBack (Add): PhidgetSBC (00:1b:0b:00:0b:7b)"
08/05/11 19:58:19,6052,".\zeroconf.c(379)",INFO,"DNSServiceQueryRecord_sbc_CallBack: PhidgetSBC\032(00:1b:0b:00:0b:7b)._phidget_sbc._tcp.local."
08/05/11 19:58:19,6052,".\zeroconf.c(442)",INFO,"DNSServiceBrowse_Phidget_CallBack: Phidget InterfaceKit 8/8/8 (47984)"
08/05/11 19:58:19,6052,".\zeroconf.c(300)",INFO,"DNSServiceQueryRecord_Phidget_CallBack: Phidget\032InterfaceKit\0328/8/8\032(47984)._phidget._tcp.local."
08/05/11 19:58:19,6052,".\zeroconf.c(442)",INFO,"DNSServiceBrowse_Phidget_CallBack: Phidget Advanced Servo Controller 8-motor (98543)"
08/05/11 19:58:19,6052,".\zeroconf.c(300)",INFO,"DNSServiceQueryRecord_Phidget_CallBack: Phidget\032Advanced\032Servo\032Controller\0328-motor\032(98543)._phidget._tcp.local."
08/05/11 19:58:19,4436,".\zeroconf.c(411)",INFO,"DNSServiceResolve_CallBack: Phidget\032Advanced\032Servo\032Controller\0328-motor\032(98543)._phidget._tcp.local."
08/05/11 19:58:19,4436,".\zeroconf_lookup.c(689)",INFO,"mdns: Couldn't open nss_mdns configuration file /etc/nss_mdns.conf, using default."
08/05/11 19:58:24,3768,".\clog.c(56)",INFO,"Disabling logging"


I have tried to reinstall the Phidget package for Delphi, but with no luck.

Does anyone have any experience concerning this and (hopefully) a hint or workaround ?

regards Ib


Top
 Profile Send private message  
 
PostPosted: Sat Aug 06, 2011 2:03 am 
Offline
Phidgetsian

Joined: Tue Jun 07, 2011 10:59 am
Posts: 11
I'm pretty sure that is is a sw problem. I have inspected the "Phidget21COM_TLB.pas" that is generated by the "component-import active X control" in Delphi. and it seems that ALL writes to any Phidget device is doing nothing. It is merely a coincident that I discovered it in the adv. servocontroller.

The only procedure that actually set something is the Phidgettextlcd, the rest of the phidget devices just contains an "Exit" (see below).

Does anyone have a working "Phidget21COM_TLB.pas" that you could send me ??

function TPhidgetServo.Get_Position(Index: Integer): Double;
begin
Result := DefaultInterface.Position[Index];
end;

procedure TPhidgetServo.Set_Position(Index: Integer; pVal: Double);
begin
Exit;
end;

function TPhidgetServo.Get_Engaged(Index: Integer): WordBool;
begin
Result := DefaultInterface.Engaged[Index];
end;

procedure TPhidgetServo.Set_Engaged(Index: Integer; pVal: WordBool);
begin
Exit;
end;


Regards Ib


Top
 Profile Send private message  
 
PostPosted: Sat Aug 06, 2011 4:15 am 
Offline
Phidgetsian

Joined: Tue Jun 07, 2011 10:59 am
Posts: 11
Hi,
Just to give you my findings.

It seems that the Phidget Active X driver is hitting an error in the Delphi 6 Import active X facility. I have imported a lot of Active X library's without problemes, but it seems that some librarys are causing problems. Look at this http://groups.google.com/group/borland. ... 67f819d71c

A small number of Active X library's create the error that I have experienced. I have no clues why, but as the Phidgettextlcd is OK there must be a difference between this routine and the others that might give a hint about the difference, but the finding shows it is a Borland import error, not a Phidget error.

I would hate to invest a lot of money in a new compiler and to reprogram my user interface, so if anyone have a working "Phidget21COM_TLB.pas" then I would like to have a copy

Regards Ib


Top
 Profile Send private message  
 
PostPosted: Tue Aug 09, 2011 2:28 pm 
hello

i work with delphi 6

i try to put it in the attached file but the file is too big
give me your private mail and i send it to you

roland


Top
  
 
PostPosted: Tue Aug 09, 2011 2:38 pm 
procedure TPhidgetServo.Set_Position(Index: Integer; pVal: Double);
begin
DefaultInterface.Position[Index] := pVal;
end;[/color]
function TPhidgetServo.Get_Engaged(Index: Integer): WordBool;
begin
Result := DefaultInterface.Engaged[Index];
end;
procedure TPhidgetServo.Set_Engaged(Index: Integer; pVal: WordBool);
begin
DefaultInterface.Engaged[Index] := pVal;
end;

function TPhidgetServo.Get_PositionMin(Index: Integer): Double;
begin
Result := DefaultInterface.PositionMin[Index];
end;

if it can help you

roland


Top
  
 
PostPosted: Tue Aug 09, 2011 5:32 pm 
Offline
Phidgetsian

Joined: Tue Jun 07, 2011 10:59 am
Posts: 11
Thank you for the reply and code snips.

I downloaded a trial version of delphi xe and made the file with this. It seems to work.

regards ib


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group