descampsa / ardyno Goto Github PK
View Code? Open in Web Editor NEWArduino library for dynamixel servos
License: BSD 2-Clause "Simplified" License
Arduino library for dynamixel servos
License: BSD 2-Clause "Simplified" License
hi , is it necessary to include SoftwareSerial.h , even though i am using a hardware serial port on Arduino due .
Is there any solution
Hello,
I recently got ahold of a Dynamixel RX-28 actuator/servo, I managed to make the led blink and move the arms through Arduino Nano hardware serial. But I wanted to communicate through USART while moving the servo, so I tried to lower the baudrate of RX-28 to 7534, which seemed to be the lowest possible bitrate, so I could use software serial. Afterwards I couldn't get contact with the servo anymore, I changed the baudrate in the code also to 7534. I tried to reset RX-28, but nothing I did worked anymore.
If anyone has any ideas or solutions, they would be appreciated.
Thanks,
A
Fixed it by using a code, which tried every possible baudrate and wrote it over with 1000000 baudrate
#include "DynamixelMotor.h"
// motor id
const uint8_t id=7;
unsigned long baudrate_before=1000000;
const unsigned long baudrate_after=1000000;
// hardware serial without tristate buffer
// see blink_led example, and adapt to your configuration
HardwareDynamixelInterface interface(Serial);
DynamixelMotor motor(interface, id);
// the led should blink twice
void setup()
{
for(int b=1;b<0xFF; b++){
baudrate_before = 2000000/(b+1);
// start communication at old baudrate
interface.begin(baudrate_before);
delay(100);
// make the motor led blink once
motor.init();
motor.led(HIGH);
delay(1000);
motor.led(LOW);
delay(1000);
// set motor baudrate to new baudrate
motor.communicationSpeed(baudrate_after);
// set arduino baudrate at new baudrate
delay(100);
interface.begin(baudrate_after);
// make the motor led blink once
motor.led(HIGH);
delay(1000);
motor.led(LOW);
delay(1000);
}
}
void loop(){}
I assumed from the recent commits that it was for protocol 2.0 but I didn't check thoroughly enough. To avoid confusion for others it would be a good idea to state it's protocol 1.0 only.
Hello Sir,
I am new to the Dynamixel Motors. I followed the instructions as You have given in documentation. I uploaded the joint mode code to my Arduino mega, but nothing happens. Only led of the dynamixel motor blinks. I went through the code, and realized that there is no communication between the motor and the board. Can you please help me know where i am going wrong and the problem. I have set the baudrate and id too.
I've found it a bit confusing to jump in and use the library, partly navigating the different classes to find the relevant one, but mostly because there are very few convenience functions and what they do is a bit limited. Suggestions (that I am happy to begin implementing if we are on the same page):
-More getter/setter functions for basic tasks, like changing drive parameters, avoiding normal need to use read() and write()
-All getters & setters are clearly named as such (e.g. setGoalPosition and getCurrentPosition)
-All getters and setters return a boolean that's true if communication was successful
-Getters pass in an argument by reference that they write the requested value to
the servo's data wire is one,and the arduino tx,rx has two,so how can I connect the servo to arduino mega board?
Hi,
In DynamixelInterface.h lines 24 and 37, shouldn't be
if(mDirectionPin!=NO_DIR_PORT)
instead of:
if(mDirectionPin==NO_DIR_PORT)
I'm in a bit of a hello world situation, using your library to use Dynamixel servos for the first time.
I have an Arduino UNO hooked up to an AX-12W per your wiring diagram, and I've experimented with both the speed example and the led example.
Neither is producing any activity from the motor. I modified the speed example to use broadcast address 254, and I see that the led example is already set to write to the broadcast address.
Troubleshooting: The AX12-W led blinks once on power-up as it should. Shorting rx and tx per your wiring diagram prevents serial comm with the host PC, so I connect it only after downloading the program. Is this really correct?
I can confirm with an oscilliscope that there are is a periodic burst of activity on the data line, which is otherwise at 5v.
I don't believe any settings, such as bus ID, have been changed on these servos, but if there is some factory memory reset function that would nice to try.
Any suggestions? It would be nice to include a complete and clear hello-world example in your repo, and I think the LED example is nearly that but it's not working for me.
Thanks!
Hi descampsa,
In your example code joint_mode.ino inside had mentioned that in order to change the motor speed. we can just use the DynamixelMotor::speed() to increase or decrease the motor speed. But in my case, I had tried to change the speed value. but my motor moving speed still moving as same, for example, I changed from 1000 to 400, the moving speed did not change anything.
May I check with you that the jointMode(angle_range) will also take effect for speed change?
Thank you so much
Hi
I want to apply this code to XL430
I wrote the code about AX12 myself but I had to write adress of dynamixel (such as ID, baudrate, CWangle, etc.)
However i couldn't find about that so i just change the baudrates in ino file which doesn't work.
Is there anything i missed for XL430?
Please tell me details about what i have to do
Thank you
Hi descampsa,
I am trying the dynamixel wheel mode example code using Arduino Mega 2560. We found that if we connect our motor to serial 0 (TX0 and RX0, wich are pin 0 and 1), the Arduino code cannot be uploaded successfully (with the error message: avrdude: stk500v2_command(): unknown status 0x01 avrdude: stk500v2_disable(): failed to leave programming mode). Then, if we connect to serial 2,3, or 4 (TX1&RX1, TX2&RX2, TX3&RX3), the code can be uploaded successfully, but the motor does not run. So we tried to upload the program with connecting the motor to serial 2, 3, or 4, and after uploading, we switch the wires to serial 1, then the motor works. So I want to ask that how can we enable the same serial with which the program can be uploaded successfully and the motor can work. Besides, since I want to connect multiple motors, how can I make all of the serials work?
Thanks a lot!
Here is a minimal example that reveals 2 problems:
Note that I'm using a MEGA ADK and Serial1 as the AX-12 interface. I am using an external power supply in addition to USB to the Arduino, so even if the AX-12 drew significant current, it shouldn't be able to brown-out the Arduino.
I should mention that the motor does move roughly consistently with the goal commands, so it's not simply a total communication failure. I've also included an ISR trap to catch any uncaught interrupts, but it hasn't been triggered.
An even simpler version of this code that never sends a goalPosition() command, just calls currentPosition(), also crashes after a few iterations.
Typical Output:
Starting...
0 target/actual 0
10 target/actual 0
20 target/actual 0
30 target/actual 0
40 target/actual 0
Starting...
Starting...
0 target/actual Starting...
Starting...
Code:
#include "DynamixelMotor.h"
#include <SoftwareSerial.h>
const uint8_t id=1;
int16_t pos=0;
HardwareDynamixelInterface interface(Serial1);
// Use this if you use a direction pin with 3-state buffer
//HardwareDynamixelInterface interface(Serial, 2);
// Use this if you want a sofware serial interface (communication speed will be limited)
//SoftwareDynamixelInterface interface(2,3);
DynamixelMotor motor(interface, id);
//http://stackoverflow.com/questions/23377948/arduino-avr-atmega-microcontroller-random-resets-jumps-or-variable-data-corrup
ISR(BADISR_vect)
{
for (;;) UDR0='!';
}
void setup()
{
Serial.begin(57600);
delay(100);
Serial.println("Starting...");
interface.begin(1000000);
delay(100);
motor.init();
motor.enableTorque();
// reset to 0 position
motor.jointMode();
motor.speed(256);
motor.goalPosition(pos);
delay(1000);
}
void loop()
{
motor.goalPosition(pos);
Serial.print(pos);
Serial.print(" target/actual ");
Serial.println(motor.currentPosition());
pos+=20;
if (pos >= 1000) { pos = 0; }
delay(1000);
}
Hi sir Adrien Descamps
When I use the following function .
DynamixelInterface &interface=*createSerialInterface(Serial);
It means I was busy TX0/RX0 for arduino méga, but I want to control four different types of servomotors
How can I open ports? TX1,2,3 and RX1,2,3 . At the same time
If you do not mind send me the code
Hi there!
Recently I've been playing around with my Dynamixel AX-12as which have worked fine until I executed
the following command:
device.write(0x03, 0x05);
which should change the id of the connected dynamixel to 5
However, after doing this, the motor won't respond to anything at all.
I would be glad if someone could help me out.
Thanks.
(Btw I am quite new to the Dynamixel series)
I use this library with a MX-28R and with SoftwareSerial and a TriStateBuffer.
I could send commands to the servo, but always got 129 as reply (= DYN_STATUS_COM_ERROR + DYN_STATUS_TIMEOUT).
After a long search, I found a issue in DynamixelInterfaceArduinoImpl.cpp:
transaction(true) calls readMode() and writemode().
There the direction of the buffer changes, but the software serial is not switched from listen() to stopListening(). This happens only in setReadMode(), but this function is not called, when mDirectionPin is defined.
I changed the code to the following and now everything works very nice! :-)
template<class T>
void DynamixelInterfaceImpl<T>::readMode()
{
if(mDirectionPin!=NO_DIR_PORT)
{
digitalWrite(mDirectionPin, LOW);
//enable listen() here:
setReadMode(mStream, mTxPin); //new line
}
else
{
setReadMode(mStream, mTxPin);
}
}
template<class T>
void DynamixelInterfaceImpl<T>::writeMode()
{
if(mDirectionPin!=NO_DIR_PORT)
{
digitalWrite(mDirectionPin, HIGH);
//disable listen() here:
setWriteMode(mStream, mTxPin); //new line
}
else
{
setWriteMode(mStream, mTxPin);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.