CodeBlocks drive question

I am trying to create a simple acceleration/deceleration block “function”
What I want to do is to have be able to set a slow starting velocity and then ramp it up to 100% until the robot is about 2 inches from the target distance then ramp it back down to a slow speed.

Here are the issues:

  1. There is no way to grab the distance traveled from the “sensing” blocks. The “drive rotation” and “drive heading” both pertain to the gyro not wheel turns. I could easily do a rotation / 200mm to get distance except I don’t see a block that can read that.

I know I could setup each motor and the gyro separately and then make my own drive routines but I’m working with 8 and 9 year olds and I don’t think I could get them to understand the logic required and being an IQ competition I can’t do it for them. So lets ignore that option.

  1. You don’t seem to be able to change the drive speed once a drive command is issued. I know you can reissue the “drive forward” command after a “drive forward x distance and don’t wait” but this overrides the distance and as mentioned above there is no way to sense distance.

Here is a sample acceration/deceleration code block
Accerate.pdf (2.3 MB)
This works great for speed but you can not get the distance traveled. And due to variances in the acceleration time the distance it does travel is slightly different every time so you can’t even use a wait time!

1 Like

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