Hello Guest it is April 26, 2024, 01:05:40 PM

Author Topic: USB plugin don't fill Trajectories array  (Read 22298 times)

0 Members and 1 Guest are viewing this topic.

Re: USB plugin don't fill Trajectories array
« Reply #20 on: September 22, 2011, 06:53:21 AM »
with the rar file?
Re: USB plugin don't fill Trajectories array
« Reply #21 on: September 22, 2011, 06:56:29 AM »
With RAR it is ok
Re: USB plugin don't fill Trajectories array
« Reply #22 on: September 22, 2011, 07:05:15 AM »
Ok, I have looked at it.

I strongly recommend you to use my virtual plugin as startup.I managed to get most vital variables setup properly, so it does simulate work ( have not checked it with your M3 code however).

I found out why your code stalls - you need to set "MainPlanner->ExternalStill = true;" once you finish your movement or you reset your plugin.
You also do not update line position, so Mach does not show properly GCode line position.
Re: USB plugin don't fill Trajectories array
« Reply #23 on: September 23, 2011, 03:41:31 AM »
Hi! i have tried your plugin and it work but this happen:
1) start M3
2) load gcode
3) push reset button
4) push start button...
The system is blocked as shown in attached figure, with Dwell led that blink, is it normal?
i push stop, push reset twice, and start... the application start.

This is the same thing is happening in my plugin ... but in my, position and the line of gcode still are not updated.

thanks
Re: USB plugin don't fill Trajectories array
« Reply #24 on: September 23, 2011, 03:49:40 AM »
Try to set    Engine->DwellTime = 0; in  ::Dwell(double time) call.

See code in my example which touches "Engine->DisplayLine"  as reference how to update GCode line
Re: USB plugin don't fill Trajectories array
« Reply #25 on: September 23, 2011, 04:01:27 AM »
Try to set    Engine->DwellTime = 0; in  ::Dwell(double time) call.
ok, in this way work well!

About dwelling - in some cases ( like M3, when the spindle starts) you need to process Mach request to "delay" motion processing. You need stat machine in your plugin ( for this and e.g. jogging and homeing). Your plugin is "locked" until you finish the request.

If I had not put the dwell to 0, the user does not have access to the code of the plugin as it could solve?
Re: USB plugin don't fill Trajectories array
« Reply #26 on: September 23, 2011, 04:12:33 AM »
Dwelling tells your plugin to stop processing ( and executing) movement as e.g. spindle needs some time to reach its operational speeds ( may take few seconds). That is why you have noticed it after M3 ( it enables spindle ). But this is only one of few possible cases

In final version you should process the delay time given in Dwell(double time) call - meaning you should create state machine which waits until the delay expires and then set Engine->DwellTime = 0;


void MyDeviceClass::HandleSequences(void)
{

....

  switch(sequence)
  {

      case SEQ_DWELLING:
      {
         if(GetTickCount() - DwellTimestamp > DwellDelay)
         {
            // Well, dwelling time has expired
            Engine->DwellTime = 0;
            sequence          = SEQ_IDLE;
         }
      }break;


   




Re: USB plugin don't fill Trajectories array
« Reply #27 on: September 23, 2011, 04:13:03 AM »
//
 void MyDeviceClass::Dwell(double time)
 {

   // Calculate dwell time and record timestamp - will be serviced from state machine
   if( !MainPlanner->DwellMilli )
   {
      time = time * 1000;
   }
   
   DwellTimestamp  = GetTickCount();
   DwellDelay      = (DWORD)time;

   // Tell Mach we are dwelling
   Engine->DwellTime = 1;

   // There is silent assumption that dwell request will  come
   // only during GCode execution, when there is no other sequences running
   // ( no homing,jogging probing - etc.)
   assert( (sequence == SEQ_IDLE) || (sequence == SEQ_DWELLING) );

   sequence = SEQ_DWELLING;


   stats.DwellCall++;
 }
Re: USB plugin don't fill Trajectories array
« Reply #28 on: September 30, 2011, 03:17:01 AM »
I found out why your code stalls - you need to set "MainPlanner->ExternalStill = true;" once you finish your movement or you reset your plugin.
You also do not update line position, so Mach does not show properly GCode line position.

Hi jarekk,
I have a question for you! I have insert in the update function this code
Code: [Select]
//If these ring buffer pointers are not equal, we have movement waiting..
if( Engine->TrajHead != Engine->TrajIndex)


//if Mavg is not set properly for the coming movement, set it now in a dwell message of 0 dwell
  while ( Engine->TrajHead != Engine->TrajIndex )
  {
Engine->DisplayLine = Engine->Trajectories[ Engine->TrajIndex ].ID;

Engine->TrajIndex++;  //increment ring
Engine->TrajIndex &= 0xfff; //rotate the ring if necessary..
  }
}
if( (Engine->TrajHead == Engine->TrajIndex) &&  MainPlanner->BufferEnding )
{
finalizeMoves();
}

and i have set a breakpoin in finalizeMoves function... but M3 stop in this function only when have read the last line of GCode. it is correctly?

The axis position and tool tool view are not updated. why? i don't understand!!!! help me!

thanks for help

Marco
Re: USB plugin don't fill Trajectories array
« Reply #29 on: October 01, 2011, 12:56:37 AM »
About th M3 stop - Well, I do not understand what you really mean.


About the position update - have you analyzed my code at all ? :P

It is your responsiibility to update Mach variables  - it is your plugin which is supposed to create motion according to given trajectory and report back the result ( as position).

Once uoy update position, you will also get tool view updated.