Adding a new C++ library

So I wish to add an old speaker onto a new V5 robot. Of course, I can’t do this out of the box. However, the only limiter (apparently) is the lack of a digital to analog converter in the code. So would I be able to add a library (I’ll consider the rules later, I jsut want to do this as a little project) that could handle the conversion for me?

The V5 has no analog output, so you won’t be able to get the signal out

The speaker though can connect through the legacy port. It requires you editing the app, but as far as I can tell with the right software it can work.

https://microchipdeveloper.com/mcu1101:project-11

Whatever they’re talking about here is a possibility. I’ll check it out more later. It’s written in C though, which I don’t know if it can communicate with C++ (I’ve been a python user, just getting into C++ for unreal engine)

From the horse’s mouth: Adding a speaker to a V5: my journey - #2 by jpearman

If you really, really want to “decorate” your robot with sounds, then buy one of those cheap voice postcard thingys that let you record a few seconds of sound and then play it back with a press of a button. Then you could cue them with digital output pin, one from each V5 legacy port.

Or, if you know how to program Arduino sound shield you could control start/stop of multiple sounds from one or two legacy pins.

As long as inspectors see it as unobtrusive decoration that is in a good taste, doesn’t affect robot performance, and doesn’t interfere with other robots, you should be fine. But be prepared to take it off if they find it somehow functional beyond decorative purpose.

3 Likes

That would be really cool actually thank you

Ohhh, I doff my cap! Really nice idea. Until someone rickrolls at the end of auton…

Can we ignore the rest of this thread? I would like to add some libraries to the Vex program (vexcode c++) how do i do this?

You could possibly create a header file (or files) and copy and paste lots of stuff

What if the libraries are not open source?

Effectively impossible? What are you trying to do?

To use a non-open source library in this case that library would have to be compiled for VEX V5, and be given to you as a library binary along with header files. Then you would need to tell VEXcode to link against that binary, something I am pretty certain it won’t let you do. This is possible in PROS at least but still requires only libraries made for VEX V5.

4 Likes

Ah. I’m jsut trying to install some linear algebra, vulkan (idk if that will work), and possibly machine learning libraries. Idk much about c++ libraries yet as I have not used any of them besides the standard library so

VEXcode V5 Pro can link any library as long as it’s been built for the V5 architecture.

7 Likes

Ahh thanks. I didn’t think it wanted you playing around with makefiles and stuff without editing them outside the IDE.

1 Like

Vulkan is a no go. Making any proper machine learning library work is effectively impossible, for a lot of reasons, size and cross compiling support being just the tip of the iceberg. Maybe one of the especially small ones, or “lite” versions could, with a lot of effort, be possible.

If you want a linear algebra library on a VEX robot I am going to strongly suggest you use Eigen. It is made to be easy (and thus possible) when you need to compile for any platform.
https://eigen.tuxfamily.org/index.php?title=Main_Page

5 Likes

It’s possible, but not pleasant, to do.

1 Like

+100

If @UvuvwevweOnyetenye decides to choose this path, see this post: Eigen Integration Issue - #7 by jpearman

3 Likes

Thank <20characters>

Just adding a pre-built library is easy, for example see this project where I just added pre-built lvgl library.

All that was needed was to add the library to the ones being linked by adding

-lv5lvgl

and , in the case of that project, letting the linker know the library was in the project root folder by adding " -L." to LNK_FLAGS.

changing a VEXcode project to both build a library and then use it in other programs is a little more work, but really no more than any other development environment.

4 Likes