Drivetrain coding issue

Our team’s robot can drive, it just goes fast and is difficult to control. I made code that told the robot to slow down from 75% max velocity to 40% max velocity. (I was in a rush, it is in block coding so I don’t have the correct syntax. This code kept making it so that the drivetrain would only go forwards no matter the direction of the joystick.

If A pressed
set max drivetrain velocity 40%

1 Like

Can you send me a pic so I can detect the error

With a piece of code like that I think you would have to be holding down button A to go at your 40% velocity. I would test this just to make sure.

However, if your robot is going too fast, I think a better solution would probably be to change the gearing and/or motor cartridges on your physical drivetrain.

1 Like

This is what it is. The issue is that it makes the drivetrain only go straight.

image

This is block, I am on chromebook and can’t do anything else. This code make the drivetrain only go fowards.

i think you need to do a block that says go forwards or backwards as well, all that you did was tell the code that when you refer to the drive train, it should go at 40% power. (that is how it is in text code, and i think it is the same for block code)

1 Like

I am not following you. It moves around like normal without this block of code. Can I have a picture of what you mean, please?

image
this is code in text, you have the if statement above, one line seting the velocity, and the next telling it to spin forwards.

2 Likes

What is ‘Right’?
(20 characters)

G I think you might need a if else statement with the else being stop ___

that is the motor name

oh, sorry, i re read the post, and what i was saying doesnt help, sorry

Do you have all of the motors formatted here as a drivetrain, or separate.

It is ok, my mentor is guessing that I would have to manually program the joysticks and such to make this work.

can we see your drive code? (i can help)

I would change it but this is more for precision stuff, so I wanted to change it momentarily.

do you have the actual code itself?

No, it is just a section in the top right the auto formats it for you.

but like the driver controll code? the part that moves the robot?