VEXcode V5 Text Version 1.0.2 Release

We are happy to release version 1.0.2 of VEXcode V5 Text. It can be downloaded here:

New for this version:

  • Added feature for 4-Motor Drivetrain configurations
  • Added features and commands to support the new V5 Inertial Sensor
  • Added support for the new V5 Inertial Sensor to 2-Motor and 4-Motor Drivetrains configurations
  • Added support for Wheelbase parameter for gyro-less Drivetrains
  • Added feature to the “task” and “thread” classes to allow an optional parameter to be passed to callback function

Bug Fixes

  • Resolved an issue where the Feedback Tool may block certain types of email addresses from being accepted
  • [Windows] Resolved an issue where using “cout” or “printf” would not display in the Terminal window
  • Resolved an issue where projects would fail to build if the name of the project had special characters
  • Adjusted the Recent Projects list to only show the 5 most recent project to increase application loading speed
  • Added additional Simplified Autocomplete entries to support the “direction” parameter in “Drivetrain.driveFor” command
  • Improved error handling when a Vision Sensor signatures are not assigned
  • Improved error handling when a Vision Sensor signatures are named with certain letters

Some known issues include:

  • The Simplified Autocomplete functionality will be improved for the future releases
  • The “Accelerometer” device type is not showing up in Autocomplete
  • “Editor Font Zoom Reset” under “Tool” menu on Windows, resets to slightly smaller font than the default

As always, we appreciate any user feedback. If you come across something that doesn’t seem right, please let us know below!

10 Likes

Fantastic. With the move to supporting 4-motor drive trains, will there be future support for X-Drive/Mecanum-Drive trains?

3 Likes

Potentially… :smiley: - You can always use your own functions!

4 Likes

I am confused, VEXcode V5 Text is available for iOS and ChromeOS? This would be a first, but the download page does not reflect this statement.

Or is this statement for VEXcode IQ ?

2 Likes

My mistake, still only available for Windows and Mac for now. (That’s what I get for being lazy and copy / pasting the same template from the other threads)

I’ve updated the original post to reflect this.

5 Likes

Woah when did this happen

today - read new product announcements. $50 for joy!

3 Likes

I’m curious about the details of the DriveTrain class provided by Vex with regards to the Gyro/Inertial sensor. Would @jpearman (or other Vex staff) be able to describe how the DriveTrain class makes use of the Gyro/Inertial sensors?

2 Likes

A drivetrain that is created with a gyro or inertial sensor will use the sensor when the drivetrain is asked to make turns. The specific class member functions that use these sensors are turnFor, turnToHeading and turnToRotation.

Drivetrain.turnToHeading( 90 , degrees );

will turn the robot to a heading of 90 degrees (heading is like a compass heading now, 0 to 359.99 degrees). The robot will always take the shortest route to achieve the new heading.

Drivetrain.turnFor( 90, degrees );

will turn the robot 90 degrees starting at the current heading, that is, relative to the current starting position.

Drivetrain.turnToRotation( 500, degrees );

will turn the robot to an absolute rotation of 500 degrees, the robot may turn through more than 360 degrees to achieve this.

See VEXcode help for more information.

7 Likes

Thanks; one more question as I couldn’t find the answer via Vexcode help - does the driveFor use the gyro/inertial sensor to aid in driving straight?

I was wondering if you could give me an example for how to pass parameters to the multithreading/tasking Callbacks, I can’t quite figure it out.

Also followup question is there a functional difference between multi-threading or multi-tasking?

nope, we only use it for turns.
The drivetrain is just supposed to help you get started, especially in text, For advanced control you need to write your own code.

4 Likes

The argument needs to be a void *, here’s an example with some alternatives.

code
/*----------------------------------------------------------------------------*/
/*                                                                            */
/*    Module:       main.cpp                                                  */
/*    Author:       james                                                     */
/*    Created:      Tue Dec 10 2019                                           */
/*    Description:  V5 project                                                */
/*                                                                            */
/*----------------------------------------------------------------------------*/

#include "vex.h"

using namespace vex;

typedef struct _mydata {
    int para1;
    int para2;
} mydata;

mydata Mydata;

int taskWithArg( void *arg ) {
  mydata *d = (mydata *)arg;

  printf("taskWithArg %d %d\n", d->para1, d->para2 );

  return 0;
}

int anotherTask( void *arg ) {
  int *x = (int *)arg;

  printf("anotherTask %d\n", *x );

  return 0;
}

int main() {
  // pass a structure  
  Mydata.para1 = 9;
  Mydata.para2 = 28;
  task t1( taskWithArg, (void *)&Mydata );

  // if passing a local variable, make sure it doesn't go
  // out of scope.
  int  x = 8;
  task t2( anotherTask, (void *)&x );

  while(1)
    this_thread::sleep_for(10);
}

thread and task are essentially the same thing.

7 Likes

Gonna be real with you James, you are a lifesaver, half my code wouldn’t be possible without you lol.

4 Likes

I just looked at the commands for the 4-motor drive trains. I didn’t see anything for Mecanum-Drive. This would be an amazing feature.

Im not sure how much this will help but here is the code I wrote for our X-drive, Mecanum should be able to function using the same code.
P.S.
FL = Front Left
BR = Back Right
etc;

int DriveTrainCallback()
{
while(true)
{
FLI = Controller1.Axis3.position(vex::percentUnits::pct) +
(1 * Controller1.Axis4.position(vex::percentUnits::pct)) +
Controller1.Axis1.position(vex::percentUnits::pct) - Goff;
BLI = Controller1.Axis3.position(vex::percentUnits::pct) -
(1 * Controller1.Axis4.position(vex::percentUnits::pct)) +
Controller1.Axis1.position(vex::percentUnits::pct) - Goff;
FRI = (-1 * Controller1.Axis3.position(vex::percentUnits::pct)) +
(1 * Controller1.Axis4.position(vex::percentUnits::pct)) +
Controller1.Axis1.position(vex::percentUnits::pct) - Goff;
BRI = (-1 * Controller1.Axis3.position(vex::percentUnits::pct)) -
(1 * Controller1.Axis4.position(vex::percentUnits::pct)) +
Controller1.Axis1.position(vex::percentUnits::pct) - Goff;

FL.spin(vex::directionType::fwd, FLI, vex::velocityUnits::pct);
BL.spin(vex::directionType::fwd, BLI, vex::velocityUnits::pct);
FR.spin(vex::directionType::fwd, FRI, vex::velocityUnits::pct);
BR.spin(vex::directionType::fwd, BRI, vex::velocityUnits::pct);
}
return 1;
}

1 Like

If you are using VEXcode text, then you really should be writing that sort of thing yourself.

2 Likes

@jpearman I am working on using the printf statement for the purpose of debugging. I put a simple printf statement in the main method like this:

int main() {
printf(“hello”);
}

The preferences I have enabled are saving before building, enabling file watcher, enabling terminal, and downloading channel on connect.

When I run that program, nothing is still printing to the terminal as stated in the bug fixed:

“[Windows] Resolved an issue where using ‘cout’ or ‘printf’ would not display in the Terminal window”

I also attempted “cout” but VEXcode was not recognizing the command.

Any help you can provide would be a tremendous help. Thank you in advance.

The printf is now working. I just ran my code and it started working.

The printf is going to a buffered stream, you can force it out by placing a new line at end:
printf(“hello\n”);