Manual - autonomous


#1

hi
i need help to make my robot (Vex iq) coded to when the bump sensor is hit the controller signal stops working and robot goes forward


#2

In with your other driver code, check the sensor, and if it’s pressed stop the other motors and perform a blocking section of code that drives forward a bit, then releases control back to the rest of the loop.


#3

Capture

how do i make it stop signal?


#4

You want the Controller (joysticks and buttons) to be ignored sometimes, but still be usable otherwise? If this assumption is correct…

To restate, you want the Drivetrain (or individual driving motors - can’t use both modes, afaik) and also other (like Arm) motors to conditionally use either input from Controller or from other sensors. (The Controller is a collection of sensors…)

If it’s just the drivetrain you might get by like this:

37%20AM
If the Controller is being used for other motors, you could “latch” the “state” or “case” of responding to Controller input on or off.

Lots of possible ways to do that, I think. I would use a variable and "if"s.

“if bumper down” could set the variable to “2”. Completion of move could set the variable to “1” and return to Controller input.

Then under the Drivetrain (or Motors) define the forward move inside the “if” of an “if-else”.

If (variable == 2)
{
  do move 
}else{
  use controller
}.

How the bot responds to the Controller goes in the “else”.

Can’t use the Controller config built-in to the Drivetrain config - must code all Controller actions explicitly.

so:
40%20AM
and
24%20AM
might give you some ideas.

Note that your example broadcasts “CONTINUE” as soon as bumper is released, presumably before “GOFWD” is completed.

I’m sure other Modkit users have better suggestions, if my assumption of your goal is correct.

And please correct me if I got any of this wrong…


#5

Thanks the info is helpful but you did get the ‘continue’ part incorrect it is after GOFWD is complete if you have any more ideas please send.

Naff


#6

Ah well, from the code example you gave, I believe as long as the bumper is pressed, “forever” loops through, broadcasting “STOPSIGNAL” and “GOFWD” repeatedly as fast as the brain’s clock runs. Before and after that - whenever the bumper is not pressed - “CONTINUE” is repeatedly broadcast.

I understand broadcasts to be non-blocking, and so take very little time to send.

said it perfectly (my emphasis)

Anyone else, do you know how long the clock cycle is?

If you want more specific help, show us more of your code.