controlP5 error: java.lang.NoClassDefFoundError: Could not initialize class java.util.logging.LogRecord
in
Contributed Library Questions
•
2 years ago
Hello --
controlP5.controller("updateLeftSpeed").setValue(R/Ratio);
I'm getting an error that I can't seem to fix.
The error comes from line 99 of the main code:
I use an identical line of code on line 65 with no error at all.
Any thought or help would be appreciated.
Thanks!
The Error:
Main Code:
- import processing.serial.*;
- import controlP5.*;
- ControlP5 controlP5;
- Serial myPort;
- float netural=90;
- float rval=netural;
- float lval=netural;
- float maxSpeed=0.5;
- float leftSpeed=1;
- float rightSpeed=1;
- String[] message = new String[4];
- int[] serialInArray = new int[3];
- int serialCount = 0; // A count of how many bytes we receive
- void setup() {
- size(600,600);
- background(225,0,255);
- String portName = Serial.list()[0];
- myPort = new Serial(this, portName, 38400);
- init_menu();
- }
- void draw() {
- // leftSpeed and rightSpeed go from 0 -> 1 where 1 is the maxSpeed
- map_speed_to_angle(leftSpeed, rightSpeed);
- sendmessage();
- if (keyPressed) {
- if(key==CODED) {
- if(keyCode == UP) {
- lval=180;
- rval=1;
- sendmessage();
- }
- if(keyCode == DOWN) {
- //full Reverse
- lval=1;
- rval=180;
- sendmessage();
- }
- if(keyCode == RIGHT) {
- //full Reverse
- lval=0;
- rval=90;
- sendmessage();
- }
- if(keyCode == LEFT) {
- //full Reverse
- lval=90;
- rval=180;
- sendmessage();
- }
- }
- if(key==' ') {
- controlP5.controller("updateLeftSpeed").setValue(0);
- controlP5.controller("updateRightSpeed").setValue(0);
- rightSpeed=controlP5.controller("updateRightSpeed").value();
- leftSpeed=controlP5.controller("updateLeftSpeed").value();
- // rval=netural;
- // lval=netural;
- sendmessage();
- }
- }
- }
- void updateTurnRatio() {
- float Ratio=controlP5.controller("updateTurnRatio").value();
- float L= controlP5.controller("updateLeftSpeed").value();
- //Sets the right speed as a fraction of the left speed
- controlP5.controller("updateRightSpeed").setValue(L*Ratio);
- if(controlP5.controller("updateTurnRatio").value() > 0) {
- println("Cheese");
- }
- }
- void updateLeftSpeed() {
- float Ratio=controlP5.controller("updateTurnRatio").value();
- float L=controlP5.controller("updateLeftSpeed").value();
- controlP5.controller("updateRightSpeed").setValue(L*Ratio);
- rightSpeed=controlP5.controller("updateRightSpeed").value();
- leftSpeed=controlP5.controller("updateLeftSpeed").value();
- }
- void updateRightSpeed() {
- float Ratio=controlP5.controller("updateTurnRatio").value();
- float R=controlP5.controller("updateRightSpeed").value();
- controlP5.controller("updateLeftSpeed").setValue(R/Ratio);
- rightSpeed=controlP5.controller("updateRightSpeed").value();
- leftSpeed=controlP5.controller("updateLeftSpeed").value();
- }
- void updatemaxSpeed() {
- maxSpeed=controlP5.controller("updateMaxSpeed").value();
- }
- void map_speed_to_angle(float L, float R) {
- lval=map(L,0, 1, netural, netural+(maxSpeed*90));
- rval=180-map(R,0, 1, netural, netural+(maxSpeed*90));
- }
controlP5 Setup:
- public void init_menu() {
- controlP5 = new ControlP5(this);
- ControlGroup g1 = controlP5.addGroup("Menu",width-550,30,500);
- g1.setBackgroundColor(color(255,50));
- g1.setBackgroundHeight(400);
- g1.activateEvent(false);
- g1.setBarHeight(20);
- g1.close();
- // controlP5.addBang("RESET",4,4,50,20).setGroup(g1);
- // controlP5.controller("RESET").setLabel("Restore Defaults");
- //// Bang NR;
- // controlP5.addBang("New_Race", width-650, 4, 78, 30);
- // controlP5.controller("New_Race").setLabel("Start a new race");
- // controlP5.controller("New_Race").setColorActive(0xf0ff0000);
- // Radio r = controlP5.addRadio("radio",300,4,50,20,40); // Name, X, Y, W, H Space
- // r.add("Lap Race",0);
- // r.add("Timed Race",1);
- // r.setColorLabel(0xffff0000);
- // r.setGroup(g1);
- controlP5.addSlider("updateMaxSpeed",0,1,0.5, 4,50,400,30).setGroup(g1);//min, max, default, posX, posY,W,H
- controlP5.controller("updateMaxSpeed").setLabel("Max Speed");
- Slider s1 = (Slider)controlP5.controller("updateMaxSpeed");
- // s1.setNumberOfTickMarks(100);
- s1.setColorLabel(0xffff0000);
- // use Slider.FIX or Slider.FLEXIBLE to change the slider handle
- // by default it is Slider.FIX
- s1.setSliderMode(Slider.FIX);
- controlP5.addSlider("updateLeftSpeed",0,1,1, 4,100,400,30).setGroup(g1);//min, max, default, posX, posY,W,H
- controlP5.controller("updateLeftSpeed").setLabel("Left Speed");
- Slider s2 = (Slider)controlP5.controller("updateLeftSpeed");
- // s2.setNumberOfTickMarks(100);
- s2.setColorLabel(0xffff0000);
- // use Slider.FIX or Slider.FLEXIBLE to change the slider handle
- // by default it is Slider.FIX
- // s2.setSliderMode(Slider.FIX);
- controlP5.addSlider("updateRightSpeed",0,1,1, 4,150,400,30).setGroup(g1);//min, max, default, posX, posY,W,H
- controlP5.controller("updateRightSpeed").setLabel("Right Speed");
- Slider s3 = (Slider)controlP5.controller("updateRightSpeed");
- // s3.setNumberOfTickMarks(100);
- s3.setColorLabel(0xffff0000);
- // use Slider.FIX or Slider.FLEXIBLE to change the slider handle
- // by default it is Slider.FIX
- // s3.setSliderMode(Slider.FIX);
- controlP5.addSlider("updateTurnRatio",-1,1,1, 4,200,400,30).setGroup(g1);//min, max, default, posX, posY,W,H
- controlP5.controller("updateTurnRatio").setLabel("Turn Ratio");
- Slider s4 = (Slider)controlP5.controller("updateTurnRatio");
- // s4.setNumberOfTickMarks(100);
- s4.setColorLabel(0xffff0000);
- // use Slider.FIX or Slider.FLEXIBLE to change the slider handle
- // by default it is Slider.FIX
- // s4.setSliderMode(Slider.FLEXIBLE);
- };
1