TellDarwin - interactive text interpreter for Darwin-OP

Dedicated to the new Dynamic Anthropomorphic Robot with Intelligence - Open Platform By Robotis and related projects
12 postsPage 1 of 1
12 postsPage 1 of 1

TellDarwin - interactive text interpreter for Darwin-OP

Post by limor » Thu Aug 18, 2011 2:41 am

Post by limor
Thu Aug 18, 2011 2:41 am

Image

http://idealab.uga.edu/Projects/Darwin/Reference.php

TellDarwin is a command interpreter for DARwIn-OP Robot running Linux (designed and tested on Ubuntu 9.10). It was written by Michael Krzyzaniak at the University of Georgia, Ideas for Creative Exploration (ICE). It allows users to send simple, intuitive requests like

Code: Select all
start walking
set eye color 0.5 0.2 1
get accelerometer
start camera
set head position 30 degrees


to the robot wirelessly from a remote computer, and have it respond as expected. The software is intended to receive requests from Max/MSP (a graphical programming language for OSX or Windows that is popular in the humanities), but also has options that allow users to send requests from the command-line locally using the robot's stdin, or remotely with netcat (nc, available for any OS) or other software that can send simple ASCII messages over TCP. These options allow users to easily write scripts that control the robot.

phpBB [media]
Image

http://idealab.uga.edu/Projects/Darwin/Reference.php

TellDarwin is a command interpreter for DARwIn-OP Robot running Linux (designed and tested on Ubuntu 9.10). It was written by Michael Krzyzaniak at the University of Georgia, Ideas for Creative Exploration (ICE). It allows users to send simple, intuitive requests like

Code: Select all
start walking
set eye color 0.5 0.2 1
get accelerometer
start camera
set head position 30 degrees


to the robot wirelessly from a remote computer, and have it respond as expected. The software is intended to receive requests from Max/MSP (a graphical programming language for OSX or Windows that is popular in the humanities), but also has options that allow users to send requests from the command-line locally using the robot's stdin, or remotely with netcat (nc, available for any OS) or other software that can send simple ASCII messages over TCP. These options allow users to easily write scripts that control the robot.

phpBB [media]
limor offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by i-Bot » Thu Aug 18, 2011 5:29 pm

Post by i-Bot
Thu Aug 18, 2011 5:29 pm

It is very encouraging that folk are developing for DARwIn OP so quickly using the Robotis C++ framework. Especially since they are documenting well, and making source available of their work.

This software makes a significant link of DARwIn OP to a much wider creative community in a solid and simple way.

I have some technical questions why they used the CM730 class rather than motion manager to talk to the servos. I will contact author direct, but it would be great to get involvement and discussion through the forum.

I don't have Max/MSP, but have always thought it sets the standard for this type of interactive programming. Is there any good open source alternative ?
It is very encouraging that folk are developing for DARwIn OP so quickly using the Robotis C++ framework. Especially since they are documenting well, and making source available of their work.

This software makes a significant link of DARwIn OP to a much wider creative community in a solid and simple way.

I have some technical questions why they used the CM730 class rather than motion manager to talk to the servos. I will contact author direct, but it would be great to get involvement and discussion through the forum.

I don't have Max/MSP, but have always thought it sets the standard for this type of interactive programming. Is there any good open source alternative ?
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by siempre.aprendiendo » Thu Aug 18, 2011 7:22 pm

Post by siempre.aprendiendo
Thu Aug 18, 2011 7:22 pm

Great! I think DSL will be a powerful tool for programming robots. Martin Fowler published some months ago a book about DSL and have a great DSL guide online.
Great! I think DSL will be a powerful tool for programming robots. Martin Fowler published some months ago a book about DSL and have a great DSL guide online.
siempre.aprendiendo offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

MotionManager vs CM730

Post by krzyzani » Fri Aug 19, 2011 1:26 am

Post by krzyzani
Fri Aug 19, 2011 1:26 am

Hi,

Thanks for your interest in my work. Your question is insightful and critical. I appreciate your scrutiny, and I will attempt to provide a sufficient answer.

The main problem is that Robotis' CM730 class is not thread-safe, but the MotionManager detaches a thread and polls the CM730 on that thread. Therefore, while the the MotionManager is running, any attempt to communicate with the CM730 on, say, the program's main thread will bungle the stream of bytes going between the main controller and the sub-controller, resulting in some kind of crash (the state-machine usually gets stuck waiting for bytes that are not coming). Of course, if you only want to move the servos, there would be no need to communicate with CM730 on the main thread. However, if, say, you want to change the color of the eyes, then your only option is to first kill the MotionManager. Worse is that the MotionManager only polls 2 axes of the accelerometer, but not the third, nor the gyroscope, and since these components are on the CM730, they are similarly inaccessible while the MotionManager is running. Therefore, I have chosen to bypass the MotionManager entirely. Even if such problems did not exist, I do not believe that any functionality could be gained by using the MotionManager directly (as the initial draft of TellDarwin, in fact, did). Furthermore, Darwin's battery-life is lamentably short. Polling the CM730 while the robot is not doing anything seems like a waste of electricity.

I hope this makes sense. If anyone sees a better way of doing things I am always open to suggestions.

Mike
Hi,

Thanks for your interest in my work. Your question is insightful and critical. I appreciate your scrutiny, and I will attempt to provide a sufficient answer.

The main problem is that Robotis' CM730 class is not thread-safe, but the MotionManager detaches a thread and polls the CM730 on that thread. Therefore, while the the MotionManager is running, any attempt to communicate with the CM730 on, say, the program's main thread will bungle the stream of bytes going between the main controller and the sub-controller, resulting in some kind of crash (the state-machine usually gets stuck waiting for bytes that are not coming). Of course, if you only want to move the servos, there would be no need to communicate with CM730 on the main thread. However, if, say, you want to change the color of the eyes, then your only option is to first kill the MotionManager. Worse is that the MotionManager only polls 2 axes of the accelerometer, but not the third, nor the gyroscope, and since these components are on the CM730, they are similarly inaccessible while the MotionManager is running. Therefore, I have chosen to bypass the MotionManager entirely. Even if such problems did not exist, I do not believe that any functionality could be gained by using the MotionManager directly (as the initial draft of TellDarwin, in fact, did). Furthermore, Darwin's battery-life is lamentably short. Polling the CM730 while the robot is not doing anything seems like a waste of electricity.

I hope this makes sense. If anyone sees a better way of doing things I am always open to suggestions.

Mike
krzyzani offline
Newbie
Newbie
Posts: 3
Joined: Fri Aug 19, 2011 1:14 am

Post by Fritzoid » Fri Aug 19, 2011 12:11 pm

Post by Fritzoid
Fri Aug 19, 2011 12:11 pm

the MotionManager only polls 2 axes of the accelerometer, but not the third, nor the gyroscope, and since these components are on the CM730, they are similarly inaccessible while the MotionManager is running

The newer version(s) of the framework include the undocumented "bulk read" function. This feature allows you to create a customized list of control table entries (either CM730 or dynamixel) that are regularly polled. See function, CM730::MakeBulkReadPacket(). The results of the latest poll can be read by an external user as a single block from the controller memory. It's fast and it's flexible.
the MotionManager only polls 2 axes of the accelerometer, but not the third, nor the gyroscope, and since these components are on the CM730, they are similarly inaccessible while the MotionManager is running

The newer version(s) of the framework include the undocumented "bulk read" function. This feature allows you to create a customized list of control table entries (either CM730 or dynamixel) that are regularly polled. See function, CM730::MakeBulkReadPacket(). The results of the latest poll can be read by an external user as a single block from the controller memory. It's fast and it's flexible.
Fritzoid offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by i-Bot » Sat Aug 20, 2011 2:54 pm

Post by i-Bot
Sat Aug 20, 2011 2:54 pm

Hi Mike,
Thanks for the reply and also the information you provided in the "Do You Have Suggestions For How Robotis Can Improve Their C++ Framework?" I hope Robotis are reading this thread. I think they want to encourage the use of the framework, so should fix any shortcomings.

I do like the concept from Robotis of using MotionManager and Motion Status to multiplex and demultiplex the access to the robot, but as you say; it needs to work.

If MotionStatus doesn't publish complete information from the Darwin OP, it is not fit for purpose. Either all information should be published, or Motion Manager improved to allow subscribers to define the information they will require and have MotionManager provide it. Such a process could use the proposal from Fritzoid to intelligently optimise the reads from the CM730 and MX28.

You say "Robotis' CM730 class is not thread-safe", yet in CM730::TxRxPacket I do see waiting on semaphores. Is this broken ?

I do find the .enables, and their exclusivity and initialisation complex in MotionManager, also poorly documented; so can see why you dropped it if you only use the walking module. Do you not plan to use Action to execute Robotis motion scripts or files ? The jump straight to servo positions seems large, unless you plan to implement the motions in Max.

I hope Robotis also take note on the battery life issue. They seem to have been especially mean on both the batteries(capacity) and charger(slow). Hopefully with open hardware someone will soon fix this.

Thx.
Richard
Hi Mike,
Thanks for the reply and also the information you provided in the "Do You Have Suggestions For How Robotis Can Improve Their C++ Framework?" I hope Robotis are reading this thread. I think they want to encourage the use of the framework, so should fix any shortcomings.

I do like the concept from Robotis of using MotionManager and Motion Status to multiplex and demultiplex the access to the robot, but as you say; it needs to work.

If MotionStatus doesn't publish complete information from the Darwin OP, it is not fit for purpose. Either all information should be published, or Motion Manager improved to allow subscribers to define the information they will require and have MotionManager provide it. Such a process could use the proposal from Fritzoid to intelligently optimise the reads from the CM730 and MX28.

You say "Robotis' CM730 class is not thread-safe", yet in CM730::TxRxPacket I do see waiting on semaphores. Is this broken ?

I do find the .enables, and their exclusivity and initialisation complex in MotionManager, also poorly documented; so can see why you dropped it if you only use the walking module. Do you not plan to use Action to execute Robotis motion scripts or files ? The jump straight to servo positions seems large, unless you plan to implement the motions in Max.

I hope Robotis also take note on the battery life issue. They seem to have been especially mean on both the batteries(capacity) and charger(slow). Hopefully with open hardware someone will soon fix this.

Thx.
Richard
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by i-Bot » Sat Aug 20, 2011 4:40 pm

Post by i-Bot
Sat Aug 20, 2011 4:40 pm

Also interested in your allocation of X,Y,Z axes. I think Robotis already confused the situation with this :
http://darwin-op.springnote.com/pages/7331885
which seems to swap x and Y.

I tried to use the Robotis code as the basis of this:
http://robosavvy.com/site/index.php?opt ... 1&Itemid=2
But am now concerned I may be wrong, or that I should at least say the allocation of axes is arbitrary.

Not sure if it a big issue for anyone except me. I am spacially challenged !
Also interested in your allocation of X,Y,Z axes. I think Robotis already confused the situation with this :
http://darwin-op.springnote.com/pages/7331885
which seems to swap x and Y.

I tried to use the Robotis code as the basis of this:
http://robosavvy.com/site/index.php?opt ... 1&Itemid=2
But am now concerned I may be wrong, or that I should at least say the allocation of axes is arbitrary.

Not sure if it a big issue for anyone except me. I am spacially challenged !
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

X, Y, Z

Post by krzyzani » Sat Aug 20, 2011 5:10 pm

Post by krzyzani
Sat Aug 20, 2011 5:10 pm

Yeah, by my reckoning, Robotis employs many different coordinate systems. The servos, accelerometer, gyroscope and walking module each defines an X, Y, and Z axis that does not agree with the others. TellDarwin adjusts all of this so that all of the coordinate systems agree. Here, for instance, is how I get the the accelerometer and gyroscope to agree with the servos (taken from Performer.h):

typedef enum
{
//the accelerometer is mounted sideways.
ACCEL_X = CM730::P_ACCEL_X_L,
ACCEL_Y = CM730::P_ACCEL_Z_L,
ACCEL_Z = CM730::P_ACCEL_Y_L,
}accelComponent_t;

typedef enum
{
//the Gyroscope is mounted sideways.
GYRO_X = CM730::P_GYRO_Y_L,
GYRO_Y = CM730::P_GYRO_Z_L,
GYRO_Z = CM730::P_GYRO_X_L,
}gyroComponent_t;

This does not fix everything, because the sign convention is still wacky: sometimes positive X is, say, left, and sometimes right. So, elsewhere in the code there are statements like

if((component == ACCEL_X) || (component == ACCEL_Z))
*value *= -1;

which makes the coordinate systems more consistent and, at the very least, more intuitive to me, although what is "correct" may be debatable.

Does that answer your question?
Yeah, by my reckoning, Robotis employs many different coordinate systems. The servos, accelerometer, gyroscope and walking module each defines an X, Y, and Z axis that does not agree with the others. TellDarwin adjusts all of this so that all of the coordinate systems agree. Here, for instance, is how I get the the accelerometer and gyroscope to agree with the servos (taken from Performer.h):

typedef enum
{
//the accelerometer is mounted sideways.
ACCEL_X = CM730::P_ACCEL_X_L,
ACCEL_Y = CM730::P_ACCEL_Z_L,
ACCEL_Z = CM730::P_ACCEL_Y_L,
}accelComponent_t;

typedef enum
{
//the Gyroscope is mounted sideways.
GYRO_X = CM730::P_GYRO_Y_L,
GYRO_Y = CM730::P_GYRO_Z_L,
GYRO_Z = CM730::P_GYRO_X_L,
}gyroComponent_t;

This does not fix everything, because the sign convention is still wacky: sometimes positive X is, say, left, and sometimes right. So, elsewhere in the code there are statements like

if((component == ACCEL_X) || (component == ACCEL_Z))
*value *= -1;

which makes the coordinate systems more consistent and, at the very least, more intuitive to me, although what is "correct" may be debatable.

Does that answer your question?
krzyzani offline
Newbie
Newbie
Posts: 3
Joined: Fri Aug 19, 2011 1:14 am

Action Scripts?

Post by krzyzani » Sat Aug 20, 2011 5:29 pm

Post by krzyzani
Sat Aug 20, 2011 5:29 pm

Sorry to bombard this forum. By way of at least partial answer to an earlier post: I do not plan on implementing access to action scripts in TellDarwin. TellDarwin was designed, at least to some degree, to provide an alternative to 'action scripts', because I and the professor who asked me to write the software felt that MAX would be more powerful and more intuitive for non-engineering students. Coordinating a precise series of timed events is just what MAX was designed to do, and it does it quite well.

Also, I am curious to know if anyone has successfully compiled and run TellDarwin on their robot.
Sorry to bombard this forum. By way of at least partial answer to an earlier post: I do not plan on implementing access to action scripts in TellDarwin. TellDarwin was designed, at least to some degree, to provide an alternative to 'action scripts', because I and the professor who asked me to write the software felt that MAX would be more powerful and more intuitive for non-engineering students. Coordinating a precise series of timed events is just what MAX was designed to do, and it does it quite well.

Also, I am curious to know if anyone has successfully compiled and run TellDarwin on their robot.
Last edited by krzyzani on Sat Aug 20, 2011 7:07 pm, edited 1 time in total.
krzyzani offline
Newbie
Newbie
Posts: 3
Joined: Fri Aug 19, 2011 1:14 am

Post by siempre.aprendiendo » Sat Aug 20, 2011 6:24 pm

Post by siempre.aprendiendo
Sat Aug 20, 2011 6:24 pm

No sorry, please. It's a very interesting thread.
No sorry, please. It's a very interesting thread.
siempre.aprendiendo offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by i-Bot » Sun Aug 21, 2011 2:38 pm

Post by i-Bot
Sun Aug 21, 2011 2:38 pm

Thanks for taking the time to describe your design, it is of help to me and hopefully others working at the low level of the Robotis framework.

I appreciate you probably now want to move on to working with Max/MSP. It would be interesting to see some of the Darwin motions from Roboplus running under Max/MSP for comparison.

Did you think to link also to a simulation environment such as Webots ?

Also it may be useful to implement inverse kinematics for the legs and arms to allow them to be moved by a simplified set of parameters, such as those used by Roboplus or by the IK part of the Darwin Walking engine. Maybe even use this IK with a gait generator built in Max/MSP ? It may be best to do the IK in MaxMSP to allow the Gyros to be mixed into the servo angles afterwards.
Thanks for taking the time to describe your design, it is of help to me and hopefully others working at the low level of the Robotis framework.

I appreciate you probably now want to move on to working with Max/MSP. It would be interesting to see some of the Darwin motions from Roboplus running under Max/MSP for comparison.

Did you think to link also to a simulation environment such as Webots ?

Also it may be useful to implement inverse kinematics for the legs and arms to allow them to be moved by a simplified set of parameters, such as those used by Roboplus or by the IK part of the Darwin Walking engine. Maybe even use this IK with a gait generator built in Max/MSP ? It may be best to do the IK in MaxMSP to allow the Gyros to be mixed into the servo angles afterwards.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by limor » Mon Aug 22, 2011 11:53 pm

Post by limor
Mon Aug 22, 2011 11:53 pm

I'm amazed at the musical world of MAX where analog gyros cost $175
I'm amazed at the musical world of MAX where analog gyros cost $175
limor offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK


12 postsPage 1 of 1
12 postsPage 1 of 1