CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RC servo smoothing for robotic arm

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Aamir



Joined: 11 Apr 2010
Posts: 13

View user's profile Send private message

RC servo smoothing for robotic arm
PostPosted: Mon Apr 19, 2010 4:31 pm     Reply with quote

Hi, I am making a robotic arm in which I have installed 6 servos. I have written the code for my system and the servos are working accordingly. The only problem is that all the servos are moving very fast and thus the overall system seems as if it would break apart at any moment. I am directly giving signal to all servos from PIC 16f877a.

I am using TOWER PRO SERVOS which give around 180 DEG rotation. I have written the program myself but the program is just for generating the PWM for servos and I am using CCS compiler for it. I am not sure how to control the speed of RC SERVOs through programming and due to this when the servo receives signal it immediately turns in the corresponding direction.

I have to provide different signals to 5 motors in parallel. That is, I have to provide 80 degrees to base, 40 to base joint, 30 to above joint, 20 to wrist and 70 to gripper.

All angles should be provided simultaneously such that all motors get the signal in parallel. I am using port C of PIC16f877A for motors.
Can you help me out a little, actually I am stuck currently and have no choice and chance in such a short notice.
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Tue Apr 20, 2010 12:04 am     Reply with quote

How do you control your servos?

I wrote a sample program where I used timer interrupt for controlling several servos. You can then ramp servos slowly. Search the forum for my post about this topic. Sample was written for 18f4550 but it will give you general idea how to do that.
Aamir



Joined: 11 Apr 2010
Posts: 13

View user's profile Send private message

PostPosted: Tue Apr 20, 2010 2:41 am     Reply with quote

currently i m controling them through a very poor approch (as people use to say it) just a high pulse, delay, low pulse and delay
well i saw your code but it did'nt helped me exactly. i am not a professional so quiet weak in timers and intrupts
if u help me out in PIC16f877A about how to control these motors in parallel it would be helpful
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Apr 20, 2010 6:52 am     Reply with quote

It sounds like you have two pieces of code. One determines where the motor should be. That code sets the TARGET. You also have code that starts with a NUMBER and generates pulses to control the motor.

Right now the TARGET instantly becomes the NUMBER and the motor jerks from one TARGET to the next. You need some middle code that looks at the old NUMBER and the new TARGET and generates a set of new NUMBERs that slowly change from the old NUMBER to the TARGET. Something like:
Code:
Step = (TARGET - NUMBER)/10
for second = 1 to 10
  Number = Number + Step
  delay(1 second)
next second

This will take 10 seconds to move the motor in steps from where it was to the new TARGET. You will probably need much smaller and faster steps to stop your robot from vibrating as it moves, but this is the idea.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group