Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Bioloid and Matlab Simulink

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
26 postsPage 2 of 21, 2
26 postsPage 2 of 21, 2

Post by Dimitris » Thu Jan 24, 2008 12:48 am

Post by Dimitris
Thu Jan 24, 2008 12:48 am

Same unfortunately. I tried on an xp machine today. Also noticed that the same result happens if the cm5 is not plugged in/turned on so I'm suspicious it's the connection's fault. Is it because I'm using a usb2serial cable? I made sure its COM port is 1, also the cable works fine with all Robotis stuff, COM1, baud rate 57600. Is there any way of verifying the CM5 is 'connected' to Matlab?
I had also ordered another usb2serial cable as well as a PCI-card based serial port, so will try those as well when they arrive. Unfortunately my PC's serial port seems dead and my laptop doesn't have one! :S
Same unfortunately. I tried on an xp machine today. Also noticed that the same result happens if the cm5 is not plugged in/turned on so I'm suspicious it's the connection's fault. Is it because I'm using a usb2serial cable? I made sure its COM port is 1, also the cable works fine with all Robotis stuff, COM1, baud rate 57600. Is there any way of verifying the CM5 is 'connected' to Matlab?
I had also ordered another usb2serial cable as well as a PCI-card based serial port, so will try those as well when they arrive. Unfortunately my PC's serial port seems dead and my laptop doesn't have one! :S
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Thu Jan 24, 2008 1:08 am

Post by rustyarmor
Thu Jan 24, 2008 1:08 am

Hi Dimitris,

are you using a usb2serial adapter?
Hi Dimitris,

are you using a usb2serial adapter?
rustyarmor
Robot Builder
Robot Builder
User avatar
Posts: 19
Joined: Fri Oct 20, 2006 1:00 am

Post by Dimitris » Thu Jan 24, 2008 2:48 am

Post by Dimitris
Thu Jan 24, 2008 2:48 am

yeah, but it works fine with robotis software on com1 and 57600 baud rate
yeah, but it works fine with robotis software on com1 and 57600 baud rate
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Thu Jan 24, 2008 4:23 am

Post by rustyarmor
Thu Jan 24, 2008 4:23 am

Hi Dimitris,

I think that the problem you face is due to the fact the sfunction code was built in order to work with serial ports registers from the uart. It is not suposed to work with a converter.

Some guy had this problem a couple months ago. I'll ask him.

Pedro
Hi Dimitris,

I think that the problem you face is due to the fact the sfunction code was built in order to work with serial ports registers from the uart. It is not suposed to work with a converter.

Some guy had this problem a couple months ago. I'll ask him.

Pedro
rustyarmor
Robot Builder
Robot Builder
User avatar
Posts: 19
Joined: Fri Oct 20, 2006 1:00 am

Post by Dimitris » Tue Jan 29, 2008 2:57 pm

Post by Dimitris
Tue Jan 29, 2008 2:57 pm

Sorry to keep this thread running for so long, but I just got a new PCI-port serial connector card and tried that (xindows xp). Still the same results :(
Will I need to find a PC with a proper in-built serial card? Anyone know how to adapt the code for a serial-2-usb cable? And I was also wondering if it's worth purchasing the robotis usb-2-dynamixel if at the end of the day I need the PC processing power and the cm5 is just an intermediate.

Thanks,
Dimitris
Sorry to keep this thread running for so long, but I just got a new PCI-port serial connector card and tried that (xindows xp). Still the same results :(
Will I need to find a PC with a proper in-built serial card? Anyone know how to adapt the code for a serial-2-usb cable? And I was also wondering if it's worth purchasing the robotis usb-2-dynamixel if at the end of the day I need the PC processing power and the cm5 is just an intermediate.

Thanks,
Dimitris
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by limor » Thu Jan 31, 2008 3:47 am

Post by limor
Thu Jan 31, 2008 3:47 am

Hi Dimitris,

This method and thsi S-function is designed for Real-time-windows-target which runs at such high priority in XP that most drivers dont work.

The rational was to allow hard realtime frame rates for the control loop. If you need hard real-time, this is your best development environment.

the serial driver implemented in the S-function uses very backwards compatible windows system calls that assume the serial chipset on the motherboard and memory mapped to the CPU.

look at the code and google some of the words there, you will find references to similar serial driver code dated 10 years ago. If your serial port is on a PCI card, it may not have the same programming interface (memory mapped addresses etc) as the old serial chip. definitely the FTDI USB chips have totally different drivers then the old serial chip.

You may want to consider not using the Real-time simulink but instead use the normal simulink mode. If you computer is powerful enough, you may be able to get good pseudo real-time frame rate and you will be able to use your PCI serial interface and the FTDI based USB2Dynamixel module.

In normal mode you can write the S-function using a standard windows COM interface to serial ports. you wont have to deal with strange race conditions and dead-locks and have to reboot the system on every bug. You will also have considerably more ready-made boxes/functions to choose from including if i'm not mistaken a generic serial toolbox.

And another idea.. We have done some experiments generating "Generic Linux C code output" from Simulink, cross compiling and running the code on Gumstix connected to the Bioloid bus. Again this is pseudo real-time but the Gumstix hardly runs any other process except for the simulink controller.
Hi Dimitris,

This method and thsi S-function is designed for Real-time-windows-target which runs at such high priority in XP that most drivers dont work.

The rational was to allow hard realtime frame rates for the control loop. If you need hard real-time, this is your best development environment.

the serial driver implemented in the S-function uses very backwards compatible windows system calls that assume the serial chipset on the motherboard and memory mapped to the CPU.

look at the code and google some of the words there, you will find references to similar serial driver code dated 10 years ago. If your serial port is on a PCI card, it may not have the same programming interface (memory mapped addresses etc) as the old serial chip. definitely the FTDI USB chips have totally different drivers then the old serial chip.

You may want to consider not using the Real-time simulink but instead use the normal simulink mode. If you computer is powerful enough, you may be able to get good pseudo real-time frame rate and you will be able to use your PCI serial interface and the FTDI based USB2Dynamixel module.

In normal mode you can write the S-function using a standard windows COM interface to serial ports. you wont have to deal with strange race conditions and dead-locks and have to reboot the system on every bug. You will also have considerably more ready-made boxes/functions to choose from including if i'm not mistaken a generic serial toolbox.

And another idea.. We have done some experiments generating "Generic Linux C code output" from Simulink, cross compiling and running the code on Gumstix connected to the Bioloid bus. Again this is pseudo real-time but the Gumstix hardly runs any other process except for the simulink controller.
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Dimitris » Fri Feb 01, 2008 3:37 am

Post by Dimitris
Fri Feb 01, 2008 3:37 am

OK it might sound easy but I've never used the serial object in Matlab so basically I'm taking a completely wild stab in the dark. I managed to get a servo to make some violent moves but that's about it!

%////
s = serial('COM1');
fopen(s)

fwrite(s,3)
pause(1)
fwrite(s,1)
pause(1)

fprintf(s,'c')

bytesize = s.BytesAvailable
fread(s, bytesize)
%////

Trying to write 2 bytes and then read 2 as the PC_code is doing.
(is the 'c' print needed, saw it in the PC_code.m file)
I really have no idea what is going on however. Looking at the cm5-side code it makes sense that there's a while loop which constantly sends the goal position to the servo and then reads the current position. But on the Matlab side am I reading-writing correclty? What range does the fwrite data have to be/how does it correspond to servo position?
:? I know all these questions sound dumb, but any help is appreciated!
OK it might sound easy but I've never used the serial object in Matlab so basically I'm taking a completely wild stab in the dark. I managed to get a servo to make some violent moves but that's about it!

%////
s = serial('COM1');
fopen(s)

fwrite(s,3)
pause(1)
fwrite(s,1)
pause(1)

fprintf(s,'c')

bytesize = s.BytesAvailable
fread(s, bytesize)
%////

Trying to write 2 bytes and then read 2 as the PC_code is doing.
(is the 'c' print needed, saw it in the PC_code.m file)
I really have no idea what is going on however. Looking at the cm5-side code it makes sense that there's a while loop which constantly sends the goal position to the servo and then reads the current position. But on the Matlab side am I reading-writing correclty? What range does the fwrite data have to be/how does it correspond to servo position?
:? I know all these questions sound dumb, but any help is appreciated!
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by fra_diee » Thu Mar 19, 2009 9:34 am

Post by fra_diee
Thu Mar 19, 2009 9:34 am

Hi,

I followed all the steps in matlab , but when building the simulink model I have some problem like:

"The existing Rel-Time workshop project "slprj" directory was created for a different version of mathworks product....ecc..

I use matlab 7.5.0 and 7.0 but the problem is the same!

I'm trying to create a new model but matlab send me an error message like "pc_code" do not exist, but i have pc_code.c in the same model folder and the file rtwin.tlc do not exist!!!

Please help me!!!! thks
Hi,

I followed all the steps in matlab , but when building the simulink model I have some problem like:

"The existing Rel-Time workshop project "slprj" directory was created for a different version of mathworks product....ecc..

I use matlab 7.5.0 and 7.0 but the problem is the same!

I'm trying to create a new model but matlab send me an error message like "pc_code" do not exist, but i have pc_code.c in the same model folder and the file rtwin.tlc do not exist!!!

Please help me!!!! thks
fra_diee
Newbie
Newbie
Posts: 1
Joined: Thu Mar 19, 2009 9:13 am

Post by limor » Fri Mar 20, 2009 11:24 am

Post by limor
Fri Mar 20, 2009 11:24 am

sorry i can't help, it has been a long time since i played with this stuff and we used version 6 of matlab, not 7.
sorry i can't help, it has been a long time since i played with this stuff and we used version 6 of matlab, not 7.
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

nid help

Post by snow4997 » Sat Apr 03, 2010 5:07 pm

Post by snow4997
Sat Apr 03, 2010 5:07 pm

guys, i'm new here. i've tried and follow the tutorail, but at the end once i click the play button i got blue screen !!
guys, i'm new here. i've tried and follow the tutorail, but at the end once i click the play button i got blue screen !!
snow4997
Newbie
Newbie
Posts: 4
Joined: Tue Jan 26, 2010 9:37 am

Post by limor » Sun Apr 04, 2010 12:21 am

Post by limor
Sun Apr 04, 2010 12:21 am

recently succeeded getting matlab to talk to robotis bus using the FTDI USB-serial interface (USB2Dynamixel). this uses the latest version of matlab/simulink (dont remember which).

see working example and some explanation here
http://actuated.wordpress.com/2010/02/1 ... om-matlab/
(btw: the DLL referred to in this link page is the one supplied by robotis with the usb2dynamixel CD which you can find by googling usb2dynamixel software)
recently succeeded getting matlab to talk to robotis bus using the FTDI USB-serial interface (USB2Dynamixel). this uses the latest version of matlab/simulink (dont remember which).

see working example and some explanation here
http://actuated.wordpress.com/2010/02/1 ... om-matlab/
(btw: the DLL referred to in this link page is the one supplied by robotis with the usb2dynamixel CD which you can find by googling usb2dynamixel software)
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Previous
26 postsPage 2 of 21, 2
26 postsPage 2 of 21, 2