Vex memory permission error 038015fc

I have been trying to mess with one of my teammates who hates putting Scotty (that is just what our team calls the vex iq Sammy) on our robot so I tried to add him to the brain with .draw functions. it just sends vex memory permission error 038015fc, I don’t know if there is just not enough storage in the brain to use the images or if it has a different problem, here is my code:

#include "vex.h"
#include <iostream>

// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name]               [Type]        [Port(s)]
// Controller1          controller
// Motor1               motor         1
// Motor2               motor         2
// Motor3               motor         3
// Motor4               motor         4
// ---- END VEXCODE CONFIGURED DEVICES ----
using namespace vex;
using namespace std;

#define reverse rev;

int fb = Controller1.Axis3.position();
int lr = Controller1.Axis4.position();
int turn = Controller1.Axis1.position();

competition Competition;

void pre_auton(void) {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();
  /*
  Brain.Screen.clearScreen();
  Brain.Screen.setFillColor(cyan); //Background
  Brain.Screen.drawRectangle(0, 0, 480, 272);
  Brain.Screen.setFillColor(red);
  Brain.Screen.drawRectangle(22, 22, 458, 250);
  Controller1.rumble(rumbleLong);
  wait(2, sec);
  Controller1.Screen.print("SCOTTY CANNOT BE REMOVED");
  Controller1.Screen.newLine();
  Controller1.Screen.newLine();
  Controller1.Screen.print("SCOTTY CANNOT BE REMOVED");
  Controller1.Screen.newLine();
  Controller1.Screen.newLine(); 
  Controller1.Screen.newLine(); 
  Brain.Screen.setPenColor(black);
  Brain.Screen.setPenWidth(4);
  Brain.Screen.setFillColor(blue); //head
  Brain.Screen.drawCircle(240, 68, 30);
  Brain.Screen.setFillColor(ClrDarkGray);//body
  Brain.Screen.drawCircle(240, 68, 10);//neck
  Brain.Screen.drawRectangle(230, 68, 250, 188);//body
  Brain.Screen.drawCircle(240, 188, 10); //hip
  Brain.Screen.drawCircle(240, 109, 10); //arm,shoulder
  Brain.Screen.drawCircle(268, 241, 10); //knee low
  Brain.Screen.drawCircle(189, 219, 10); //knee high
  Brain.Screen.drawCircle(325, 259, 10); //foot low
  Brain.Screen.drawCircle(215, 162, 10); //elbow low
  Brain.Screen.drawCircle(155, 162, 10); //hand low
  Brain.Screen.drawCircle(190, 141, 10); //elbow high
  Brain.Screen.drawCircle(139, 110, 10); //hand high
  
  Brain.Screen.drawRectangle(235, 179, 194, 228); //thigh high 
  Brain.Screen.drawRectangle(231, 193, 277, 237); //thigh low
  Brain.Screen.drawRectangle(179, 217, 184, 280); //shin high
  Brain.Screen.drawRectangle(271, 232, 322, 267); //shin low
  Brain.Screen.drawRectangle(231, 104, 224, 167); //bicep low
  Brain.Screen.drawRectangle(155, 152, 215, 172); //wrist low
  Brain.Screen.drawRectangle(234, 100, 196, 150); //bicep high
  Brain.Screen.drawRectangle(144, 102, 185, 150); //wrist high
  
  wait(1,sec);
  Controller1.Screen.print("SCOTTY IS NOW IN THE BRAIN SCREEN");
  Controller1.Screen.newLine();
  Controller1.Screen.print("  [info]: TASK COMPLETE ..."); 
  Controller1.Screen.newLine();
  Controller1.Screen.print("     Begin Match");
  */
}

void autonomous(void) {
  // Insert autonomous user code here.
}

void usercontrol(void) {
  // User control code here, inside the loop
  while (1) {
    Brain.Screen.clearScreen();
  Brain.Screen.setFillColor(cyan); //Background
  Brain.Screen.drawRectangle(0, 0, 480, 272);
  Brain.Screen.setFillColor(red);
  Brain.Screen.drawRectangle(22, 22, 458, 250);
  Controller1.rumble(rumbleLong);
  wait(2, sec);
  Controller1.Screen.print("SCOTTY CANNOT BE REMOVED");
  Controller1.Screen.newLine();
  Controller1.Screen.newLine();
  Controller1.Screen.print("SCOTTY CANNOT BE REMOVED");
  Controller1.Screen.newLine();
  Controller1.Screen.newLine(); 
  Controller1.Screen.newLine(); 
  Brain.Screen.setPenColor(black);
  Brain.Screen.setPenWidth(4);
  Brain.Screen.setFillColor(blue); //head
  Brain.Screen.drawCircle(240, 68, 30);
  Brain.Screen.setFillColor(ClrDarkGray);//body
  Brain.Screen.drawCircle(240, 68, 10);//neck
  Brain.Screen.drawRectangle(230, 68, 250, 188);//body
  Brain.Screen.drawCircle(240, 188, 10); //hip
  Brain.Screen.drawCircle(240, 109, 10); //arm,shoulder
  Brain.Screen.drawCircle(268, 241, 10); //knee low
  Brain.Screen.drawCircle(189, 219, 10); //knee high
  Brain.Screen.drawCircle(325, 259, 10); //foot low
  Brain.Screen.drawCircle(215, 162, 10); //elbow low
  Brain.Screen.drawCircle(155, 162, 10); //hand low
  Brain.Screen.drawCircle(190, 141, 10); //elbow high
  Brain.Screen.drawCircle(139, 110, 10); //hand high
  
  Brain.Screen.drawRectangle(235, 179, 194, 228); //thigh high 
  Brain.Screen.drawRectangle(231, 193, 277, 237); //thigh low
  Brain.Screen.drawRectangle(179, 217, 184, 280); //shin high
  Brain.Screen.drawRectangle(271, 232, 322, 267); //shin low
  Brain.Screen.drawRectangle(231, 104, 224, 167); //bicep low
  Brain.Screen.drawRectangle(155, 152, 215, 172); //wrist low
  Brain.Screen.drawRectangle(234, 100, 196, 150); //bicep high
  Brain.Screen.drawRectangle(144, 102, 185, 150); //wrist high
  
  wait(1,sec);
  Controller1.Screen.print("SCOTTY IS NOW IN THE BRAIN SCREEN");
  Controller1.Screen.newLine();
  Controller1.Screen.print("  [info]: TASK COMPLETE ..."); 
  Controller1.Screen.newLine();
  Controller1.Screen.print("     Begin Match");

    if (lr < 0) {
      Motor1 = true;
    }
    if (Controller1.Axis3.position() != 0 or
        Controller1.Axis4.position() != 0) {
      Motor1.spin(fwd, fb + lr, pct);
      Motor2.spin(fwd, fb + lr, pct);
      Motor3.spin(fwd, fb + lr, pct);
      Motor1.spin(fwd, fb + lr, pct);
    }

    wait(20, msec); // Sleep the task for a short amount of time to
                    // prevent wasted resources.
  }
}

//
// Main will set up the competition functions and callbacks.
//
int main() {
  // Set up callbacks for autonomous and driver control periods.
  Competition.autonomous(autonomous);
  Competition.drivercontrol(usercontrol);

  // Run the pre-autonomous function.
  pre_auton();

  // Prevent main from exiting with an infinite loop.
  while (true) {
    wait(100, msec);
  }
}

Doesn’t crash for me, but that code has plenty of other problems.
At what stage does it throw the memory error ?
Is the brain firmware up to data ?

1 Like

Don’t worry about my driver control, I was just waiting to make that for a time I can test it

it shows on the error on the brain screen instead of printing to it

Are you using VEXcode or (remember obsolete) VEXcode Pro ?
If pro, it it probably these lines.

int fb = Controller1.Axis3.position();
int lr = Controller1.Axis4.position();
int turn = Controller1.Axis1.position();

which make no sense anyway, if the plan was to shortcut using the controller axis, it doesn’t work that way.

also this line

Motor1 = true;

is useless if Motor1 is an instance of a motor.

edit: and the explanation
Pro creates the motors etc. in a file called robot-config.cpp, this code that generates the motors, and controller, will run after the global code in main.cpp, that means that when you tried to do

int lr = Controller1.Axis4.position();

The Controller1 instance did not exist, hence the crash.

you need to assign controller axis to lr etc. at the top of you while loop in usercontrol.

2 Likes

ok, I trimmed the unnecessary code other than the other variables and it prints now, I got the coordinates wrong so it looks bad but I can fix that, thanks

1 Like