Catapult locking, no sensors

We are trying to program a catapult (slip gear) to pull back, stop, and then fire at the press of a button on the controller. How would we do this without using any sensors?

I guess every time you turn it on you need to insure it starts at the same position, unless anyone else can think of anything .

I will start by saying auto pullback is impossible without sensors. However, you seem to neglect the existence of internal motor encoders, which can be used to achieve this. The math for this is slightly more complicated than if there was a rotation sensor on the cata but it should in theory be possible.

3 Likes

Yeah, we tried this but the math really wasnt consistent. Just checking to see if we were missing something. I was hoping there was and easier way, but we’ll just go through the process of taking apart our catapult

i know you said no sensors, but if the limit switch is NOT included in that (i don’t know if it’s considered a sensor as much as a switch), then definitely use a limit switch.

I assume the issue with internal motor encoders is the fact that there are inconsistencies with where the motor starts. To my understanding, the hardest part about programming a slipgear without additional sensors is the “free spinning” time where the powered gear is not in contact with any teeth of the other gear. Theoretically, you could write code to reset the internal motor encoder every time the torque measured by the motor passes a certain threshold, as I would assume the torque is distinguishably different when “reloading” the catapult versus firing the catapult. This would allow you to know when your motor is pulling the catapult back, and you can calculate how much to rotate from there. Hope that helps.

Its been a while since I’ve replied to this and I have confirmed this works. After switching to a new robot and in a time crunch to a big event we didn’t have time to add a rotation sensor so I had to make it work without it. It’s surprisingly consistent and works much better than I thought it would. Here is my code:

        // store position of catapult
		float pos = cata.position(degrees);
       //set the position to the modulus of position and 720 to make it within 0-720
		cata.setPosition(fmod(pos,720),degrees);
        //detect whether the cata is free spinning
		if((cata.power()>0.05&&cata.power()<1) && cata.velocity(pct)>20){
			cata.resetPosition();
			std::cout<<"resetPosition"<<std::endl;
		}
		
        if (Controller1.ButtonX.pressing() || cata.position(degrees)<590)
		{
			cata.spin(fwd, 12, volt);
		}
		else
		{
			cata.stop(hold);
		}

The way this works is by resetting the position whenever the cata is free spinning so as soon as it stops free spinning the position will be 0. Then the number of degrees needed to be pulled back is consistent.

4 Likes

Thanks for this! I have a couple questions on how this works:

  1. Why do you set the max position to be 720 degrees?
  2. Why do you find the modulus rather than using a function like std::clamp?

Thank you so much!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.