diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml
index 0d03f48..ef89995 100644
--- a/.github/workflows/check-arduino.yml
+++ b/.github/workflows/check-arduino.yml
@@ -23,6 +23,6 @@ jobs:
with:
compliance: specification
# Change this to "update" once the library is added to the index.
- library-manager: submit
+ library-manager: update
# Always use this setting for official repositories. Remove for 3rd party projects.
official: true
diff --git a/.github/workflows/compile-examples-private.yml b/.github/workflows/compile-examples.yml
similarity index 62%
rename from .github/workflows/compile-examples-private.yml
rename to .github/workflows/compile-examples.yml
index 35f1406..346d3dd 100644
--- a/.github/workflows/compile-examples-private.yml
+++ b/.github/workflows/compile-examples.yml
@@ -4,13 +4,13 @@ name: Compile Examples
on:
push:
paths:
- - ".github/workflows/compile-examples-private.ya?ml"
+ - ".github/workflows/compile-examples.ya?ml"
- "library.properties"
- "examples/**"
- "src/**"
pull_request:
paths:
- - ".github/workflows/compile-examples-private.ya?ml"
+ - ".github/workflows/compile-examples.ya?ml"
- "library.properties"
- "examples/**"
- "src/**"
@@ -22,8 +22,6 @@ on:
env:
SKETCHES_REPORTS_PATH: sketches-reports
- SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
-
jobs:
build:
name: ${{ matrix.board.fqbn }}
@@ -65,26 +63,4 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
- name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
-
- report-size-deltas:
- needs: build
- # Run even if some compilations failed.
- if: always() && github.event_name == 'pull_request'
- runs-on: ubuntu-latest
-
- steps:
- - name: Download sketches reports artifact
- id: download-artifact
- continue-on-error: true # If compilation failed for all boards then there are no artifacts
- uses: actions/download-artifact@v2
- with:
- name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
- path: ${{ env.SKETCHES_REPORTS_PATH }}
-
- - name: Comment size deltas report to PR
- uses: arduino/report-size-deltas@v1
- # If actions/download-artifact failed, there are no artifacts to report from.
- if: steps.download-artifact.outcome == 'success'
- with:
- sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
+ name: ${{ env.SKETCHES_REPORTS_PATH }}
diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml
new file mode 100644
index 0000000..30b6ca0
--- /dev/null
+++ b/.github/workflows/report-size-deltas.yml
@@ -0,0 +1,24 @@
+name: Report Size Deltas
+
+# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
+on:
+ push:
+ paths:
+ - ".github/workflows/report-size-deltas.ya?ml"
+ schedule:
+ # Run at the minimum interval allowed by GitHub Actions.
+ # Note: GitHub Actions periodically has outages which result in workflow failures.
+ # In this event, the workflows will start passing again once the service recovers.
+ - cron: "*/5 * * * *"
+ workflow_dispatch:
+ repository_dispatch:
+
+jobs:
+ report:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Comment size deltas reports to PRs
+ uses: arduino/report-size-deltas@v1
+ with:
+ # The name of the workflow artifact created by the sketch compilation workflow
+ sketches-reports-source: sketches-reports
diff --git a/README.md b/README.md
index 374c960..2eee7bc 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
-`Braccio++`
-===========
+`Arduino_Braccio_plusplus`
+==========================
-[](https://github.com/arduino-libraries/Braccio_v2_library/actions/workflows/check-arduino.yml)
-[](https://github.com/arduino-libraries/Braccio_v2_library/actions/workflows/compile-examples-private.yml)
-[](https://github.com/arduino-libraries/Braccio_v2_library/actions/workflows/spell-check.yml)
+[](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/check-arduino.yml)
+[](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/compile-examples.yml)
+[](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/spell-check.yml)
This library allows you to control and interact with the 6 DOF Braccio++ robot arm.
@@ -17,7 +17,7 @@ This library allows you to control and interact with the 6 DOF Braccio++ robot a
## :bug: Bugs & Issues
-If you want to report an issue with this library, you can submit it to the [issue tracker](https://github.com/arduino-libraries/Braccio_v2_library/issues) of this repository. Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board.
+If you want to report an issue with this library, you can submit it to the [issue tracker](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/issues) of this repository. Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board.
## :technologist: Development
diff --git a/examples/Tools/Factory_Set_Initial_Servo_Position/Factory_Set_Initial_Servo_Position.ino b/examples/Tools/Factory_Set_Initial_Servo_Position/Factory_Set_Initial_Servo_Position.ino
index 32cbe3c..017d55e 100644
--- a/examples/Tools/Factory_Set_Initial_Servo_Position/Factory_Set_Initial_Servo_Position.ino
+++ b/examples/Tools/Factory_Set_Initial_Servo_Position/Factory_Set_Initial_Servo_Position.ino
@@ -49,9 +49,22 @@ static std::array const INITIAL_SERVO_POSITION =
bool set_initial_servo_position(int const id, float const target_angle)
{
+ auto isTimeout = [](unsigned long const start) -> bool { return ((millis() - start) > 2000); };
+
+ auto start = millis();
+
Serial.print("Connecting .... ");
- for (; !Braccio.get(id).connected(); delay(10)) { }
- Serial.println("OK.");
+ for (; !Braccio.get(id).connected() && !isTimeout(start); delay(10)) { }
+ if (!isTimeout(start))
+ Serial.println("OK.");
+ else
+ {
+ Serial.print("Error: Can not connect to servo ");
+ Serial.print(id);
+ Serial.println(" within time limit.");
+ Serial.println();
+ return false;
+ }
delay(500);
Serial.print("Disengaging ... ");
@@ -65,14 +78,12 @@ bool set_initial_servo_position(int const id, float const target_angle)
delay(500);
/* Drive to the position for assembling the servo horn. */
- auto const start = millis();
- auto isTimeout = [start]() -> bool { return ((millis() - start) > 5000); };
auto isTargetAngleReached = [target_angle, id](float const epsilon) -> bool { return (fabs(Braccio.get(id).position() - target_angle) <= epsilon); };
static float constexpr EPSILON = 2.0f;
for ( float current_angle = Braccio.get(id).position();
- !isTargetAngleReached(EPSILON) && !isTimeout();)
+ !isTargetAngleReached(EPSILON) && !isTimeout(start);)
{
Braccio.get(id).move().to(target_angle).in(200ms);
delay(250);
@@ -82,16 +93,25 @@ bool set_initial_servo_position(int const id, float const target_angle)
Serial.println(msg);
}
- if (!isTargetAngleReached(EPSILON)) {
- Serial.println("Servo did not reach target angle.");
+ if (!isTargetAngleReached(EPSILON))
+ {
+ Serial.print("Error: Servo ");
+ Serial.print(id);
+ Serial.print(" did not reach target angle.");
+ Serial.println();
return false;
}
- if (isTimeout()) {
- Serial.println("Timeout error.");
+ if (isTimeout(start))
+ {
+ Serial.print("Error: Servo ");
+ Serial.print(id);
+ Serial.println(" did not reach target angle within time limit.");
+ Serial.println();
return false;
}
+ Serial.println("Calibration ... OK");
return true;
}
@@ -104,29 +124,39 @@ void setup()
Serial.begin(115200);
while(!Serial) { }
- if (!Braccio.begin()) {
+ if (!Braccio.begin(nullptr, false)) {
Serial.println("Braccio.begin() failed.");
for(;;) { }
}
Braccio.disengage();
+ int success_cnt = 0;
for (auto & servo : INITIAL_SERVO_POSITION)
{
Serial.print("Servo ");
Serial.print(servo.id());
Serial.print(": Target Angle = ");
Serial.print(servo.angle());
- Serial.print(" °");
Serial.println();
- if (!set_initial_servo_position(servo.id(), servo.angle())) {
- Serial.println("ERROR.");
- return;
- }
+ if (set_initial_servo_position(servo.id(), servo.angle()))
+ success_cnt++;
}
- Serial.println("SUCCESS : all servos are set to their initial position.");
+ if (success_cnt == SmartServoClass::NUM_MOTORS)
+ {
+ Serial.println("SUCCESS : all servos are set to their initial position.");
+ }
+ else
+ {
+ Serial.print("ERROR: only ");
+ Serial.print(success_cnt);
+ Serial.print(" of ");
+ Serial.print(SmartServoClass::NUM_MOTORS);
+ Serial.print(" could be set to the desired initial position.");
+ Serial.println();
+ }
}
void loop()
diff --git a/library.properties b/library.properties
index 0db5f7c..e169b29 100644
--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
name=Arduino_Braccio_plusplus
-version=1.0.0
+version=1.1.0
author=Arduino
maintainer=Arduino
sentence=Board support library for the Arduino Braccio++ 6-DOF robot arm.
diff --git a/src/Braccio++.cpp b/src/Braccio++.cpp
index 45d5cde..fa11655 100644
--- a/src/Braccio++.cpp
+++ b/src/Braccio++.cpp
@@ -93,7 +93,7 @@ BraccioClass::BraccioClass()
* PUBLIC MEMBER FUNCTIONS
**************************************************************************************/
-bool BraccioClass::begin(voidFuncPtr custom_menu)
+bool BraccioClass::begin(voidFuncPtr custom_menu, bool const wait_for_all_motor_connected)
{
static int constexpr RS485_RX_PIN = 1;
@@ -140,13 +140,16 @@ bool BraccioClass::begin(voidFuncPtr custom_menu)
_motors_connected_thd.start(mbed::callback(this, &BraccioClass::motorConnectedThreadFunc));
- /* Wait for all motors to be actually connected. */
- for (int id = SmartServoClass::MIN_MOTOR_ID; id <= SmartServoClass::MAX_MOTOR_ID; id++)
+ if (wait_for_all_motor_connected)
{
- auto const start = millis();
- auto isTimeout = [start]() -> bool { return ((millis() - start) > 5000); };
- for(; !isTimeout() && !connected(id); delay(100)) { }
- if (isTimeout()) return false;
+ /* Wait for all motors to be actually connected. */
+ for (int id = SmartServoClass::MIN_MOTOR_ID; id <= SmartServoClass::MAX_MOTOR_ID; id++)
+ {
+ auto const start = millis();
+ auto isTimeout = [start]() -> bool { return ((millis() - start) > 5000); };
+ for(; !isTimeout() && !connected(id); delay(100)) { }
+ if (isTimeout()) return false;
+ }
}
return true;
diff --git a/src/Braccio++.h b/src/Braccio++.h
index f4c10ed..4dd1a9f 100644
--- a/src/Braccio++.h
+++ b/src/Braccio++.h
@@ -65,8 +65,8 @@ class BraccioClass
BraccioClass();
inline bool begin() { return begin(nullptr); }
- bool begin(voidFuncPtr custom_menu);
-
+ inline bool begin(voidFuncPtr custom_menu) { return begin(custom_menu, true); }
+ bool begin(voidFuncPtr custom_menu, bool const wait_for_all_motor_connected);
void pingOn();
void pingOff();