Odometry with Python

With how important aim is for spin up, my team was interested in learning odometry code. However, the only resources we’ve found with coding itself (not the math) is all based in C++. Our robotics program is not allowed to use vexcode pro (for various reasons), So we were wondering if it was even feasible to make odometry with python on normal vexcode with a high enough precision for the intended purpose.

you should try pros :))

1 Like

If you mean pros as in vexcode pro we’re not allowed to because our coaches won’t let us so…

https://pros.cs.purdue.edu/

They mean this. It’s C++, but it isn’t vexcode, different commands and all that. You will probably be better off coding it in PROS than in python. It’s definitely feasible, but i don’t know how hard it is to debug Python. Generally though you will have a better experience overall in vex with C++ than Python, especially when you’re running A LOT of code like our robot (since from what I see in the search bar, it says it’s actually running Python and not just compiling to C++ automatically or something) where performance starts to actually matter.

Note: on the forums, usually when people mention vexcode pro they say vexcode, say pros when talking about pros, and vexcode V5 (the block one) is usually just something with blocks in the name.

1 Like

Honestly,
I am quite curious as to why your coaches won’t allow you to use VEXCode Pro.
Anyways though, here is my VEXCode Pro project for odometry/position tracking:

You should be able to read through and use the code for reference as the difference between VEXCode Pro and VEXCode Python for the most part is simply syntax.

I don’t know why exactly, but the reason they give us is so we can help the middle school teams when we mentor them (They use python as well). One of our teammates knows how to code in both. He asked if he could use vexcode pro and still help the middle schoolers, but they still said no. Thank you for the help though.

1 Like

You should be able to make odometry work just as well with vexcode python as with anything else.

I don’t know why everyone else in this thread failed to answer your actual question.

10 Likes

I mean that’s a matter of opinion. They are different experiences, use the Python REPL and some would argue that debugging in Python is easier.

Absolutely, I see no reason why not.

14 Likes

There is some confusing terminology going on here. Basically, there are three platforms you can code in:

  • VEXcode V5
  • VEXcode Pro V5
  • PROS, which uses VSCode

With VEXcode V5, you can program in Blocks, Python, or C++. With VEXcode Pro V5, you can program in C++. With PROS, you can program in C++. If they are actually banning you from using the VEXcode Pro V5 app, you could program C++ in VEXcode V5, but they probably wouldn’t like that if their intent is to ban you from using C++. I’m not sure why they would

when he offered to help anyway. It seems like you could help the middle schoolers with the important thing, logic, without knowing much Python.

4 Likes

I honestly don’t understand, why do people keep bashing python? There is literally nothing wrong with it. In fact, if there were no other advantages of PROS, I feel like most people would prefer python over C++ because of its simplicity and ease of use. The reason why I, along with many others, use PROS is because of its access to libraries like Okapi, not because C++ is somehow superior to python. In fact, here are some advantages of python I can think of off the top of my head:

  • Often regarded as the most popular programming language
  • Used almost exclusively for machine learning purposes
  • Extremely easy to learn & use but still good for advanced users

Obviously, there still are numerous advantages of C++, but I feel like many students are getting misled by people on the forums ranting about the inferiority of python.

4 Likes

In the land of the blind, the one eyed man is king.

Though unfortunately, I don’t even think someone with half an eye exists in the forum.

4 Likes

This is similar to the Windows vs MacOS vs Linux wars. Everyone insists that whatever they are comfortable with is “better”. Generally speaking, in the past C++ was regarded as the only way to program machines based on microcontrollers because it was lean, compiled (vs Python that was interpreted) and worked the best with boards with limited processing (8bit processors and tiny amounts of memory). VEX is a learning platform though. The V5 brain is literally OP compared to the board in let’s say your smart thermostat. Also, things started blending, the V5 brain does not use the interpreted Python of the past but rather microPython, which is a version designed specifically for controlling automation based on tiny microcontrollers. It is compiled before it gets to the part of the brain that sends commands to the motors. In that sense, both languages do the same. It’s like giving someone directions to a place in Japanese or Russian. If you understand the language, you get to the place just fine. C++ is more industrial oriented, Python is more of a general purpose language. We use Python because there are kids on our teams who are not necessarily looking into an engineering/automation future and Python is used in finance and everywhere else. The idea is to spark the interest and make robotics fun not to force/enforce. Our gravitating towards Python was organic, not forced by teachers/coaches. But we try to use both as sometimes we collaborate with other teams in the area and their coder codes C++ and we share some silly arc code or what not. It’s a great way to make people understand the language itself is just a tool not a destination. Left - right, black - white, we are soooo conditioned to chose sides. Just like you don’t need Microsoft Word (as the “professional world” strongly believes and will fight you over it) to type a paragraph of words. The editor in the VEX forum can achieve the same exact task, it even has a spellcheck and a dRow. So what you do is you code in what you love and are comfortable with and you show your coaches your progress. Then learn how to convert your code to Python to keep them happy. You can’t fight them so join them and also profit for your own sake. It will be easier with a well working code because you will have a frame of reference and will be able to debug easier. It’s a win-win for you, all of a sudden you’re bi-lingual.

3 Likes

Moment of silence for the still useable but no longer offering support Robot Mesh Studio :cry:
https://www.robotmesh.com/studio

I do almost all my programming in python these days, and have for years, but I don’t really think you are being fair with these points. Most of them have to do with the amazing ecosystem of python packages that exist but are not useable with VEX. So pythons ease of use and general popularity is cool, but the popularity doesn’t really benefit you when you can’t google a solution and find useful result. (every stackoverflow response will call libraries)

See my more indepth post on the subject here

There can still be a benefit to using python, its syntax is cleaner and a bit easier to pick up. It reads a bit more like human speech (by design) so skimming the logic is easier. I do agree the forum has an issue with blindly telling everyone to leave X to switch to PROS regardless if that is their actual question. All the really serious programmers on the Discord find that behavior pretty toxic.

9 Likes