Trouble with Rapid Relay Autonomous Code

Hi!
I have 2 middle school teams and both are having the same issues with their autonomous code.
The codes my teams have written will go to their first position, launch the ball, and then stall. They cannot get their codes to work. They have tried multiple fixes and at one point asked our coding teacher to take a look at it and see if he could give them some insight.
When the robot stops we can still hear the brain whining like it is running the code. The teams are using the basic swish at the moment. One team has added 2 optical sensors.
Is anyone else having similar issues?
Thank you in advance for any help you can give!

Can we get pictures of your code?
And does it work when using the controller

We are going to need more specifics, namely what is not working, and as @Joeboticswastaken said, If it works using the controller. Some pics of the robot would also be helpful

1 Like

It works fine with the controller. Here is an image of the beginning of the code for one team. It moves, fires the first shot, then stops.

Here is an image of the beginning of one team’s code. This is the code they used at tournament. They have continued trying to trouble shoot it with no luck.
The robot works beautifully with the controller, so I don’t think it is a robot issue. I think it is in the code. Both teams are having almost identical problems.


So, right here is what I am guessing is the shooting. Then catapult may be spinning the wrong way. So forward could be going down, and Reverse could be shooting. Try reversin the motors, or just changing the reverse to a forward and the forward to a reverse.

2 Likes

Is the direction wrong? is it running into the goal rather than moving backwards? Or is the stall time too low?

If it is “launching the ball then stalling” it may be that the catapult motor can turn enough to release the pawl, but not a full 90°. If it can’t make the full 90° rotation it will keep trying.

There are a couple ways it can be solved. First you could try reducing the amount of rotation to whatever it rotate. Another possible solution would be to put a motor timeout in the ode where you are setting the velocities, etc. What that will do is essentially tell the motor if you can’t complete your task in X time, just go to the next task.

Personally I’d go with the 2nd solution as the first try, because if that works, you then know it was never completing that step rotation step. .

1 Like

not necessarily. So right here, the block seems to say “Spin catapult forward.” That could mean spin catapult down, instead of spin catapult release. So, right now, the motors could try as hard as humanely possible to go down 90 degrees. But it can’t, because since the catapult is already down, is physically cant. And since you don’t have an “and don’t wait block” behind it, it can’t move on with the code until the previous condition is satisfied.

2 Likes

OP, did your teams ever get this fixed?

I think it is timeouts. It might be that your robot wants to do something, but it cannot. the robot will keep trying to do said task indefinitely, unless there is a timeout. to test this lift the robot up to see if it tries to drive, or push the catapult mechanism to see if there is resistance.

We will do this today and get back to you! Thank you for the suggestion!

Not yet. We are making progress. One team has been successful at getting the robot to continue driving after the initial launch of the ball, but the catapult still will not go back down. We are using all the suggestions in this thread and documenting each one. So far, altering the degree of rotation has helped, but not adding the wait block. We are going to try reversing one of the motors next.

A team I know had a similar issue, & reversing motors helped. We also had to add more wait blocks.
Would love to know if your robot starts working, as this is a really common problem from the teams in our entire district.