Matlab vs. RobotC

My team is considering switching from RobotC. I have looked over some of the Matlab resources, and my mentor is a fan of Matlab (engineering background). Could anyone offer pros vs. cons of using Matlab in VRC?

Thanks is andvance!

1 Like

I too would be curious if anyone on here has tried the new simulink for vex environment.
One downside of it is that you won’t find very much support from the community since it is new and not very widely used (if at all). With the V5’s advanced features like vision processing and better opportunities for control loops, it might make a lot of sense to use matlab/simulink

1 Like

I’ve spoken with the MATLAB representatives, and our competition team is excited to try out Simulink. From a control systems perspective, it’s great because you just describe the control system. From a learning to code perspective, it may not be the best since it’s basically entirely visual (I mean you learn the logic, but whether or not it’s the same thing is debatable). That being said, MATLAB/Simulink is powered by PROS and I’ve been told you can actually export generated Simulink code and use it in your own codebase if you wanted.

1 Like

This is correct. As soon as I looked at the generated code, I immediately recognized it as PROS code. However, the generated code is far from optimized (one does not need 20 files of rather unreadable code to implement a basic tank drive).

I have tried it, and I am not a fan. As far as I know, the support package for the VEX Cortex was originally made for BEST and more recently brought to VRC with free sponsored licenses for VRC teams.

Overall, the setup is very restrictive. One major feature that I could never get working was partner controllers. By default, the appropriate option is grayed out (adhering to BEST rules), but it is unclear how to enable the option. There is also next to no documentation on anything besides the absolute basics (which are simple enough to figure out just by looking at the example models and playing around).

It should also be noted that there is absolutely no form of realtime communication between Simulink and the Cortex – not even a basic serial terminal, let alone advanced graphing features.

Given all of this, I would have to advise creating your own code (especially in PROS) over using Simulink with VEX ‘support’

  • The majority of features in MATLAB/Simulink are not available for use with VEX, so you’re not really going to be learning how to use the applications.
  • You’re certainly not learning how to code (technical definition)
  • Being able to represent your program in flowcharts is, arguably, a valuable skill, but many aspects of the VEX ‘support’ are so unintuitive and undocumented that I don’t think it’s worth the effort to use Simulink for flowcharting
    Why.PNG

If your desire is to learn coding, use PROS. If your desire is to simplify things, but have actual C generated for you from putting in the logical steps, use Matlab. If you want to learn to code with training wheels that explode when you take them off, use RobotC.

I dont have much issue with ROBOTC exploding. To each his own, I guess.

It is not that robotC will explode, but the training wheels explode when you take them off. In other words, RobotC has you do things in ways that are not normal with programming. You learn things that are not best practices. It is fine so long as you keep using the training wheels (keep using RobotC) but transitioning from RobotC to C or C++ or some other industry valid language is a bit more of a learning curve than if you learned to program in C from the beginning.

Having just completed a two MATLAB projects for my course and have experience using the simulink environment I can say I do not recommend it. This is personal preference as I am not a fan of the software (yes I know I should love it as a maths student) MATLAB is incredibly unintuitive and the learning curve from robotc from what I hear is frustrating. I must agree with above that you should try PROS.
All that being said, MATLAB is a very powerful tool and some experience with it (even in the simulink environment) will help. I dont know about other countries (perhaps someone could fill in), but in the UK MATLAB is used in almost every technical degree. As with all things everyone has a favourite and I do urge you to try it out and make a decision. The competition season is after all a long way off yet. :slight_smile: good luck

Same in US. Having experience with MATLAB/Simulink is pretty valuable, not sure how useful the experience gained from using it for vex is though. Of course, knowing C is also a useful industry skill

Would you mind giving a few examples? Not that I don’t believe you, but I’m going to be a Computer Science major and have mainly used RobotC (and a little PROS) to do my coding thus far.

Same here. I also believe you of course, I just want to know how big major the differences are so I can decide if it’s time to switch.

While MATLAB/Simulink is very good for developing and testing control algorithms and performing various graphics plots, it is not a general purpose language that can be used for real-time control of Vex robots. You can use MATLAB’S serial port to send motor commands and receive telemetry from a Vex Microcontroller but it does not have all the tasking and control and interrupt capabilities that Robot C or Easy C or PIC18 C has.

I love MATLAB for running simulations and doing some cool modeling. Invaluable for my career.

I don’t find it’s VEX part useful for VEX Competitions. It’d be better as a supplement for testing some control algorithm or supporting processing with some sensor.

It generates and uploads C code that uses the PROS kernel so it does provide real-time control.

PIC18 C?
Also this a somewhat old thread that we are reviving

old school programming for the PIC V0.5 (and other old IFI control systems).

Team 81Y did some Matlab work this year for PID tuning. The data rate they were able to get out of the Cortex led to a bunch of manual work to smooth that data out in Matlab.

So buyer beware, you may be in for a bit of grunt work before you can use the real power of Matlab.