Makelangelo 7.2.4-alpha

Shop Forum Makelangelo Polargraph Art Robot Makelangelo 7.2.4-alpha

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8575
    Dan
    Keymaster

    https://github.com/MarginallyClever/Makelangelo/releases/tag/7.2.4-alpha

    A bug report yesterday (thanks, @shadyoaks!) showed us that many language translations were missing. I’ve patched the missing strings in with default english where you would expect your local language.

    Please see https://github.com/MarginallyClever/Makelangelo/tree/dev/java/src/main/resources/languages
    for your preferred language. Share your updated version so I can help you better.

    Thank you!

    #8576
    Anonymous
    Inactive

    Receiving exact same error as in 7.2.3 alpha both in win7 32bit and win 64 bit system. I am renaming the Makelangelo-v7.2.4-alpha-with-dependencies.jar to Makelangelo.jar and doing nothing with the Makelangelo-v7.2.4-alpha.jar file. then running the bat file.

    #8581
    Anonymous
    Inactive

    Hello I’m trying to use your code for my project. The lines are working fine. but the arcs does not work fine.
    In this code in the arc function do we need to send abosolute coordinates of the center of the circle or incremental distances? i sent absolute coordinates. but the x and y motors does not work at the same time instead it goes to desired end point at different times in straight lines. Could you please help me resolving this errors.

    #include <math.h>
    
    #define STEPS_PER_TURN (200)
    #define MIN_STEP_DELAY (500.0)
    #define MAX_FEEDRATE   (1000000.0/MIN_STEP_DELAY)
    #define MIN_FEEDRATE   (0.01)
    
    // Arcs are split into many line segments.  How long are the segments?
    #define MM_PER_SEGMENT  (1)
    
    int dirPin_x=12,dirPin_y=7; // stepper motor pins
    int stepperPin_x=13,stepperPin_y=8; // stepper pulse output pins
    
    float px,py; //location
    
    //speeds
    float fr=0; //human version
    long step_delay; // machine version
    
    //settings
    char mode_abs=1; // absolut mode?
    
    //////////////////////////////////////////////// METHODS ///////////////////////////////////
    /*
     * uses bresenhams.'s line algorithm to move both motos
     * @input newx the destination x position
     * @input newy the destination y position
     */
     
    void line(double newx,double newy){
    
      Serial.println("Came to line drawing");
    
      double dx = newx - px;//distance to move(delta)
      double dy = newy - py;
    
      int dir_x,dir_y;
      dir_x=dx>0?1:0; // direction to move
      dir_y=dy>0?0:1; // because the motors are mounted in opposite directions
    
      digitalWrite(dirPin_x,dir_x);
      digitalWrite(dirPin_y,dir_y);
    
      dx=abs(dx); //absolute data
      dy=abs(dy);
    
      long i;
      long over=0;
    
      if(dx>dy)
      {
        for(i=0;i<dx;i++)
        {
          //digitalWrite(dirPin_x,dir_x);
          move_stepper_x();
          over+=dy;
    
          if(over>=dx)
          {
            over-=dx;
            //digitalWrite(dirPin_y,dir_y);
            move_stepper_y();
          }
          pause(step_delay);
          // test limits here
        }
      }
      else
      {
        for(i=0;i<dy;i++)
        {
          //digitalWrite(dirPin_y,dir_y);
          move_stepper_y();
          over+=dx;
    
          if(over>=dy)
          {
            over-=dy;
            //digitalWrite(dirPin_x,dir_x);
            move_stepper_x();
          }
          pause(step_delay); // step_dalay is a global connected to feed rate
          // test limits here . . . 
        }
      }
    
      //update the logical position.we don't just = newx because
      //px+dx*dirx==newx could be false by a tiny margin and we dont want rounding errors
    
      px=newx;
      py=newy;
      //px+=dx*direction_x;
      //py+=dy*direction_y;
      
    }
    
    /*This method assumes limits have already been checked
     * This method assumes the start and end radius match
     * THis method assumes arcs are not > 180 degrees(PI radians)
     * cx/cy - center of circle
     * x/y -end position
     * dir - ARC_CW or ARC CCW to control direction of arc 
     */
    
    static void arc(double cx,double cy,double x,double y,double dir) {
      // get radius
      double dx = px - cx;
      double dy = py - cy;
     
      double radius=sqrt(dx*dx+dy*dy);
    
      Serial.print("Radius =");
      Serial.println(radius);
    
      // find angle of arc (sweep)
      double angle1=atan3(dy,dx);
      
      double angle2=atan3(y-cy,x-cx);
      
      double theta=angle2-angle1;
      
      if(dir>0 && theta<0) angle2+=2*PI;
      else if(dir<0 && theta>0) angle1+=2*PI;
      
      theta=angle2-angle1;
    
      
      // get length of arc
      // float circ=PI*2.0*radius;
      // float len=theta*circ/(PI*2.0);
      // simplifies to
      double len = abs(theta) * radius;
    
      long int i, segments = ceil( len * MM_PER_SEGMENT );
    
     
      double nx, ny, angle3, scale;
    
      for(i=0;i<segments;++i) {
        
        // interpolate around the arc
        scale = ((double)i)/((double)segments);
    
        
        angle3 = ( theta * scale ) + angle1;
        
        nx = cx + ((cos(angle3)) * radius);
        
        ny = cy + ((sin(angle3)) * radius);
        
        line(nx,ny);
      }
      
      line(x,y);
    }
    
    /*
      * Set the logical position
      * @input npx new position x
      * @input npy new position y
      */
    void position(float npx,float npy)
      {
        //here is good place to add sanity tests
        px=npx;
        py=npy;
      }
    
    /*delay for the appropriate number of microseconds
     * @input ms how many milliseconds to wait
     */
    void pause(long ms)
    {
      delay(ms/1000);
      delayMicroseconds(ms%1000); // delayMicroseconds doesn't work for values >~16k
    }
    
     void feedrate(float nfr)
     {
      if(fr==nfr) return; // same as last time? quit now
    
      if(nfr>MAX_FEEDRATE || nfr<MIN_FEEDRATE){ // don't allow crazy feedrates
        Serial.print(F("New feedrate must be greater than "));
        Serial.print(MIN_FEEDRATE);
        Serial.print(F("steps/s and less than "));
        Serial.print(MAX_FEEDRATE); 
        Serial.println(F("steps/s."));
        return;
      }
    
      step_delay=1000000.0/nfr;
      fr=nfr;
     }
    //returns angle of dy/dx as a value from 0...2PI
    static float atan3(float dy,float dx) {
     
      float a=atan2(dy,dx);
      if(a<0) a=(PI*2.0)+a;
      return a;
    }
    
    /*
     * to move stepper motors stepper pulses are generated here
     */
     void move_stepper_x()
    {
        
        
        digitalWrite(stepperPin_x, HIGH);
        delayMicroseconds(800);
        digitalWrite(stepperPin_x, LOW);
        delayMicroseconds(800);
    }
    void move_stepper_y()
    {
        
        digitalWrite(stepperPin_y, HIGH);
        delayMicroseconds(800);
        digitalWrite(stepperPin_y, LOW);
        delayMicroseconds(800);
    }
    
    void where()
    {
     
       Serial.print("X");
       Serial.println(px);
       Serial.print("Y");
       Serial.println(py);
       Serial.print("F");
       Serial.println(fr);
      
      
      
    }
    
    ////////////////////////////////// Arduino SETUP / LOOP ////////////////////////////////
    void setup() {
     pinMode(dirPin_x, OUTPUT);
     pinMode(stepperPin_x, OUTPUT);
     pinMode(dirPin_y, OUTPUT);
     pinMode(stepperPin_y, OUTPUT);
    
     Serial.begin(9600);
    
     position(0,0); // set starting position
     feedrate((MAX_FEEDRATE + MIN_FEEDRATE)/2); // set default speed
    
    }
    
    void loop() {
    int start=0;
    
      where();
      
      position(0,0);
     
      arc(100,0,100,100,-1);
     
      where();
      
    }
    
      
    
    }
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.