Giter VIP home page Giter VIP logo

arduino_braccio_plusplus's Introduction

Arduino_Braccio_plusplus

Check Arduino status Compile Examples status Spell Check status

This library allows you to control and interact with the 6 DOF Braccio++ robot arm.

How-to-update precompiled liblvgl

git clone https://github.com/lvgl/lvgl
git clone https://github.com/arduino-libraries/Arduino_Braccio_plusplus
cd Arduino_Braccio_plusplus/extras
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8

๐Ÿ”Ž Resources

๐Ÿ› Bugs & Issues

If you want to report an issue with this library, you can submit it to the issue tracker 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.

๐Ÿง‘โ€๐Ÿ’ป Development

There are many ways to contribute:

  • Improve documentation and examples
  • Fix a bug
  • Test open Pull Requests
  • Implement a new feature
  • Discuss potential ways to improve this library

You can submit your patches directly to this repository as Pull Requests. Please provide a detailed description of the problem you're trying to solve and make sure you test on real hardware.

๐Ÿ’› Donations

This open-source code is maintained by Arduino with the help of the community. We invest a considerable amount of time in testing code, optimizing it and introducing new features. Please consider donating or sponsoring to support our work, as well as buying original Arduino boards which is the best way to make sure our effort can continue in the long term.

arduino_braccio_plusplus's People

Contributors

aentinger avatar clodpheasant avatar dependabot[bot] avatar esquirio avatar facchinm avatar metanav avatar per1234 avatar umbynos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino_braccio_plusplus's Issues

Servos not returning to original position

Hello, I have the Arduino Bracio++ kit and have a fully assembled robot. The board I am using is the included Arduino Braccio Carrier, which has the Nano RP2040.

I have tried most if not all of the examples in this library and started to write some code of my own, but encountered a possible bug where the servos are very weak after they are "disengaged" and subsequently "engaged" again.

The objective of my code is simply to do the following:

  • Upon start, set the servos at the factory angles (straightened robot)
  • Release the motors (so the user can physically change the pose)
  • When the user pressed the "Enter" button, get the positions of all the servos, then print them out
  • Wait a couple seconds, engage motors, and then return all the servos back to the factory angles again
  • Release the motors (so the user can physically change the pose)

The problem is that if I physically change one servo, when I press the "Enter" button, the servos revert to factory angles, but if I change multiple (anywhere between 2-6) servos, then I encounter issues where one or more servos will not return back to the factory angles. Pressing the "Enter" button again will cause those servos to very slowly move, but nowhere near the expected speed at startup.

My theory is that something is happening to the power chip or servos after they are "disengaged", and the "engage" method does not restore it the same way that a hard power cycle would. Please help resolve. Ideally, we don't want to power cycle the board when such a glitch occurs.

This is my full code:

#include <Braccio++.h>

#define BUTTON_ENTER   6

// Braccio ++ joints
auto gripper    = Braccio.get(1);
auto wristRoll  = Braccio.get(2);
auto wristPitch = Braccio.get(3);
auto elbow      = Braccio.get(4);
auto shoulder   = Braccio.get(5);
auto base       = Braccio.get(6);

/* Variables */
float servoAngles[6] = {gripper, wristRoll, wristPitch, elbow, shoulder, base};
static float const homePos[6] = {157.50, 157.50, 157.50, 157.50, 157.50, 90.00};

bool btnPressed = false; // Flag to indicate button pressed

void fetchAngles() {
  // Update servoAngles with real angles
  for (int i = 0; i < 6; i++) { // Iterate motor angles
    servoAngles[i] = Braccio.get(i).position();
  }
}

void setSpeeds() {
  Braccio.speed(SLOW); // could be FAST or MEDIUM or SLOW
  Braccio.speed(gripper, MEDIUM);
  Braccio.speed(wristRoll, MEDIUM);
  delay(100);
}

void setup() {
  Braccio.begin();
  delay(500); // Waits for the Braccio initialization
  
  setSpeeds();
  
  // Set motor initial angles. Should move all the motors at once
  Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
  delay(500);
  Braccio.disengage();
  delay(100);
  Serial.println("Move robot to desired position.");
  Serial.println("Press Enter button to display angles and return to home position.");
}

void loop() {
  int pressedKey = Braccio.getKey();

  if (pressedKey == BUTTON_ENTER)
    btnPressed = true; // Trigger joints' movements

  if (btnPressed) {
    fetchAngles();
    Serial.println("Current Motor angles [M 1-6]");
    for (int i = 0; i < 6; i++) { // Iterate motor angles
      Serial.print(servoAngles[i]); 
      if (i != 5)
        Serial.print(",");
    }
    Serial.println();
    delay(100);
    Serial.println("Stand clear. Returning to initial angles");
    delay(2000);
    Braccio.engage(); delay(500);
    setSpeeds();
    for (int i = 0; i < 3; i++) {
      Braccio.moveTo(homePos[0], homePos[1], homePos[2], homePos[3], homePos[4], homePos[5]);
      delay(2000);
    }
    Braccio.disengage(); delay(500);
    
    btnPressed = false; // Stop joints' movements
  }

}

Servo motors disconnecting while fetching positions

It seems that the Nano RP2040 Connect's UART1_TX (GPIO8) is connected to the RST_485/RE(Receiver enable). Also, the same pin GPIO8 is connected to the onboard WiFi UART pin. Although I am not using WiFi in my code but I am investigating this because the servo motors get disconnected/reconnected intermittently while continuously fetching all joints angles (at 10Hz) using theBraccio.positions() method. I am not sure if this is causing the issue. Interestingly a basic example does not have disconnection issue but using multiple Mbed threads with microROS have such kind of behavior. I can see 2 or 3 LEDs (out of 6) in random order changing from green to red to green attached to the motors on the carrier board. Can we change the RST_485/RE connection to another available pin or is it hard-wired?

Carrier LCD as normal LCD

Hi,
in documentation, I founded only information for use of the LCD as menu, but is it possible to show into LCD a simple message (for example a log) that on what the arm is doing? For example: "waiting", "moving in A", etc.? Obviously, I want that the message can be changed by the code sequence.

Information about smart servo motors

I am trying to drive the Braccio++ using ROS2. I need following information for the URDF.

  1. Maximum motor speed (velocity in m/s)
  2. Maximum motor torque (effort in N-m)

How can we get speed at runtime? Is there a method to get/set acceleration?
Also, the speed function parameter is time (ms ?) not the speed (rad/s).
Where can I find the datasheet for the smart servos?

SmartServoClass::getPosition returns wrong value

The SmartServoClass::getPosition method always returns 5160.88 when readWordCmd returns -1. The positionToAngle method converts -1 to 65535. Consequently, this sets limited_runtime_sec to a large value of around 5000/angular_velocity seconds. This is a bug!

float SmartServoClass::getPosition(uint8_t const id)
{
  if (!isValidId(id))
    return -1.0f;

  mbed::ScopedLock<rtos::Mutex> lock(_mtx);
  return positionToAngle(readWordCmd(id, REG(SmartServoRegister::POSITION_H)));
}
int SmartServoClass::readWordCmd(uint8_t const id, uint8_t const address) {
  if (readBuffer(id,address,2) == 0) {
    return (_rxBuf[5]<<8)|_rxBuf[6];
  }
  return -1;
}
inline float  positionToAngle(uint16_t const position) {
   return (MAX_ANGLE*position)/MAX_POSITION; 
}

Speed/Acceleration API

How can I achieve these:

  • Get Speed
  • Get/Set Acceleration (possible?)

Also, the speed() method parameter is time (ms ?) not the speed (rad/s).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.