Shop OBEX P1 Docs P2 Docs Learn Events
USB Servo Controller — Parallax Forums

USB Servo Controller

bidybidy Posts: 7
edited 2010-01-20 10:46 in Propeller 1
I'm using the USB Servo Controller with the Open Source Software from Crustcrawler.com
Most of the functions work well - but the baud rate cannot be switched to 38k and the "ReportServoPosition" function
always results in a timeout error.

Does anybody has an idea why?

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-01-08 17:10
    bidy,

    Can you please provide a link to the open source software from www.crustcrawler.com/ that you mention?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Mike GMike G Posts: 2,702
    edited 2010-01-09 04:20
    bidy,

    I checked the software. The baud stuff seems to be working fine.
    http://www.agaverobotics.com/services/dotnet/default.aspx

    Since the ReportServoPosition() method is not implemented in the UI... I'm going out on a limb here and assuming that you're using the dll in another project??? When you update the PSC baud you also must update the COM Port baud.

    Edit: Fixed link

    Post Edited (Mike G) : 1/9/2010 4:41:27 AM GMT
  • bidybidy Posts: 7
    edited 2010-01-10 10:05
    I downloaded the following program:
    http://www.crustcrawler.com/software/psc/index.php

    (Running under Windows XP)

    I use Parallax (Futaba)
    Servos.
  • Mike GMike G Posts: 2,702
    edited 2010-01-10 18:51
    bidy,

    I wrote the software. Secondly, you have the old version. You can get the new version from the link provided.
    www.agaverobotics.com/services/dotnet/default.aspx

    I was studying MVC and OOP when I wrote the PSC source code so it's a little goofy. In retrospection, I could have made the application much easier to deal with but that's how I did it. Heck it works. The ReportServoPosition() method was not implemented in the original version. To add that feature you need to wire up a delegate and pass arguments to the event subscribers. If you tried to call the method directly, you would get a timeout since the ReportServoPosition() method does not know about the com port or PSC. Anyway, I wired it up so you can get an idea how it works.

    This is probably not the most appropriate forum for a PSC question.

    Happy programming.

    Post Edited (Mike G) : 1/10/2010 7:10:50 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-11 21:20
    bidy, your duplicate post in the robotics forum has been removed. Please post in only one forum per message subject as per the forum guidelines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • bidybidy Posts: 7
    edited 2010-01-13 10:23
    Hmm... I still get the timeout error on the ReportServoPosition function...
    Could there be something wrong with the USB driver?
  • Mike GMike G Posts: 2,702
    edited 2010-01-18 05:02
    I don't think it's your USB port since the other functions work. I downloaded the exe and ran it... well it works. See the attached file.

    Are you trying to wire up the method yourself? You not really giving me much to go on here.
    525 x 422 - 34K
  • Mike GMike G Posts: 2,702
    edited 2010-01-18 16:33
    I'm using a Hitec HS-322 and a Parallax servo.

    This is the little that I know about your problem.
    1) ReportServoPosition() times out.
    2) Timeout changing PSC baud to 38k4

    Everything else is working.

    Well, ReportServoPosition() was not implemented in the original GUI. Therefore, I believe you're modifying the source. That's not a problem but it would help tremendously if you posted your code. Are you modifying the source code?
    I updated the source code and implemented the ReportServoPosition() and provided an example. Simply click the magnifying glass on the channel control.
    Have you clicked magnifying glass? Have you downloaded the new source and/or exe?

    Updating baud has never been a problem. Again have you modified the source code?

    Your problem is most likely not with the servos. It's your understanding of the PSC and RC servos. Since I can not reproduce the problem, I have to conclude that the code is working as expected. If you still need help please ask specific questions, provide detailed examples of the problem, and post your code

    Post Edited (Mike G) : 1/18/2010 4:41:03 PM GMT
  • bidybidy Posts: 7
    edited 2010-01-18 17:12
    I am using your code ARPSCI.ZIP

    There is only one thing I changed:
    In the "PingForPSC" function a changed "Return buffer(9) & buffer(10) & buffer(11)" into
    "Return buffer(0) & buffer(1) & buffer(2)".
    This way I get "1.0" - othwise I would get "nothing".
    See the code below.
    But the rest is exactly your source code.



    Private Function PingForPSC(ByVal connection As IO.Ports.SerialPort) As String
    Dim buffer(11) As Char
    connection.ReadTimeout = 500
    connection.WriteTimeout = 500
    Try
    connection.WriteLine(VER)
    Thread.Sleep(200)
    connection.Read(buffer, 0, 12)
    connection.DiscardOutBuffer()
    connection.DiscardInBuffer()

    Catch ex As TimeoutException
    Return Nothing
    Catch ex As Exception
    MessageBox.Show(ex.ToString)
    End Try

    If buffer(2) = Nothing Then
    Return Nothing
    Else
    Return buffer(0) & buffer(1) & buffer(2)
    End If
    End Function
  • Mike GMike G Posts: 2,702
    edited 2010-01-18 23:13
    It has something to do with the serial port buffer.

    What OS are you running?
    What kind of PSC to you have; USB, Prop, or serial.
  • bidybidy Posts: 7
    edited 2010-01-19 17:02
    Windows XP
    USB PSC
  • Mike GMike G Posts: 2,702
    edited 2010-01-19 19:58
    That's the exact setup I have. I tried the exe on 5 PCs all worked fine. I also brought the PSC to work today and tried it there too. Everything just works. I still think it's a buffer issue. What's in buffer(0) & buffer(1) & buffer(2)? Is it "1.4"? I don't recall a 1.0 unless Parallax started over with the new prop PSC. Better yet what's in values are in the entire buffer byte array?

    We might want to take this discussing over to http://forum.agaverobotics.com/

    I'm not sure that the Propeller discussion board is the best place to discuss using the USB PSC with 3rd party software.
Sign In or Register to comment.