VEX Visual Studio Code Extension

On Ubuntu 20.04 device detection and serial coms will work, but you need to add a udev rule that allows each device(V5 Brain, V5 Controller …) to have permissions when connected to your computer.

The plan is to eventually document a generic version of this procedure, but it is lower priority.

4 Likes

The minimum udev rule you will need is.

# allow user rw access to serial ports
KERNEL=="ttyACM[0-9]*",MODE="0666"
5 Likes

Worked! Thank you @hphillips @jpearman

Ah, I see now. I had actually tried what you suggested (before you suggested it), but I had only done the step with Regedit, assuming that regedit would change the name of the user folder for me… I had found out very painfully after I restarted that this was not the case →

yup.

1 Like

I’ve had a few teams who are using M1 Macs or Intel Macs download VS Code and when they try to install the extension it just continually hangs and doesn’t complete the extension. Is there a reason this occurs?

Does this happen when you install other extensions?

I have a M1 Mac Monetary and I have downloaded the VS Code exetntion. So it does work.

1 Like

So just to clarify, did the extension hang during installation, or did it successfully install and then hang once the extension started to run?

If the VEX Extension installed correctly, it should appear in the installed list as shown below. You should also see the VEX side bar menu icon.

If the extension is installed and running then it may be the runtime bug we found, see below:

I should be releasing a new version of the extension in the next few days that will address this problem.

If you continue to have problems, DM me and we can dig into the issue further.

4 Likes

It was hanging during the installation. We did not encounter the case where the VEX extension icon showed on the side bar menu.

Set up a GitHub repo and enabled all the git stuff to work with VS Code. Set up 2 laptops. Cloned the repo. Started playing with changes, commits pushes and pulls to understand the process. Placed a *.json line in every .gitignore file available. However, every time we do a pull from the online repo, it brings every project file into the laptop’s directory, including a settings.json file that is inside a .vscode folder. That file has a line “python.analysis.stubPath” that lists a local directory on the laptop which includes a user path. If that path is incorrect VS Code says the project is not a VEX Extension compatible one. Closing that project and reopening it fixes that by changing the settings.json file appropriately but then versioning control screams that there is a change that needs to be commited and an annoying loop starts. How do we handle that?

EDIT: apologies for changing the post twice.

files inside the .vscode folder

yea, that’s specific to the laptop (or rather vscode workspace) used, just don’t commit that to the repo.

6 Likes

Thanks. I think our issue is related to the fact that if you add a file to .gitignore after you added the whole project to git, your gitignore setting is… ignored. Man, git is like an entire new world. You can do it this way or that way or the other way. But don’t bother because you will be ignored. Time for some deep Google dive. “Read the game manual” and “search the forum before posting” - not working.

yes, you need to un-track the file. I use a git UI called tower, they make it reasonably easy.

6 Likes

Thanks again. Got all deep in git commands and missed your (super fast as usual) answer. Will definitely check out Tower.

Ended up doing all that by hand with this CLI command:

git update-index --assume-unchanged [file]

where file is every .json that we wanted out of the index.

EDIT and the commands from your tutorial linked above which re-do the index:

git rm -r --cached .
git add .
git commit -m "Fix ignore unignored ignore files for good"
1 Like

I installed the VEX Visual Studio Code extension and already had all of the other extensions pre-installed. An issue I am facing is that that the header file vex.h is not found after being included in main.cpp, and it also says (weirdly) that math.h is not found either in vex.h itself. What is the issue and how should it be fixed?

It probably has to do with the c_cpp_properties.json in the .vscode folder.
I will dm you so we can work through this.

3 Likes

Hey,
I’m having issues with “multiple definition” errors when building the project.

I am getting the below error for each of the motors and the controller:

build/src/drive_funcs.o:(.bss.Controller1+0x0): multiple definition of `Controller1’
build/src/main.o:(.bss.Controller1+0x0): first defined here

Important Code:

device-defs.h:

#include "vex.h"
using namespace vex;

extern controller Controller1 = controller(primary);
extern motor leftFront = motor(PORT4, ratio36_1, false);
extern motor leftBack = motor(PORT2, ratio36_1, false);
extern motor rightFront = motor(PORT3, ratio36_1, false);
extern motor rightBack = motor(PORT19, ratio36_1, false);
extern void driveForward(float inches);
extern void turn(float degrees);

drive_funcs.cpp:

#include "device_defs.h"
#include "vex.h"
using namespace vex;

const float WHEEL_DIAMETER = 4.125; //inches
const float WHEEL_CIRCUMFERENCE = WHEEL_DIAMETER * 3.1416;
const float GEAR_RATIO = 1;
const int AUTON_DRIVE_PCT = 50; //motors at 50% velocity during auton

void driveForward (float inches){
    float inchesPerDegree = WHEEL_CIRCUMFERENCE / 360;
    float degrees = inches / inchesPerDegree;
    leftFront.spinFor(
        degrees * GEAR_RATIO, vex::rotationUnits::deg,
        AUTON_DRIVE_PCT, vex::velocityUnits::pct, false
    );
    leftBack.spinFor(
        degrees * GEAR_RATIO, vex::rotationUnits::deg,
        AUTON_DRIVE_PCT, vex::velocityUnits::pct, false
    );
    rightFront.spinFor(
        degrees * GEAR_RATIO, vex::rotationUnits::deg,
        AUTON_DRIVE_PCT, vex::velocityUnits::pct, false
    );
    rightBack.spinFor(
        degrees * GEAR_RATIO, vex::rotationUnits::deg,
        AUTON_DRIVE_PCT, vex::velocityUnits::pct
    );
}

I’m new to Vex VScode and don’t have that much knowledge of c++ so any help is appreciated!

This might be a better question to ask in a separate thread since this is a linker error with your user program and not a problem with the extension.

If you’ll dm me, I can help you out!

3 Likes

VEX Extension 0.2.0

A new version of the VEX Extension has just been released.

Change log

Features

  • Added Controller VEXos update support for:
    • EXP Controller
    • IQ 2nd Gen Controller
  • Added DFU device detection and DFU VEXos recovery for:
    • EXP Brain
    • EXP Controller
    • IQ 2nd Gen Brain
    • IQ 2nd Gen Controller
  • Added VEX Driver Installer(Windows only)

Bug Fixes

  • Fixed vexcom process environment to handle spaces in absolute path. This addresses the space in username bug.
10 Likes

Thanks for the response. I fixed the problem by importing an old project from the VEXcode Pro V5 app and then modifying the project to fit my needs. It seemed that the .bin, .elf, .map, or .o files had gotten changed somehow (which I can’t change back due to their file types) and importing an old project reset them.