Skip to content

Commit

Permalink
Fix angle limit error
Browse files Browse the repository at this point in the history
  • Loading branch information
TopGun committed Aug 10, 2020
1 parent be08b9a commit 8a243e2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8,101 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Swift Pro Firmware V4.7.0 (Base on [Grbl v0.9j](https://github.com/grbl/grbl) )
# Swift Pro Firmware V4.8.0 (Base on [Grbl v0.9j](https://github.com/grbl/grbl) )

----------
## Update Summary for v4.7.0
## Update Summary for v4.8.0

* Add M2211 cmd to read external EEPROM
* Add M2212 cmd to write external EEPROM
* Add P2244 cmd to get the communication status of AS5600
* Fix read bug of work mode
* Fix angle limit error

## Caution
#### The current firmware is not perfect and will be updated periodically
Expand Down
Empty file modified doc/uArm Swift Pro Protocol V4.0.5_cn .pdf
100644 → 100755
Empty file.
Empty file modified doc/uArm Swift Pro Protocol V4.0.5_en .pdf
100644 → 100755
Empty file.
3,953 changes: 0 additions & 3,953 deletions hex/uArm3Plus_V4.5.0_release_20190924.hex

This file was deleted.

4,128 changes: 0 additions & 4,128 deletions hex/uArmPro_V4.7.0_release_20200710.hex

This file was deleted.

32 changes: 21 additions & 11 deletions src/uarm_coord_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
#define micro_steps (32.0)
#define steps_per_angle (micro_steps/1.8*gearbox_ratio)
#define ARMA_MAX_ANGLE (135.6)
#define ARMA_MIN_ANGLE (0)
#define ARMA_MIN_ANGLE (-4.0)
#define ARMB_MAX_ANGLE (119.9)
#define ARMB_MIN_ANGLE (0)
#define ARMB_MIN_ANGLE (-4.0)
#define BASE_MAX_ANGLE (90)
#define BASE_MIN_ANGLE (-90)
#define ARMA_ARMB_MAX_ANGLE (151)
Expand Down Expand Up @@ -124,10 +124,10 @@ void angle_to_coord(float anglea, float angleb, float anglec, float *x, float *y
void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, float *anglec){


/* DB_PRINT_STR("coord xyz:");
DB_PRINT_FLOAT(x);DB_PRINT_STR(" ");
DB_PRINT_FLOAT(y);DB_PRINT_STR(" ");
DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n"); */
// DB_PRINT_STR("coord xyz:");
// DB_PRINT_FLOAT(x);DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(y);DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n");



Expand All @@ -140,13 +140,23 @@ void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, flo


*anglea = acos((_stretch * xxx - _height * sqrt(4.0 * ARM_A2 * xx - xxx * xxx)) / (xx * 2.0 * ARM_A)) * RAD_TO_DEG;

// get angle B
xxx = ARM_B2 -ARM_A2 + xx;
*angleb = acos((_stretch * xxx + _height * sqrt(4.0 * ARM_B2 * xx -xxx * xxx)) / (xx * 2.0 * ARM_B)) * RAD_TO_DEG;
if( _height > (ARM_A *sin(*anglea/RAD_TO_DEG)) ){
*angleb = -*angleb;
}

// DB_PRINT_FLOAT(fabs(z));DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(ARM_B *sin(*angleb/RAD_TO_DEG));DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n");


if( fabs(_height)>(ARM_B *sin(*angleb/RAD_TO_DEG)) && _height<0.0 ){
*anglea = -*anglea;
}



// get the base rotation angle

Expand All @@ -163,10 +173,10 @@ void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, flo
}


/* DB_PRINT_STR("coord abc:");
DB_PRINT_FLOAT(*anglea);DB_PRINT_STR(" ");
DB_PRINT_FLOAT(*angleb);DB_PRINT_STR(" ");
DB_PRINT_FLOAT(*anglec);DB_PRINT_STR("\r\n");*/
// DB_PRINT_STR("coord abc:");
// DB_PRINT_FLOAT(*anglea);DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(*angleb);DB_PRINT_STR(" ");
// DB_PRINT_FLOAT(*anglec);DB_PRINT_STR("\r\n");
}

void get_current_step(float anglea, float angleb, float anglec, float *x_step, float *y_step, float *z_step){
Expand Down
6 changes: 3 additions & 3 deletions src/uarm_swift.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@


#if defined(UARM_MINI)
#define DEVICE_NAME "SwiftProMini"
#define DEVICE_NAME "uArmMini"
#elif defined(UARM_2500)
#define DEVICE_NAME "uArm3Plus"
#else
#define DEVICE_NAME "SwiftPro"
#endif

#define HARDWARE_VERSION hardware_version
#define SOFTWARE_VERSION "V4.7.0"
#define API_VERSION "V4.0.4"
#define SOFTWARE_VERSION "V4.8.0"
#define API_VERSION "V4.0.5"
#define BLE_UUID bt_mac_addr


Expand Down

0 comments on commit 8a243e2

Please sign in to comment.