BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Nov 19, 2017 11:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Position Command Acceleration/Deceleration
PostPosted: Thu Oct 30, 2014 4:19 am 
Offline
New User

Joined: Wed Oct 29, 2014 7:12 am
Posts: 1
I've written this code and find that I'm getting accurate positioning but with no acceleration or deceleration.
I have tried may values but with the same result.
The PID values come from the PIV tune using ion motion.

Can someone give me some direction as to how to get the accel and decel working?

As well, what should the buffer value be?
As it is written there is no buffer.



#include <RoboClaw.h>
#include <BMSerial.h>

#define address 0x80

//Position PID coefficients
#define PosKp 0x1B58 //7000
#define PosKi 0x0
#define PosKd 0x0
#define KiMax 0x0
#define DeadZone 0x0
#define Min -1180000
#define Max 1180000
//#define qpps 118000 // not required for position


BMSerial terminal(0,1);
RoboClaw roboclaw(5,6,10000);

long spd = 118000; // Speed
long acl = 118000; // Acceleration
long dec = 118000; // Deceleration
long pos = 0; // Declare position variable


void setup() {
terminal.begin(115200);
roboclaw.begin(38400);
roboclaw.SetM1PositionPID(address,PosKd,PosKp,PosKi,KiMax,DeadZone,Min,Max); // Write Position PID
roboclaw.ResetEncoders(address); // Reset encoders to 0
}

void loop() {

while(Serial.available()) {
int ser = Serial.read(); //read Serial value from serial monitor
{
pos = ser - 48; // convert ascii to int
pos = pos * 73289; // 73289 counts per revelution
Serial.println(pos); // print position value
}
}
roboclaw.SpeedAccelDeccelPositionM1(address,acl,spd,dec,pos,1); // write command to drive

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO