add speed and trip
This commit is contained in:
parent
fb961e3da7
commit
ddbf16529e
|
@ -3,12 +3,13 @@ import processing.serial.*;
|
||||||
/*
|
/*
|
||||||
TODO
|
TODO
|
||||||
- in teensy controller: erst table header screiben, dann anfangen zu loggen (oder erste zeilen comments hier ignorieren)
|
- in teensy controller: erst table header screiben, dann anfangen zu loggen (oder erste zeilen comments hier ignorieren)
|
||||||
|
- comments werden weiterhin vor header geschrieben.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int vis_textsize=12; //copy from Visualization class
|
int vis_textsize=12; //copy from Visualization class
|
||||||
|
|
||||||
//String logfile_name="LOG00008_rumfahren_neu.TXT";
|
//String logfile_name="LOG00008_rumfahren_neu.TXT";
|
||||||
String logfile_name="LOG00184_20210515b_Video_Treff_FreewheelCurrentFix.TXT";
|
String logfile_name="20210528_Radweg/LOG00197.TXT";
|
||||||
int columnCount=20;
|
int columnCount=20;
|
||||||
|
|
||||||
boolean useSerial=false; //false=read from csv log, true=read from serial port
|
boolean useSerial=false; //false=read from csv log, true=read from serial port
|
||||||
|
@ -32,18 +33,20 @@ Visualization vis_current_FrontR;
|
||||||
Visualization vis_current_RearL;
|
Visualization vis_current_RearL;
|
||||||
Visualization vis_current_RearR;
|
Visualization vis_current_RearR;
|
||||||
|
|
||||||
Visualization vis_speed_FrontL;
|
Visualization vis_rpm_FrontL;
|
||||||
Visualization vis_speed_FrontR;
|
Visualization vis_rpm_FrontR;
|
||||||
Visualization vis_speed_RearL;
|
Visualization vis_rpm_RearL;
|
||||||
Visualization vis_speed_RearR;
|
Visualization vis_rpm_RearR;
|
||||||
|
|
||||||
Visualization vis_throttle;
|
Visualization vis_throttle;
|
||||||
Visualization vis_brake;
|
Visualization vis_brake;
|
||||||
|
|
||||||
Visualization vis_currentAll;
|
Visualization vis_currentAll;
|
||||||
|
|
||||||
|
Visualization vis_c_speed;
|
||||||
|
|
||||||
//vis_c means calculated value, not raw value from log
|
//vis_c means calculated value, not raw value from log
|
||||||
Visualization vis_c_speed_mean;
|
Visualization vis_c_rpm_mean;
|
||||||
|
|
||||||
Visualization vis_graph_currentAll;
|
Visualization vis_graph_currentAll;
|
||||||
Visualization vis_graph_speed_mean;
|
Visualization vis_graph_speed_mean;
|
||||||
|
@ -76,10 +79,10 @@ float current_FrontL;
|
||||||
float current_FrontR;
|
float current_FrontR;
|
||||||
float current_RearL;
|
float current_RearL;
|
||||||
float current_RearR;
|
float current_RearR;
|
||||||
int speed_FrontL;
|
int rpm_FrontL;
|
||||||
int speed_FrontR;
|
int rpm_FrontR;
|
||||||
int speed_RearL;
|
int rpm_RearL;
|
||||||
int speed_RearR;
|
int rpm_RearR;
|
||||||
float temp_Front;
|
float temp_Front;
|
||||||
float temp_Rear;
|
float temp_Rear;
|
||||||
float vbat_Front;
|
float vbat_Front;
|
||||||
|
@ -87,12 +90,14 @@ float vbat_Rear;
|
||||||
float currentAll;
|
float currentAll;
|
||||||
int throttle;
|
int throttle;
|
||||||
int brake;
|
int brake;
|
||||||
|
float speed;
|
||||||
|
float trip;
|
||||||
|
|
||||||
color bg=color(0);
|
color bg=color(0);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
//size(1920, 1080);
|
size(1920, 1080); //Full HD
|
||||||
size(1000, 800);
|
//size(1000, 800); //Laptop Preview
|
||||||
frameRate(100);
|
frameRate(100);
|
||||||
|
|
||||||
if (useSerial) {
|
if (useSerial) {
|
||||||
|
@ -149,20 +154,20 @@ void setup() {
|
||||||
|
|
||||||
// Speed
|
// Speed
|
||||||
color c_speed=color(50,50,255);
|
color c_speed=color(50,50,255);
|
||||||
vis_speed_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
vis_rpm_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||||
|
|
||||||
vis_speed_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
vis_rpm_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||||
vis_speed_FrontR.setTitle("speed");
|
vis_rpm_FrontR.setTitle("speed");
|
||||||
|
|
||||||
vis_speed_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
vis_rpm_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||||
vis_speed_RearL.setValueUnit("rpm");
|
vis_rpm_RearL.setValueUnit("rpm");
|
||||||
|
|
||||||
vis_speed_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
vis_rpm_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||||
|
|
||||||
vis_speed_FrontL.setcmain(c_speed);
|
vis_rpm_FrontL.setcmain(c_speed);
|
||||||
vis_speed_FrontR.setcmain(c_speed);
|
vis_rpm_FrontR.setcmain(c_speed);
|
||||||
vis_speed_RearL.setcmain(c_speed);
|
vis_rpm_RearL.setcmain(c_speed);
|
||||||
vis_speed_RearR.setcmain(c_speed);
|
vis_rpm_RearR.setcmain(c_speed);
|
||||||
|
|
||||||
// Current
|
// Current
|
||||||
color c_current=color(255,200,50);
|
color c_current=color(255,200,50);
|
||||||
|
@ -194,12 +199,17 @@ void setup() {
|
||||||
vis_brake.setcmain(c_brake);
|
vis_brake.setcmain(c_brake);
|
||||||
vis_brake.setTitle("Brake");
|
vis_brake.setTitle("Brake");
|
||||||
|
|
||||||
|
//Speed
|
||||||
|
vis_c_speed = new Tacho(width/2-150,height-150,100,-10,50);
|
||||||
|
vis_c_speed.setTitle("Speed");
|
||||||
|
vis_c_speed.setValueUnit("km/h");
|
||||||
|
vis_c_speed.setShowMinMax(true);
|
||||||
|
|
||||||
//Speed mean
|
//RPM Man
|
||||||
vis_c_speed_mean = new Tacho(width/2-150,height-150,100,-100,600);
|
vis_c_rpm_mean = new Tacho(width/2-400,height-150,75,-100,1000);
|
||||||
vis_c_speed_mean.setTitle("Speed");
|
vis_c_rpm_mean.setTitle("RPM");
|
||||||
vis_c_speed_mean.setValueUnit("rpm");
|
vis_c_rpm_mean.setValueUnit("rpm");
|
||||||
vis_c_speed_mean.setShowMinMax(true);
|
vis_c_rpm_mean.setShowMinMax(true);
|
||||||
|
|
||||||
//Current
|
//Current
|
||||||
color c_currentall=color(240,255,50);
|
color c_currentall=color(240,255,50);
|
||||||
|
@ -269,10 +279,10 @@ void draw() {
|
||||||
current_FrontR=parseFloat(list[6]);
|
current_FrontR=parseFloat(list[6]);
|
||||||
current_RearL=parseFloat(list[7]);
|
current_RearL=parseFloat(list[7]);
|
||||||
current_RearR=parseFloat(list[8]);
|
current_RearR=parseFloat(list[8]);
|
||||||
speed_FrontL=parseInt(list[9]);
|
rpm_FrontL=parseInt(list[9]);
|
||||||
speed_FrontR=parseInt(list[10]);
|
rpm_FrontR=parseInt(list[10]);
|
||||||
speed_RearL=parseInt(list[11]);
|
rpm_RearL=parseInt(list[11]);
|
||||||
speed_RearR=parseInt(list[12]);
|
rpm_RearR=parseInt(list[12]);
|
||||||
temp_Front=parseFloat(list[13]);
|
temp_Front=parseFloat(list[13]);
|
||||||
temp_Rear=parseFloat(list[14]);
|
temp_Rear=parseFloat(list[14]);
|
||||||
vbat_Front=parseFloat(list[15]);
|
vbat_Front=parseFloat(list[15]);
|
||||||
|
@ -306,10 +316,10 @@ void draw() {
|
||||||
current_FrontR=row.getFloat("current_FrontR");
|
current_FrontR=row.getFloat("current_FrontR");
|
||||||
current_RearL=row.getFloat("current_RearL");
|
current_RearL=row.getFloat("current_RearL");
|
||||||
current_RearR=row.getFloat("current_RearR");
|
current_RearR=row.getFloat("current_RearR");
|
||||||
speed_FrontL=row.getInt("speed_FrontL");
|
rpm_FrontL=row.getInt("rpm_FrontL");
|
||||||
speed_FrontR=row.getInt("speed_FrontR");
|
rpm_FrontR=row.getInt("rpm_FrontR");
|
||||||
speed_RearL=row.getInt("speed_RearL");
|
rpm_RearL=row.getInt("rpm_RearL");
|
||||||
speed_RearR=row.getInt("speed_RearR");
|
rpm_RearR=row.getInt("rpm_RearR");
|
||||||
temp_Front=row.getFloat("temp_Front");
|
temp_Front=row.getFloat("temp_Front");
|
||||||
temp_Rear=row.getFloat("temp_Rear");
|
temp_Rear=row.getFloat("temp_Rear");
|
||||||
vbat_Front=row.getFloat("vbat_Front");
|
vbat_Front=row.getFloat("vbat_Front");
|
||||||
|
@ -317,6 +327,8 @@ void draw() {
|
||||||
currentAll=row.getFloat("currentAll");
|
currentAll=row.getFloat("currentAll");
|
||||||
throttle=row.getInt("throttle");
|
throttle=row.getInt("throttle");
|
||||||
brake=row.getInt("brake");
|
brake=row.getInt("brake");
|
||||||
|
speed=row.getFloat("speed");
|
||||||
|
trip=row.getFloat("trip");
|
||||||
|
|
||||||
if (loopmillis-nextTimeData>1000 && nextTimeData>lastTimeData) {//too much behind
|
if (loopmillis-nextTimeData>1000 && nextTimeData>lastTimeData) {//too much behind
|
||||||
long _timestep=nextTimeData-lastTimeData; //approximated time step
|
long _timestep=nextTimeData-lastTimeData; //approximated time step
|
||||||
|
@ -337,10 +349,10 @@ void draw() {
|
||||||
vis_cmd_RearL.setValue(cmd_RearL); vis_cmd_RearL.drawVis();
|
vis_cmd_RearL.setValue(cmd_RearL); vis_cmd_RearL.drawVis();
|
||||||
vis_cmd_RearR.setValue(cmd_RearR); vis_cmd_RearR.drawVis();
|
vis_cmd_RearR.setValue(cmd_RearR); vis_cmd_RearR.drawVis();
|
||||||
|
|
||||||
vis_speed_FrontL.setValue(speed_FrontL); vis_speed_FrontL.drawVis();
|
vis_rpm_FrontL.setValue(rpm_FrontL); vis_rpm_FrontL.drawVis();
|
||||||
vis_speed_FrontR.setValue(speed_FrontR); vis_speed_FrontR.drawVis();
|
vis_rpm_FrontR.setValue(rpm_FrontR); vis_rpm_FrontR.drawVis();
|
||||||
vis_speed_RearL.setValue(speed_RearL); vis_speed_RearL.drawVis();
|
vis_rpm_RearL.setValue(rpm_RearL); vis_rpm_RearL.drawVis();
|
||||||
vis_speed_RearR.setValue(speed_RearR); vis_speed_RearR.drawVis();
|
vis_rpm_RearR.setValue(rpm_RearR); vis_rpm_RearR.drawVis();
|
||||||
|
|
||||||
vis_current_FrontL.setValue(current_FrontL); vis_current_FrontL.drawVis();
|
vis_current_FrontL.setValue(current_FrontL); vis_current_FrontL.drawVis();
|
||||||
vis_current_FrontR.setValue(current_FrontR); vis_current_FrontR.drawVis();
|
vis_current_FrontR.setValue(current_FrontR); vis_current_FrontR.drawVis();
|
||||||
|
@ -350,9 +362,14 @@ void draw() {
|
||||||
vis_throttle.setValue(throttle); vis_throttle.drawVis();
|
vis_throttle.setValue(throttle); vis_throttle.drawVis();
|
||||||
vis_brake.setValue(brake); vis_brake.drawVis();
|
vis_brake.setValue(brake); vis_brake.drawVis();
|
||||||
|
|
||||||
|
vis_c_speed.setValue(speed*3.6); vis_c_speed.drawVis(); //from m/s in km/h
|
||||||
|
|
||||||
int speed_mean=int((speed_FrontL+speed_FrontR+speed_RearL+speed_RearR)/4.0);
|
textAlign(LEFT);
|
||||||
vis_c_speed_mean.setValue(speed_mean); vis_c_speed_mean.drawVis();
|
textSize(vis_textsize);
|
||||||
|
text(trip+" m", width/2-10,height-110);
|
||||||
|
|
||||||
|
int speed_mean=int((rpm_FrontL+rpm_FrontR+rpm_RearL+rpm_RearR)/4.0);
|
||||||
|
vis_c_rpm_mean.setValue(speed_mean); vis_c_rpm_mean.drawVis();
|
||||||
|
|
||||||
|
|
||||||
vis_currentAll.setValue(currentAll);
|
vis_currentAll.setValue(currentAll);
|
||||||
|
|
Loading…
Reference in New Issue