I have to create an autonomous code but I am unsure of where to start please help
What language were you programming in? What is your current code? What plan do you have for autonomous?
I am coding in vex c++ on vex coding studio. My current code so far is: DRIVE1.startRotateFor(1000,rotationUnits::deg,50,velocityUnits::pct);
DRIVE2.startRotateFor(1000,rotationUnits::deg,50,velocityUnits::pct);
Right now all i want is to make it drive forward
So you put that in the place that says void autonamous{ in your main file.
Then to run it all you do is instead of clicking “run” on your controller you click timed run, which will run the auton
Some may be insulted by this statement but a majority of our teams use blocks to create their starting code. They are up and running in 15 minutes with driver control and autonomous.
Our advanced teams use c++ as their needs become more complicated.
If using VexCode Pro, have you considered using a drivetrain?
Yeah you need to setup a drivetrain in the program to make it easier to make an autonomous. Click on the devices/ports tab and make a drivetrain there. Then whenever you want to move you can use the drivetrain setup like
Drivetrain.movefor(direction,value,units);
Or something like that dm me if you need some help
I’m a huge proponent of this. I had a team meet on Wednesday that was able to build two different auton (rush to the center, grab a goal, return back and clearing the line of the alliance goal ) in about 30 minutes with blocks.
“But Foster,” people say “what about all those years of snark on Easy-C” . Back then Robot C was my choice. It was dirt simple to write robot related code. The API was easy and the interface to the C language was very simple and clear. Easy-C had some wonky problems with the blocks that sometimes made for unhappy code.
In today’s environment the two block language development tools are pretty sweet and well above Easy-C. I like Robot Mesh, the block choices are really good and they are simple to snap together. I’m also finding the new crop of roboteers have used Scratch or a phone app builder based on a block language.
But back to the problem @Bonkers_0 has. Sometimes if you write all the steps down, on paper, one step at a time you can make the problem simpler. Things like “Roll forward to the center goal” become “Move forward 6’” which then become (umm 4" wheels need to rotate 3 times to move a foot, so that’s 6 full rotations) and break it down that way.
@Hudsonville_Robotics has a point, there is some API sugar that helps, the drive base is one of them. You should try to leverage them as much as possible. (Although you at some point need to learn how to do motors that face each other and drive a common shaft, sadly there isn’t a way to have a second drivebase to manage that. )
I would say just to make a function that lets you move. I did a spinf and a spinr function (spin forward spin reverse) that saves me two lines and a lot of time. You just have to specify the variables in the parenthesis.
Void spinf(motor_group,y,z) {
motorgroup.spin(forward, y, pct);
Wait(z,sec);
Motorgroup.stop();
}
Then another one for reverse
I would recommend vexcode
switch to vexcode, vcs has been unsupporteed
To briefly address the psychological impact from a perspective of having mentored coders who were routinely inadvertently subjected to counterproductive and inappropriate time pressure by their peers, I’ll switch to plainer English: until you’ve coded a robot, you have no concept of the personal investment of time and energy into learning, designing and bug chasing. A number of ubiquitous cognitive biases are at play, but the simplest to recognize might be the availability heuristic. “You’re surrounded by robots with auton, so just do it like they did.” Well, you absolutely can do it when you’ve done the necessary things your colleagues haven’t made the effort to perceive. They might have written code to do other things in class and feel they know how to code. Robotics is a peculiarly and invigoratingly challenging domain, at least partly because everything that happens is an invented combination. I spent a lot of years earning my crust by climbing on footholds of really cunning code, and when I started working with robots, I learned whole new ways to be cunning during the process of developing the code. As with any complex piece of work, persuade yourself to relax and look at every piece of information that links to the problem and spend time finding out what links to what and how. And start simple. Push the alliance goal off the line from an easy spot and start to build confidence. You’ve got some great coding and design advice from Foster and the gang. Create the mental space to work through it at an even pace.