add vector for rpm and current

This commit is contained in:
interfisch 2021-07-28 15:09:21 +02:00
parent fc8ce7d2f3
commit f252d595b0
2 changed files with 39 additions and 1 deletions

View File

@ -668,3 +668,24 @@ public class GraphRoll_minimal extends Visualization {
} }
} }
public class VectorDisplay extends Visualization {
int size = 100;
public VectorDisplay(int px, int py, int psize, float pvmax) {
super.valueMax=pvmax;
super.posOrigin= new PVector(px,py); //center
this.size=psize;
}
public void drawVis() {
rectMode(CORNERS);
textSize(super.textsize);
stroke(super.cmain);
strokeWeight(4);
float _x=super.posOrigin.x+this.value/super.valueMax*this.size;
float _y=super.posOrigin.y+this.value2/super.valueMax*this.size;
line(super.posOrigin.x,super.posOrigin.y,_x,_y);
}
}

View File

@ -8,7 +8,7 @@ TODO
int vis_textsize=12; //copy from Visualization class int vis_textsize=12; //copy from Visualization class
String logfile_name=""; String logfile_name="/media/fisch/HDD/Projects/bobbycar/bobbycar_repo/logdata_visualization/202107_Thereisacamp/LOG00244.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
@ -59,6 +59,9 @@ Visualization vis_graph_speed_mean;
Visualization vis_c_graph_receivedelay; Visualization vis_c_graph_receivedelay;
Visualization vis_c_rpmvector;
Visualization vis_c_currentvector;
boolean showTimeline=!useSerial; boolean showTimeline=!useSerial;
Timeline tl; Timeline tl;
int timeoffset=0; //for moving timeslider int timeoffset=0; //for moving timeslider
@ -266,6 +269,11 @@ void setup() {
vis_c_graph_receivedelay.setTitle("receivedelay"); vis_c_graph_receivedelay.setTitle("receivedelay");
vis_c_rpmvector = new VectorDisplay(int(pos_vis_cmd.x+dist_vis_cmd.x/2+size_vis_cmd.x/2), int(pos_vis_cmd.y+dist_vis_cmd.y/2), 50, maxRPMDisplayed/20);
vis_c_rpmvector.setcmain(c_speed);
vis_c_currentvector = new VectorDisplay(int(pos_vis_cmd.x+dist_vis_cmd.x/2+size_vis_cmd.x/2), int(pos_vis_cmd.y+dist_vis_cmd.y/2+50), 50, maxCurrentDisplayed/20);
vis_c_currentvector.setcmain(c_current);
if (showTimeline) { if (showTimeline) {
@ -416,6 +424,15 @@ void draw() {
vis_c_graph_receivedelay.setValue(loopmillis-lastTimeMillis); vis_c_graph_receivedelay.drawVis(); vis_c_graph_receivedelay.setValue(loopmillis-lastTimeMillis); vis_c_graph_receivedelay.drawVis();
vis_c_rpmvector.setValue2((-rpm_FrontL-rpm_FrontR+rpm_RearL+rpm_RearR)/4.0/sqrt(2)); //y component
vis_c_rpmvector.setValue((-rpm_FrontL+rpm_FrontR-rpm_RearL+rpm_RearR)/4.0/sqrt(2)); //x component
vis_c_rpmvector.drawVis();
vis_c_currentvector.setValue2((-current_FrontL-current_FrontR+current_RearL+current_RearR)/4.0/sqrt(2)); //y component
vis_c_currentvector.setValue((-current_FrontL+current_FrontR-current_RearL+current_RearR)/4.0/sqrt(2)); //x component
vis_c_currentvector.drawVis();
//Temperature //Temperature
PVector pos_temperature = new PVector(500,12); PVector pos_temperature = new PVector(500,12);