Hardest Programming Projects

I’ve been pretty bored these past few weeks. I’ve been wanting to program some crazy things for my VEX robot or anything in C in general, but VEX related is better so it’s more worth the time. Anyways, I haven’t been able to think of anything to do. I want some projects that will push RobotC to its very limits. I would appreciate if you all could list some hard yet useful (ish) projects to work on.

So I was talking this through with some people and had some ideas. Just to judge the difficulty to assign you, what is your familiarity with

Position PID?
Velocity PID?
Tasks?
Calculus?

How about some Fuzzy Logic control of motor speed or position?

Well, for VEX related, one neat thing would be to program a VEX bot using a different microcontroller then the cortex. It wouldn’t be RobotC obviously, but you’d learn a lot about embedded systems development and circuits. It would teach you the stuff RobotC does behind the scenes.

If you want it slightly easier, use an Arduino (ATmega chip). If you want it slightly harder, use a different development board (like MSP430G2, Beaglebone, or some such thing). If you want it really hard, just buy the chip only (in a DIP package) and do a breadboard setup. Super hardcore would be use assembly language instead of C.

The downside to this project is you have to buy some extra hardware. A board (~10 dollars), single jumper wires MM and MF (~5 dollars), breadboard (~2 dollars), resistors/capacitors/components (~5-10 dollars). Your Vex batteries would work just fine, you may want to try different motor controllers however (~5-10 dollars). See this: VEX + Arduino Control -- Best of both worlds! - SparkFun Learn

For non-autonomous programming, you will need some radio hardware. There is also a lot to be learned if you implement your own radio with A/D converters and dipole antennas at a low frequency. Thats a separate project though :wink:
(P.S. if you do that check the FCC’s allocations for legal frequencies)

Something I’ve been working with on and off would be implementing Promises/A+ for my autonomous programs. That way, my autons would look like this:


robot::drive(36)
    .then(robot::armUp(), robot::turn(180))
    .then(robot::mogoUp())
    .then(robot::mogoDown())

And so on. (I’m implementing it with C++ PROS, but you could do it with ROBOTC)

I’m able to do position PID pretty well. Everything in our autonomous involves PID based movements with autocorrection for over or undershoot. Velocity PID I was never able to figure out. If someone could link or provide a description, that would be great. I just didn’t understand what to do since you want the motors to stay at that speed once they reach the target speed, not go to 0. But with traditional PID, or at least what I think of when someone says PID which is position PID, the motors would go to 0. Tasks I would like to say I have a pretty good handle on. Calculus I have not yet taken, or even pre-calc for that matter, but throw anything at me. I want to learn. :slight_smile:

That’s something I’ll start looking into today. Thanks.

I’ll look into this. Could you recommend some good quality yet cheap microcontrollers other than the Arduino?

This sounds interesting. I’ll take a look at it. Thank you everyone for these suggestions. Keep them coming. Hopefully others will benefit from these projects as well.

Velocity PID is just one domain higher, so you get rid of the integrator and instead integrate the entire thing.

If position domain PID is:
output = kperror + kiintegrator + kdderiv
then velocity domain PID is:
output = output + kp
error + kd*deriv

And adding on to what MayorMonty said, I am currently working on a PROS library (nothing tested yet until I get back to school). Documentation here: okapilib.github.io

I personally own a MSP430F5529LP kit and I like it a lot. Thats about 20 bucks, so its a bit more expensive. The actually chip is a surface mount package though so its non-removable for a breadboard setup. If you want a cheaper but similar option, the MSP430G2LP kit is a decent option. It comes with 2 chips, both are removable and DIP (breadboard compatible) package. It is $10. I’d probably recommend the MSP430G2 if you want cheap. It is slightly less powerful than an Arduino Uno. The F5529 is actually more powerful than an Uno. Remember, with Arduino, a lot of what you pay for is the brand, infrastructure, and community.

The MSP430 line in general from Texas Instruments is good for low power, cheap applications. The datasheets and family guides are pretty well done, and relatively easy to follow. There is also a thing called “Energia” for those chips, which is an easy way to program (based on Arduino IDE). I haven’t personally tried that though, so I can’t say much about its quality. I’d reccomend you avoid using Energia though, you’ll learn WAY less (its basically just arduino IDE) but I guess its always there as a backup. Use Code Composer Studio, its based on Eclipse and its just raw C, no libraries or anything but it gives you good debugging tools and makes linking pretty easy.

If you already have an arduino board, you can set it up as an in-system programmer (ISP) for other Atmel chips, like the ATMega or the ATTiny, both of which you can pick up in relatively large quantities for pretty cheap. They also come in DIP packages (i.e. with breadboard-compatible pins), so they can be put just about anywhere.

1 Like

On the topic of programming, is there a way to program our vex robots in Python? Or is it only C and C++ ?
Thanks,
Atlantis

I believe that RobotMesh uses python

It isn’t much different in price than an Arduino, but BeagleBone is another option.

This is incorrect and a misnomer that floats around this forum for ID and controls. You do not add the output to the output, the integrator term builds up to hold your speed. I did a complete derivation of this on the forum during the NBN season:

link text

link text

Here is an interesting challenge,

Enter this contest using VEX…

Indeed Robot Mesh uses Python in Robot Mesh Studio. Let us know if we can help you get started.

Okay so lets get started. We can take a look at

A book from Caltech explaining PID which has an entire section on Velocity PID.

https://puu.sh/xaMRf/4e87f5c00f.png

https://puu.sh/xaMTL/f086342c7e.png
u(tk) is control
delta u(tk) is change in control that PID produces

Simple explanation,
If you plug position errors into the PID equation you get control values out.
If you plug velocity errors into the PID equation you get velocity of control values out. Just took the derivative of both sides.

Now to actually get control values we have to integrate.

Using motor += PID we get the following behavior

only P causes either oscillation around the goal state or undershooting the goal state
I can be used to reduce steady state error caused by P undershooting

That is PID behavior.

You just made my point, the integrator is in the equation. Although I find it funny that we are talking about velocity and they are calling it a “stationary” value.

Besides, in my examples I am taking the velocity directly from the sensors but taking the distance per unit time. It is perfectly legitimate to use that velocity in a PID algorithm.

I showed the derivation in the thread for a few years back, it is simple and proves the point.

I don’t want to hi-jack this thread, so if you want to discuss this offline we can.

The equation
motor += PID
is doing the integration they refer to
motor = PID
is not.

Stationary value in this case is that the velocity is not changing. Stationary value, not physically stationary system.

You need to take the output of PID and then integrate them. I showed you the graphic that says “external integrator” and the text saying

Which says that PID outputs the change in control variable not that actual control variable.

Think about it this way

Output = pid of position
Now take the derivative of both sides
change in output = pid of velocity

If you say output = pid of velocity, you only changed 1 side of the equation.

Like I said, we take the velocity directly from the sensor by subtracting past counts from present counts on the sensor every 20ms (example) so we have already taken the derivative with a fixed unit of time, dt. This 20ms, although it doesn’t have to, also acts as the time base for the PID integrator and derivative (if we choose to use one).

Given that,

output = PID

is the correct form and use for the velocity control. I could do it with apples, oranges, position, velocity, it doesn’t matter. I am using velocity in the error term directly, not position.

Ya so you took the derivative of position. (that is the definition of derivative). You did something to 1 side you didn’t do to the other side. That is like the only rule in math. The output of velocity PID is the velocity of the control value.

This has a pretty good explanation but I had been avoiding any links that tried to change the form the equations took.

https://puu.sh/xaPQn/db15063e16.jpg

See how it shows dO/dt. That is because we computed the changed in the control value