diff --git a/conf/festo.txt b/conf/festo.txt new file mode 100644 index 00000000..092e313c --- /dev/null +++ b/conf/festo.txt @@ -0,0 +1,53 @@ +conf0.r = 9.600000 +conf0.l = 0.013300 +conf0.j = 0.000026 +conf0.psi = 0.055000 +conf0.polecount = 4.000000 +conf0.mot_type = 0.000000 +conf0.out_rev = 0.000000 +conf0.high_motor_temp = 80.000000 +conf0.max_motor_temp = 100.000000 +conf0.phase_time = 0.500000 +conf0.phase_cur = 1.000000 +conf0.max_vel = 800.000000 +conf0.max_acc = 100000.000077 +conf0.max_force = 2.800000 +conf0.max_dc_cur = 5.000000 +conf0.max_ac_cur = 6.800000 +conf0.fb_type = 2.000000 +conf0.fb_polecount = 1.000000 +conf0.fb_offset = 1.324000 +conf0.fb_rev = 0.000000 +conf0.fb_res = 1000.000000 +conf0.autophase = 0.000000 +conf0.cmd_type = 1.000000 +conf0.cmd_unit = 0.000000 +conf0.cmd_rev = 0.000000 +conf0.cmd_res = 2000.000000 +conf0.en_condition = 0.000000 +conf0.error_out = 0.000000 +conf0.pos_staic = 0.000000 +conf0.sin_offset = 0.000000 +conf0.cos_offset = 0.000000 +conf0.sin_gain = 1.000000 +conf0.cos_gain = 1.000000 +conf0.max_dc_volt = 370.000000 +conf0.max_hv_temp = 90.000000 +conf0.max_core_temp = 55.000000 +conf0.max_pos_error = 1.570796 +conf0.high_dc_volt = 350.000000 +conf0.low_dc_volt = 12.000000 +conf0.high_hv_temp = 70.000000 +conf0.fan_hv_temp = 60.000000 +conf0.fan_core_temp = 450.000000 +conf0.fan_motor_temp = 60.000000 +conf0.p = 0.990000 +conf0.pos_p = 150.000000 +conf0.vel_p = 1.000000 +conf0.acc_p = 0.200000 +conf0.acc_pi = 100.000000 +conf0.cur_p = 0.500000 +conf0.cur_i = 0.000000 +conf0.cur_ff = 1.000000 +conf0.cur_ind = 0.900000 +conf0.max_sat = 0.200000 diff --git a/term/main.cpp b/term/main.cpp index 8ab11501..1c48827a 100644 --- a/term/main.cpp +++ b/term/main.cpp @@ -78,7 +78,7 @@ void Servoterm::OnDq(wxCommandEvent& WXUNUSED(event)){ } void Servoterm::OnRead(wxCommandEvent& WXUNUSED(event)){ - + servoframe->send("conf"); } void Servoterm::OnWrite(wxCommandEvent& WXUNUSED(event)){ @@ -86,8 +86,7 @@ void Servoterm::OnWrite(wxCommandEvent& WXUNUSED(event)){ string line; while (std::getline(infile, line)) { - if(!servoframe->send(line)) - break; + servoframe->send(line); } } @@ -97,7 +96,7 @@ void Servoterm::OnSave(wxCommandEvent& WXUNUSED(event)){ } void Servoterm::OnOpen(wxCommandEvent& WXUNUSED(event)){ - wxFileDialog openFileDialog(servoframe, wxEmptyString, SRCDIR"/..", "","*", wxFD_OPEN|wxFD_FILE_MUST_EXIST); + wxFileDialog openFileDialog(servoframe, wxEmptyString, SRCDIR"/../conf", "","*", wxFD_OPEN|wxFD_FILE_MUST_EXIST); if (openFileDialog.ShowModal() == wxID_CANCEL) return; filename = openFileDialog.GetPath(); diff --git a/term/mainframe.cpp b/term/mainframe.cpp index c5598d2c..070a8235 100644 --- a/term/mainframe.cpp +++ b/term/mainframe.cpp @@ -180,13 +180,7 @@ int ServoFrame::send(const string& s,bool h){ } histpos = history.size(); } - int ret1 = sp_nonblocking_write(port, s.c_str(), s.length()); - int ret2 = sp_nonblocking_write(port, "\r", 1); - if(ret1 != s.length() || ret2!=1){ - wxMessageBox( wxT("Error while sending"), wxT("Error"), wxICON_EXCLAMATION); - disconnect(); - return 0; - } + txqueue.push(s); }else{ wxMessageBox( wxT("Not connected"), wxT("Error"), wxICON_EXCLAMATION); return 0; @@ -197,6 +191,15 @@ int ServoFrame::send(const string& s,bool h){ void ServoFrame::OnTimer(wxTimerEvent& evt){ int ret; if(connected){ + if(!txqueue.empty()){ + int ret1 = sp_nonblocking_write(port, txqueue.front().c_str(), txqueue.front().length()); + int ret2 = sp_nonblocking_write(port, "\r", 1); + if(ret1 != txqueue.front().length() || ret2!=1){ + wxMessageBox( wxT("Error while sending"), wxT("Error"), wxICON_EXCLAMATION); + disconnect(); + } + txqueue.pop(); + } ret = sp_nonblocking_read(port, buf, bufsize); if(ret > 0){ buf[ret] = 0; diff --git a/term/mainframe.hpp b/term/mainframe.hpp index 9ee4a171..3cd3d4c4 100644 --- a/term/mainframe.hpp +++ b/term/mainframe.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "basicdrawpane.hpp" @@ -62,4 +63,5 @@ private: int histpos; int addr; float values[16]; + std::queue txqueue; };