nano_manipulator.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Gxsm Plugin Name: nano_manipulator.C
00006  * ========================================
00007  * 
00008  * Copyright (C) 1999 The Free Software Foundation
00009  *
00010  * Authors: Percy Zahl <zahl@fkp.uni-hannover.de>
00011  * additional features: Andreas Klust <klust@fkp.uni-hannover.de>
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00026  */
00027 
00028 /* Please do not change the Begin/End lines of this comment section!
00029  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00030  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00031  * All "% PlugInXXX" commentary tags are mandatory
00032  * All "% OptPlugInXXX" tags are optional
00033  * --------------------------------------------------------------------------------
00034 % BeginPlugInDocuSection
00035 % PlugInDocuCaption: Nano Manipulator (to be ported)
00036 % PlugInName: nano_manipulator
00037 % PlugInAuthor: Percy Zahl
00038 % PlugInAuthorEmail: zahl@users.sf.net
00039 % PlugInMenuPath: Windows/Nano Manipulator
00040 
00041 % PlugInDescription
00042 This is a tool to use your tip for nano manipulating.
00043 
00044 It will connect to the DSP/SPM and provide a realtime force feedback
00045 (using a modern Force Feedback Joystick Control Device) while
00046 moving/pushing things around\dots
00047 
00048 % PlugInUsage
00049 
00050 % OptPlugInObjects
00051 Shows a trace and current tip position\dots
00052 
00053 %% OptPlugInDest
00054 
00055 %% OptPlugInConfig
00056 %
00057 
00058 %% OptPlugInFiles
00059 
00060 %% OptPlugInKnownBugs
00061 
00062 % OptPlugInNotes
00063 This PlugIn is work in progress.
00064 
00065 %% OptPlugInHints
00066 
00067 % OptPlugInSubSection: Disclaimer
00068 This tool may ruin your tip and sample if impropper used!
00069 
00070 % EndPlugInDocuSection
00071  * -------------------------------------------------------------------------------- 
00072  */
00073 
00074 #include <gtk/gtk.h>
00075 #include "config.h"
00076 #include "gxsm/plugin.h"
00077 
00078 #include "gxsm/unit.h"
00079 #include "gxsm/pcs.h"
00080 #include "gxsm/xsmtypes.h"
00081 #include "gxsm/glbvars.h"
00082 
00083 #include "include/dsp-pci32/xsm/xsmcmd.h"
00084 
00085 
00086 
00087 static void nano_manipulator_about( void );
00088 static void nano_manipulator_query( void );
00089 static void nano_manipulator_cleanup( void );
00090 
00091 static void nano_manipulator_show_callback( GtkWidget*, void* );
00092 static void nano_manipulator_StartScan_callback( gpointer );
00093 
00094 GxsmPlugin nano_manipulator_pi = {
00095   NULL,
00096   NULL,
00097   0,
00098   NULL,
00099   "nano_manipulator",
00100 //  "+ALL +SRanger:SPMHARD +SRangerTest:SPMHARD +Innovative_DSP:SPMHARD +Innovative_DSP:SPAHARD",
00101   "+Innovative_DSP:SPMHARD +Innovative_DSP:SPAHARD",
00102   NULL,
00103   "Percy Zahl",
00104   N_("_Windows/"),
00105   N_("Nano Manipulator"),
00106   N_("open the Nano Plotter Control"),
00107   "Nano Manipulator Control",
00108   NULL,
00109   NULL,
00110   NULL,
00111   nano_manipulator_query,
00112   nano_manipulator_about,
00113   NULL,
00114   NULL,
00115   nano_manipulator_cleanup
00116 };
00117 
00118 static const char *about_text = N_("Gxsm nano_manipulator Plugin:\n"
00119         );
00120 
00121 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00122   nano_manipulator_pi.description = g_strdup_printf(N_("Gxsm nano_manipulator plugin %s"), VERSION);
00123   return &nano_manipulator_pi; 
00124 }
00125 
00126 class nano_manipulatorControl : public AppBase{
00127 public:
00128         nano_manipulatorControl();
00129         virtual ~nano_manipulatorControl();
00130         
00131         void update();
00132         void update_pos();
00133         static void RunPlott(GtkWidget *widget, nano_manipulatorControl *npc);
00134         
00135         void SetNewParam(DSP_Param *dsp);
00136         void GoToPosition(double x, double y);
00137 
00138 private:
00139         int devpcdspmon;
00140         Trace_Data td_current;
00141         UnitObj *Unity, *Volt, *Current, *Force;
00142         DSP_Param    move_dsp;
00143         DSP_Param    action_dsp;
00144 };
00145 
00146 nano_manipulatorControl *nano_manipulatorClass = NULL;
00147 
00148 static void nano_manipulator_query(void)
00149 {
00150   static GnomeUIInfo menuinfo[] = { 
00151     { GNOME_APP_UI_ITEM, 
00152       nano_manipulator_pi.menuentry, nano_manipulator_pi.help,
00153       (gpointer) nano_manipulator_show_callback, NULL,
00154       NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK, 
00155       0, GDK_CONTROL_MASK, NULL },
00156 
00157     GNOMEUIINFO_END
00158   };
00159 
00160   gnome_app_insert_menus
00161     ( GNOME_APP(nano_manipulator_pi.app->getApp()), 
00162       nano_manipulator_pi.menupath, menuinfo );
00163 
00164   // new ...
00165   nano_manipulatorClass = new nano_manipulatorControl;
00166 
00167   nano_manipulatorClass->SetResName ("Windownano_manipulatorControl", "false", xsmres.geomsave);
00168 
00169   nano_manipulator_pi.app->ConnectPluginToStartScanEvent
00170     ( nano_manipulator_StartScan_callback );
00171 
00172   nano_manipulator_pi.status = g_strconcat(N_("Plugin query has attached "),
00173                                      nano_manipulator_pi.name, 
00174                                      N_(": nano_manipulator is created."),
00175                                      NULL);
00176 }
00177 
00178 static void nano_manipulator_about(void)
00179 {
00180   const gchar *authors[] = { "Percy Zahl", NULL};
00181   gtk_widget_show(gnome_about_new ( nano_manipulator_pi.name,
00182                                     VERSION,
00183                                     N_("(C) 2001 the Free Software Foundation"),
00184                                     about_text,
00185                                     authors,
00186                                     NULL, NULL, NULL
00187                                     ));
00188 }
00189 
00190 static void nano_manipulator_cleanup( void ){
00191   PI_DEBUG (DBG_L2, "nano_manipulator Plugin Cleanup" );
00192   gchar *mp = g_strconcat(nano_manipulator_pi.menupath, nano_manipulator_pi.menuentry, NULL);
00193   gnome_app_remove_menus (GNOME_APP( nano_manipulator_pi.app->getApp() ), mp, 1);
00194   g_free(mp);
00195 
00196   // delete ...
00197   if( nano_manipulatorClass )
00198     delete nano_manipulatorClass ;
00199 
00200   g_free( nano_manipulator_pi.status );
00201 }
00202 
00203 static void nano_manipulator_show_callback( GtkWidget* widget, void* data){
00204   if( nano_manipulatorClass )
00205     nano_manipulatorClass->show();
00206 }
00207 
00208 static void nano_manipulator_StartScan_callback( gpointer ){
00209   nano_manipulatorClass->update();
00210 }
00211 
00212 
00213 nano_manipulatorControl::nano_manipulatorControl ()
00214 {
00215   GtkWidget *box, *hbox;
00216   GtkWidget *frame_param;
00217   GtkWidget *vbox_param, *hbox_param;
00218   GtkWidget *input;
00219 
00220   GSList *EC_list=NULL;
00221   GSList *EC_pos_list=NULL;
00222   GSList **RemoteEntryList = new GSList *;
00223   *RemoteEntryList = NULL;
00224 
00225   Gtk_EntryControl *ec;
00226 
00227   Unity    = new UnitObj(" "," ");
00228   Volt     = new UnitObj("V","V");
00229   Current  = new UnitObj("nA","nA");
00230   Force    = new UnitObj("nN","nN");
00231 
00232   memcpy (&move_dsp, &nano_manipulator_pi.app->xsm->data.hardpars, 
00233           sizeof (DSP_Param));
00234   memcpy (&action_dsp, &nano_manipulator_pi.app->xsm->data.hardpars, 
00235           sizeof (DSP_Param));
00236 
00237   XsmRescourceManager xrm("Pluginnano_manipulatorControl");
00238   xrm.Get("nano_manipulator.X", &td_current.x, "0.");
00239   xrm.Get("nano_manipulator.Y", &td_current.y, "0.");
00240   xrm.Get("nano_manipulator.action_dsp.ITunnelSoll", &action_dsp.ITunnelSoll, "1.");
00241   xrm.Get("nano_manipulator.action_dsp.UTunnel", &action_dsp.UTunnel, "3.");
00242   xrm.Get("nano_manipulator.action_dsp.SetPoint", &action_dsp.SetPoint, "0.");
00243   xrm.Get("nano_manipulator.action_dsp.usrCP", &action_dsp.usrCP, "0.05");
00244   xrm.Get("nano_manipulator.action_dsp.usrCI", &action_dsp.usrCI, "0.05");
00245   xrm.Get("nano_manipulator.action_dsp.usrCS", &action_dsp.CS, "0.0");
00246   xrm.Get("nano_manipulator.action_dsp.MV_stepsize", &action_dsp.MV_stepsize, "1");
00247   xrm.Get("nano_manipulator.action_dsp.MV_nRegel", &action_dsp.MV_nRegel, "1");
00248   xrm.Get("nano_manipulator.move_dsp.ITunnelSoll", &move_dsp.ITunnelSoll, "0.1");
00249   xrm.Get("nano_manipulator.move_dsp.UTunnel", &move_dsp.UTunnel, "0.1");
00250   xrm.Get("nano_manipulator.move_dsp.SetPoint", &move_dsp.SetPoint, "0.");
00251   xrm.Get("nano_manipulator.move_dsp.usrCP", &move_dsp.usrCP, "0.05");
00252   xrm.Get("nano_manipulator.move_dsp.usrCI", &move_dsp.usrCI, "0.05");
00253   xrm.Get("nano_manipulator.move_dsp.usrCS", &move_dsp.CS, "0.0");
00254   xrm.Get("nano_manipulator.move_dsp.MV_stepsize", &move_dsp.MV_stepsize, "1");
00255   xrm.Get("nano_manipulator.move_dsp.MV_nRegel", &move_dsp.MV_nRegel, "1");
00256 
00257 
00258   AppWidgetInit("Nano Manipulator Control");
00259 
00260   box = gtk_vbox_new (FALSE, 0);
00261   gtk_widget_show (box);
00262   gtk_box_pack_start (GTK_BOX (vbox), box, TRUE, TRUE, 0);
00263 
00264   hbox = gtk_hbox_new (FALSE, 0);
00265   gtk_widget_show (hbox);
00266   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
00267 
00268   // ========================================
00269 #define MYGTK_INPUT(L)  mygtk_create_input(L, vbox_param, hbox_param, 50, 70);
00270 
00271   frame_param = gtk_frame_new (N_("Settings for movements"));
00272   gtk_widget_show (frame_param);
00273   gtk_container_add (GTK_CONTAINER (hbox), frame_param);
00274 
00275   vbox_param = gtk_vbox_new (FALSE, 0);
00276   gtk_widget_show (vbox_param);
00277   gtk_container_add (GTK_CONTAINER (frame_param), vbox_param);
00278 
00279 
00280   input = MYGTK_INPUT("U");
00281   ec = new Gtk_EntryControl (Volt, MLD_WERT_NICHT_OK, &move_dsp.UTunnel, -10., 10., "5g", input);
00282   EC_list = g_slist_prepend( EC_list, ec);
00283 
00284   input = MYGTK_INPUT("I");
00285   ec = new Gtk_EntryControl (Current, MLD_WERT_NICHT_OK, &move_dsp.ITunnelSoll, 0.001, 50., "5g", input);
00286   EC_list = g_slist_prepend( EC_list, ec);
00287 
00288   input = MYGTK_INPUT("SP");
00289   ec = new Gtk_EntryControl (Force, MLD_WERT_NICHT_OK, &move_dsp.SetPoint, -10000., 10000., "5g", input);
00290   EC_list = g_slist_prepend( EC_list, ec);
00291 
00292   input = MYGTK_INPUT("CP");
00293   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &move_dsp.usrCP, 0., 10., "5g", input);
00294   EC_list = g_slist_prepend( EC_list, ec);
00295 
00296   input = MYGTK_INPUT("CI");
00297   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &move_dsp.usrCI, 0., 10., "5g", input);
00298   EC_list = g_slist_prepend( EC_list, ec);
00299 
00300   input = MYGTK_INPUT("CS");
00301   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &move_dsp.CS, 0., 2., "5g", input);
00302   EC_list = g_slist_prepend( EC_list, ec);
00303 
00304   input = MYGTK_INPUT("Speed");
00305   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &move_dsp.MV_stepsize, 1., 100., "4.0f", input);
00306   EC_list = g_slist_prepend( EC_list, ec);
00307 
00308   input = MYGTK_INPUT("#Loops");
00309   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &move_dsp.MV_nRegel, 1., 1000., "4.0f", input);
00310   EC_list = g_slist_prepend( EC_list, ec);
00311 
00312   // ========================================
00313   frame_param = gtk_frame_new (N_("Settings for actions"));
00314   gtk_widget_show (frame_param);
00315   gtk_container_add (GTK_CONTAINER (hbox), frame_param);
00316 
00317   vbox_param = gtk_vbox_new (FALSE, 0);
00318   gtk_widget_show (vbox_param);
00319   gtk_container_add (GTK_CONTAINER (frame_param), vbox_param);
00320 
00321 
00322   input = MYGTK_INPUT("U");
00323   ec = new Gtk_EntryControl (Volt, MLD_WERT_NICHT_OK, &action_dsp.UTunnel, -10., 10., "5g", input);
00324   EC_list = g_slist_prepend( EC_list, ec);
00325 
00326   input = MYGTK_INPUT("I");
00327   ec = new Gtk_EntryControl (Current, MLD_WERT_NICHT_OK, &action_dsp.ITunnelSoll, 0.001, 50., "5g", input);
00328   EC_list = g_slist_prepend( EC_list, ec);
00329 
00330   input = MYGTK_INPUT("SP");
00331   ec = new Gtk_EntryControl (Force, MLD_WERT_NICHT_OK, &action_dsp.SetPoint, -10000., 10000., "5g", input);
00332   EC_list = g_slist_prepend( EC_list, ec);
00333 
00334   input = MYGTK_INPUT("CP");
00335   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &action_dsp.usrCP, 0., 10., "5g", input);
00336   EC_list = g_slist_prepend( EC_list, ec);
00337 
00338   input = MYGTK_INPUT("CI");
00339   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &action_dsp.usrCI, 0., 10., "5g", input);
00340   EC_list = g_slist_prepend( EC_list, ec);
00341 
00342   input = MYGTK_INPUT("CS");
00343   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &action_dsp.CS, 0., 2., "5g", input);
00344   EC_list = g_slist_prepend( EC_list, ec);
00345 
00346   input = MYGTK_INPUT("Speed");
00347   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &action_dsp.MV_stepsize, 1., 100., "4.0f", input);
00348   EC_list = g_slist_prepend( EC_list, ec);
00349 
00350   input = MYGTK_INPUT("#Loops");
00351   ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &action_dsp.MV_nRegel, 1., 1000., "4.0f", input);
00352   EC_list = g_slist_prepend( EC_list, ec);
00353 
00354   // ========================================
00355   frame_param = gtk_frame_new (N_("Current Nano Manipulator Position"));
00356   gtk_widget_show (frame_param);
00357   gtk_container_add (GTK_CONTAINER (vbox), frame_param);
00358 
00359   vbox_param = gtk_vbox_new (FALSE, 0);
00360   gtk_widget_show (vbox_param);
00361   gtk_container_add (GTK_CONTAINER (frame_param), vbox_param);
00362 
00363 
00364 // Current Position/Values
00365   input = mygtk_create_input("XYZ:", vbox_param, hbox_param);
00366   ec = new Gtk_EntryControl 
00367           (nano_manipulator_pi.app->xsm->X_Unit, MLD_WERT_NICHT_OK, &td_current.x,
00368            nano_manipulator_pi.app->xsm->XOffsetMin(), nano_manipulator_pi.app->xsm->XOffsetMax(), 
00369            nano_manipulator_pi.app->xsm->AktUnit->prec1, input);
00370   EC_list = g_slist_prepend( EC_list, ec);
00371   EC_pos_list = g_slist_prepend( EC_pos_list, ec);
00372 
00373   input = mygtk_add_input(hbox_param);
00374   ec = new Gtk_EntryControl 
00375           (nano_manipulator_pi.app->xsm->Y_Unit, MLD_WERT_NICHT_OK, &td_current.y,
00376            nano_manipulator_pi.app->xsm->YOffsetMin(), nano_manipulator_pi.app->xsm->YOffsetMax(), 
00377            nano_manipulator_pi.app->xsm->AktUnit->prec1, input);
00378   EC_list = g_slist_prepend( EC_list, ec);
00379   EC_pos_list = g_slist_prepend( EC_pos_list, ec);
00380 
00381 // Limits to fix...     
00382   input = mygtk_add_input(hbox_param);
00383   ec = new Gtk_EntryControl 
00384           (nano_manipulator_pi.app->xsm->Z_Unit, MLD_WERT_NICHT_OK, &td_current.z,
00385            nano_manipulator_pi.app->xsm->YOffsetMin(), nano_manipulator_pi.app->xsm->YOffsetMax(), 
00386            nano_manipulator_pi.app->xsm->AktUnit->prec1, input);
00387   EC_list = g_slist_prepend( EC_list, ec);
00388   EC_pos_list = g_slist_prepend( EC_pos_list, ec);
00389 
00390 // ---
00391         
00392   input = mygtk_create_input("I,V1,V2:", vbox_param, hbox_param);
00393   ec = new Gtk_EntryControl 
00394           (Current, MLD_WERT_NICHT_OK, &td_current.v[0],
00395            -100000., 100000., 
00396            "g", input);
00397   EC_list = g_slist_prepend( EC_list, ec);
00398   EC_pos_list = g_slist_prepend( EC_pos_list, ec);
00399 
00400 //  input = mygtk_create_input("Scale XY", vbox_param, hbox_param);
00401 //  ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &XScale, -1e8, 1e8, "5g", input);
00402 //  EC_list = g_slist_prepend( EC_list, ec);
00403 //  input = mygtk_add_input(hbox_param);
00404 //  ec = new Gtk_EntryControl (Unity, MLD_WERT_NICHT_OK, &YScale, -1e8, 1e8, "5g", input);
00405 //  EC_list = g_slist_prepend( EC_list, ec);
00406 
00407 // PlotFile
00408 //  input = mygtk_create_input("PlotFile", vbox_param, hbox_param);
00409 //  gtk_object_set_data( GTK_OBJECT (vbox), "PlotFileEntry", input);
00410 //  gtk_signal_connect (GTK_OBJECT (input), "changed",
00411 //                          GTK_SIGNAL_FUNC (cbbasename),
00412 //                          this);
00413 // G_FREE_STRDUP(PlotFile, gtk_entry_get_text (GTK_ENTRY (gtk_object_get_data( GTK_OBJECT (as_control))),
00414 
00415 // Run Button
00416   GtkWidget *button = gtk_button_new_with_label("Start Plot");
00417   gtk_widget_show (button);
00418   gtk_box_pack_start (GTK_BOX (hbox_param), button, TRUE, TRUE, 0);
00419 //  gtk_object_set_data( GTK_OBJECT (button), "PlotFileEntry", input);
00420   gtk_signal_connect ( GTK_OBJECT (button), "pressed",
00421                        GTK_SIGNAL_FUNC (nano_manipulatorControl::RunPlott),
00422                        this);
00423 
00424 // CmdList
00425 
00426   // save List away...
00427   gtk_object_set_data( GTK_OBJECT (widget), "NANOPLOTT_EC_list", EC_list);
00428   gtk_object_set_data( GTK_OBJECT (widget), "NANOPLOTT_EC_POS_list", EC_pos_list);
00429 
00430 
00431   // connect to DSP
00432   devpcdspmon = open(xsmres.DSPDev, O_RDWR);
00433   lseek(devpcdspmon, (DSP_OSZI_CH12) << 2, SEEK_SET);
00434 
00435 }
00436 
00437 nano_manipulatorControl::~nano_manipulatorControl (){
00438 
00439         close (devpcdspmon);
00440 
00441         XsmRescourceManager xrm("Pluginnano_manipulatorControl");
00442         xrm.Put("nano_manipulator.X", td_current.x);
00443         xrm.Put("nano_manipulator.Y", td_current.y);
00444         xrm.Put("nano_manipulator.action_dsp.ITunnelSoll", action_dsp.ITunnelSoll);
00445         xrm.Put("nano_manipulator.action_dsp.UTunnel", action_dsp.UTunnel);
00446         xrm.Put("nano_manipulator.action_dsp.SetPoint", action_dsp.SetPoint);
00447         xrm.Put("nano_manipulator.action_dsp.usrCP", action_dsp.usrCP);
00448         xrm.Put("nano_manipulator.action_dsp.usrCI", action_dsp.usrCI);
00449         xrm.Put("nano_manipulator.action_dsp.usrCS", action_dsp.CS);
00450         xrm.Put("nano_manipulator.action_dsp.MV_stepsize", action_dsp.MV_stepsize);
00451         xrm.Put("nano_manipulator.action_dsp.MV_nRegel", action_dsp.MV_nRegel);
00452         xrm.Put("nano_manipulator.move_dsp.ITunnelSoll", move_dsp.ITunnelSoll);
00453         xrm.Put("nano_manipulator.move_dsp.Umove", move_dsp.UTunnel);
00454         xrm.Put("nano_manipulator.move_dsp.SetPoint", move_dsp.SetPoint);
00455         xrm.Put("nano_manipulator.move_dsp.usrCP", move_dsp.usrCP);
00456         xrm.Put("nano_manipulator.move_dsp.usrCI", move_dsp.usrCI);
00457         xrm.Put("nano_manipulator.move_dsp.usrCS", move_dsp.CS);
00458         xrm.Put("nano_manipulator.move_dsp.MV_stepsize", move_dsp.MV_stepsize);
00459         xrm.Put("nano_manipulator.move_dsp.MV_nRegel", move_dsp.MV_nRegel);
00460         
00461         delete Unity;
00462         delete Volt;
00463         delete Current;
00464         delete Force;
00465 }
00466 
00467 void nano_manipulatorControl::update(){
00468   g_slist_foreach((GSList*)gtk_object_get_data( GTK_OBJECT (widget), "NANOPLOTT_EC_list"),
00469                   (GFunc) App::update_ec, NULL);
00470 }
00471 
00472 void nano_manipulatorControl::update_pos(){
00473   g_slist_foreach((GSList*)gtk_object_get_data( GTK_OBJECT (widget), "NANOPLOTT_EC_POS_list"),
00474                   (GFunc) App::update_ec, NULL);
00475 }
00476 
00477 void nano_manipulatorControl::RunPlott(GtkWidget *widget, nano_manipulatorControl *npc){
00478 /*
00479         npc->SetNewParam (&npc->move_dsp);
00480         npc->GoToPosition (x, y);
00481 
00482         if (nano_manipulator_pi.app->xsm->ActiveScan)
00483                 if (nano_manipulator_pi.app->xsm->ActiveScan->view)
00484                         nano_manipulator_pi.app->xsm->ActiveScan->view->add_object (0, (gpointer) xy);
00485 
00486         npc->SetNewParam (&npc->action_dsp);
00487         npc->GoToPosition (x, y);
00488 
00489         if (nano_manipulator_pi.app->xsm->ActiveScan)
00490                 if (nano_manipulator_pi.app->xsm->ActiveScan->view)
00491                         nano_manipulator_pi.app->xsm->ActiveScan->view->add_object (0, (gpointer) xy);
00492 
00493         npc->SetNewParam (&nano_manipulator_pi.app->xsm->data.hardpars);
00494 */
00495 
00496         double ch[8];
00497         static unsigned long dposzibuf[30];
00498         unsigned long *dp;
00499         union dpram_DataPack{ 
00500                 unsigned long l;
00501                 struct { signed short lo:16;
00502                         signed short hi:16; 
00503                 } ii;
00504         } datapack;
00505         
00506         read (npc->devpcdspmon, dposzibuf, sizeof(long)*10);
00507         
00508         dp = dposzibuf;
00509         datapack.l = *dp++;
00510         ch[0] = (double)datapack.ii.lo * 10./32767.;
00511         ch[1] = (double)datapack.ii.hi * 10./32767.;
00512         datapack.l = *dp++;
00513         ch[2] = (double)datapack.ii.lo * 10./32767.;
00514         ch[3] = (double)datapack.ii.hi * 10./32767.;
00515         datapack.l = *dp++;
00516         ch[4] = (double)datapack.ii.lo * 10./32767.;
00517         ch[5] = (double)datapack.ii.hi * 10./32767.;
00518         datapack.l = *dp++;
00519         ch[6] = (double)datapack.ii.lo * 10./32767.;
00520         ch[7] = (double)datapack.ii.hi * 10./32767.;
00521 
00522         npc->td_current.x = ch[6];
00523         npc->td_current.y = ch[7];
00524         npc->td_current.z = ch[4];
00525         npc->td_current.v[0] = ch[0];
00526         npc->td_current.v[1] = ch[1];
00527         npc->td_current.v[2] = ch[5];
00528 
00529         npc->update_pos();
00530 
00531 }
00532 
00533 void nano_manipulatorControl::SetNewParam(DSP_Param *dsp){
00534         dsp->CP = dsp->usrCP/nano_manipulator_pi.app->xsm->Inst->VZ();
00535         dsp->CI = dsp->usrCI/nano_manipulator_pi.app->xsm->Inst->VZ();
00536         nano_manipulator_pi.app->xsm->hardware->PutParameter(dsp);
00537 }
00538 
00539 
00540 void nano_manipulatorControl::GoToPosition(double x, double y){
00541         nano_manipulator_pi.app->xsm->hardware->SetOffset(
00542                 R2INT(nano_manipulator_pi.app->xsm->Inst->X0A2Dig(x)),
00543                 R2INT(nano_manipulator_pi.app->xsm->Inst->Y0A2Dig(y)));
00544 }

Generated on Sat Apr 1 09:04:13 2006 for GXSM by  doxygen 1.4.6