Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey all..
I’m trying to move a pan and tilt system and using VS2008c# to do so, when my program find a target and it enabled it refresh and sends the new current point to the motors to move.. but it stutterer and run smoothly!!
moreover on_click Event when i set it to move to what i click it dose the same problem.

any idea on how to overcome this problem?
should i use a new thread for the motor movement?


thanks

Dutchbear
Posted

I actually have worked with that before, namely in controlling the stepper motors for lens focus in a digital camera, although it was in the .NET compact framework.

I suppose you could start a new thread to take care of the motor, but I am very leery about using managed code to manipulate real-world objects. You never know when that garbage collector is going to kick in and your application freezes. I don't know what you are using this for, but if you are writing a motor control for a toy robot, this stuttering behavior is probably okay. If you are controlling a vehicle or targeting platform for a weapons system, this is a bad idea (but you wouldn't be doing it in .NET anyway).

You probably don't want to hear this, but my suggestion would be to write a .dll in c++ that accesses the motor, and then call that c++ DLL through p/invoke.

Ryan
 
Share this answer
 
Comments
OriginalGriff 14-May-10 15:14pm    
5! Definitely agree - C# is not a good real-time environment, use of C or C recommended.
liorogi wrote:
should i use a new thread for the motor movement?


You mean you haven't actually tried that yet? Most of us have no experience with this kind of controller stuff, so we can't comment.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900