ForumPress

Guest  

Welcome Guest, posting in this forum requires registration.

Pages: [1]
Topic: Dynamixel AX-12 Linux (Ubuntu) C++
DanielSchr
Member
Posts: 2

Reputation: 0
Dynamixel AX-12 Linux (Ubuntu) C++
on: November 20, 2013, 02:32

Hey all,


I am using C++ with Eclipse and an AX-12 Dynamixel. My task is to write a c++ file to control the dynamixel. The further task is to integrate this program in ROS, so that everything will work by typing the commands into ROS. I am also using the USB2Dynamixel Connector.


While searching on the internet I saw the Eclipse program of Jose, which I just copied over to my running Eclipse.

The first problem was that I couldnt access the to the USB, but that works now. To do this you have to run Eclipse with admin rights (in Ubuntu starting eclipse with "sudo eclipse").


Now I have access to the USB2Dynamixel, but if I start the program, I think I dont get information out of it. The code


int pos=dynamixel.getPosition(&serialPort, idAX12);


always gives back -1. Additionaly the lines before


if (serialPort.connect("//dev//ttyS0")!=0) {

dynamixel.sendTossModeCommand(&serialPort);


always give out 4 and 8, no matter which ID for the Dynamixel is used. Even if I plug off the connection between the Dynamixel and the USB2Dynamixel the result is the same.


Because I dont got that much programming knowledge I just dont know what to do. Hope you can help me. If you need any more information feel free to ask. Thanking you very much in advance.


Regards,

Daniel


softsouls
Administrator
Posts: 10

Reputation: 0
Re: Dynamixel AX-12 Linux (Ubuntu) C++
on: November 20, 2013, 04:52

can also add your user to the group that have permission to serial connections:

http://askubuntu.com/questions/210177/serial-port-terminal-cannot-open-dev-ttys0-permission-denied

“First check if you are a member of that group:

groups ${USER}

..this will list all the groups you belong to. If you don’t belong to the dialout grup then add yourself to it, for example:

sudo gpasswd –add ${USER} dialout

You then need to log out and log back in again for it to be effective. Then see if it fixes your problem.”


softsouls
Administrator
Posts: 10

Reputation: 0
Re: Dynamixel AX-12 Linux (Ubuntu) C++
on: November 20, 2013, 04:55

By the way de post and code we are writing about is:

http://softwaresouls.com/softwaresouls/2012/03/05/linux-c-dynamixel-reading-and-writing-example/


The connection string should be something like

  serialPort.connect("//dev//ttyS0")

for "real" serial port or USB2Dynamixel in serial mode;  ttyUSB0 for USB, like using USB2Dynamixel in TTL mode


Please check your USB connection names with:

ls /dev/ttyU*


You also should change the baud rate:

  terminalAttributes.c_cflag = B57600 | CS8 | CLOCAL | CREAD;


This is also for "real" serial port or USB2Dynamixel in serial mode . For USB2Dynamixel in TTL MODE it should be

B1000000

Instead of

B57600


DanielSchr
Member
Posts: 2

Reputation: 0
Re: Dynamixel AX-12 Linux (Ubuntu) C++
on: November 20, 2013, 17:12

Ah thank you, its working now. I didnt change the Baud Rate and after putting it on 1.000.000 it works.

Thank you again so much!!!


Now I am going to write all other functions to all adresses and after this I have to adept everything to ROS. Do you have any other hints or something like this for this task?


Pages: [1]
WP Forum Server by ForumPress | Lucid Crew
Version: 1.8.2 ; Page loaded in: 0.027 seconds.

Comments are closed.

%d bloggers like this: