Just wondering how to sync the left and right side of a reverse 4 bar?
my team’s current idea is to have one side as the dominant side and the other side adjust accordingly using 2 pot sensors.
Is there any better way of doing this?
Just wondering how to sync the left and right side of a reverse 4 bar?
my team’s current idea is to have one side as the dominant side and the other side adjust accordingly using 2 pot sensors.
Is there any better way of doing this?
A lot of teams use p or pid on both sides to sync the two sides
hmm
what’s the theory behind the p or pod teams use?
do they make one side dominant and the other side follow accordingly or?
Yeah i was going to use high strength axles and buy the bearing blocks, clamp shaft collars, spacers for the hS axle. but didn’t want to spend that money if there’s a programming or altiernative mechanical solution
@Justinachano
The PID structure (there are a metric ton of forum responses about them) basically tells a motor (with a sensor) to go to a certain value and calculate/get rid of over or undershoot. It uses calculus. Search “What is PID?” on the forum to learn more. I’m just getting into this myself, actually.
As for the practice…I wouldn’t be surprised if they had a "main"sensor that the calculations are based off of. My P controller that I’m working with uses two potentiometers with one as the “main” that calculates for both motors. I haven’t been able to test it (i have a comp tomorrow), but it should theoretically work if I’m using the right things…which I am usually potato with xD.
In my opinion, the best way to go about this is slave one side to the other. I don’t mean use the slaveMotor() function.
Your theory here is correct. The way I would do it is have one side be the “master” and then base your P calculations based on that potentiometer value.
To provide an example: Say the left side is the “master”, make error SensorValue[right] - SensorValue[left], and then multiply that by the constant of proportion. Set that to the motor value of your right side.
The way I like to do it is have a base power (say 90 for example) and then subtract and add to that speed based on the difference between whatever sensor our using. This is called a P(roportional) controller, and will “synchronize” both sides of your lift. Similar to @The Electrobotz
if( button == pressed)
{
error = SensorValue[right] - SensorValue[left];
proportional = error*kP;
motor[right] = 90 - proportional;
motor[left] = 90 + proportional;
}
You can tune kP to whatever value is best for your robot. You can add I and D later on if you want.
You could also do the same for distance. Say you want you lift to raise to a certain height, you would do something like this:
if( button == pressed)
{
error = targetValue - (SensorValue[right] + SensorValue[left])/2;
proportional = error*kP;
motor[right] = proportional;
motor[left] = proportional;
}
And then you could put the two together for super precision:
if( button == pressed)
{
error1 = targetValue - (SensorValue[right] + SensorValue[left])/2;
error2 = SensorValue[right] - SensorValue[left];
proportional1 = error1*kP;
proportional2 = error2*kP;
motor[right] = proportional1 - proportional2;
motor[left] = proportional + proportional1;
}
@Joshua_84927A
That will make my life a whole lot easier.
However: I have the P structure under an “int” placed before everything else that references a typedef struct. If I don’t want to have to mess with a return value, what should I use instead? Or should I just make it easy and put the P controller in the “if” statement in the drivercontrol task?
edit: I just changed it to a “void” and it compiled. is that gonna work?!
The way i do it is put it in a function with a while loop. Like this:
void foward (int targetValue)
{
while(SensorValue[encoder] < targetValue)
{
P Control Stuff
}
}
task main()
{
forward(1000);
}
Im not sure how to implement it into drivercontrol. I only use these functions for autonomous.
You could put that code into a task instead of a function, that way it could run concurrently w/ driver control.
Ive had bad experiences with having two tasks telling a motor to do something different
Oh yeah that won’t work. You can have your driver control only control the master motor, and the PID task only control the slave motor.
@Joshua_84927A
Ok, I did that and it compiled…I’ll test it tomorrow when I reinstall the potentiometers.
Thank you so much!
@Royal_xD No problem. If you have any problems/questions, feel free to PM me.