DR4B and 4B automations?

What parts of your DR4B and 4B do you like to automate for stacking faster?

We are not using a DR4B or 4B but I think having preset hights of the mobile goal would be good.

Our stacking is completely automated.

How do you account for the height change as you stack more cones?

I’m sure there are other ways but you could have a count for every cone you’ve stacked and then when you stack the next cone it accounts for whatever value the count is at.

I keep track of how many cones I’ve stacked in my code. If we miss a cone, we manually correct the count.

@lelder do you mind posting some pseudo code?

Sure, there may be a more efficient way of doing this but this is how I do it.


int stack = 1
task usercontrol()
{
	if(stacking button pressed)
	{
		if(stack = 1)
		{
			code for stacking first cone
		}
		if(stack = 2)
		{
			code for stacking second cone
		}
		etc.
		if(stack = 14)
		{
			code for stacking 14th cone
		}
		stack = stack + 1;
	}
	buttons to add 1 to stack, subtract 1 from stack, and reset stack to 1
}

Thank you! One last question, have your drivers ever lost count of cones and mess up the automation?

A slightly more efficient way to do it would be to use switch cases instead of several if statements. The length of the code barely changes, but I think it’s what most people would prefer.

**

Your welcome! Yeah occasionally we get off and then it starts missing cones. Its usually pretty easy to tell though and is easy to correct.

Another way to do it is to create a linear equation for the height your lift needs to get to to stack the cone. That’s how our prototype is working.


targetValue = increment*coneCount+startingHeight

We do it by creating an array of the stack height for every cone.


int height[15]={0,45,80,105,135,160,200,230,257,290,300,330,330,330,340},dl[12]={0,45,80,105,135,160,200,230,257,290,300,330};

height] is for regular stacking and dl] is for driver loads.

Better yet, do a two dimensional array and have settings for field, drive load, and stationary stack transfer.

we are going to automate ours to lift the cone up, but not down since we are externally stacking for the most part, and we aren’t the best at coding. but for the match loads, we’ll have fully autonomous stacking.

How do you use the values in an array in a competition program?

If you have a


conesStacked

variable


height[conesStacked] 

is the correct height to lift

@tabor473 so if conesStacked = 10, then it would take the 10th value in the array height?


height[10]

(which equals


 height[conesStacked]

assuming


 conesStacked

is 10), it would return the 11th value since the first value has index 0

I see! Thank you for the clarification. So height[0] would return the first value, height[1] would return the second value, and etc.