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 1 of 21, 2
26 postsPage 1 of 21, 2

Bioloid and Matlab Simulink

Post by limor » Fri Jul 13, 2007 8:39 pm

Post by limor
Fri Jul 13, 2007 8:39 pm

In case you missed the announcement:

http://robosavvy.com/forum/viewtopic.php?t=1514


Pedro (rustyarmor) is putting together a summary of some of the work done at IST humanoid robot lab (in cooperation with RoboSavvy :-).
http://humanoids.dem.ist.utl.pt
Please feel free to post any questions on this forum.

The lab is looking for Masters students for next year to research humanoid robot control. Erasmus students from other EC member states are welcome. So if you know someone who is a fan of wind/kite surfing and a roboteer in 3rd-4th year mechanical/Electrical engineering.. Lisbon's IST humanoid robotics lab should be a fun place to spend the next year.

The site (which may eventually be updated an maintained here at RoboSavvy for posterity) will include:

1) Full in-depth identification of all mechanical parts of the Bioloid including a very precise 3D model.

2) Matlab Simulink linked with Sim-Mechanics for precise offline simulation and visualization.

3) Matlab Simulink Real-time-windows target (*) serial driver implementing a proprietary simple protocol with the CM5 for control-loop (PC sends speed controls to Bioloid servos, Bioloid responds with current servo positions.)

4) Matlab Simulink EZPhysics target - to test the control loop algorithm to a physics enabled simulation of Bioloid

5) Matlab Simulink Gumstix target - to dump the control loop algorithm to a Gumstix for on-board control of the Bioloid. The gumstix will connect to the Bioloid bus using the RoboStix daughter board.



(*) RTWT - is a way to run the control loop algorithm on a Windows PC in real-time. The algorithm real-time higer priority than the Windows O/S and hence runs with a real-time clock. The disadvantage is that there are hardly any I/O drivers supported in this mode. A serial driver had to be written in order to communicate with the CM5.
In case you missed the announcement:

http://robosavvy.com/forum/viewtopic.php?t=1514


Pedro (rustyarmor) is putting together a summary of some of the work done at IST humanoid robot lab (in cooperation with RoboSavvy :-).
http://humanoids.dem.ist.utl.pt
Please feel free to post any questions on this forum.

The lab is looking for Masters students for next year to research humanoid robot control. Erasmus students from other EC member states are welcome. So if you know someone who is a fan of wind/kite surfing and a roboteer in 3rd-4th year mechanical/Electrical engineering.. Lisbon's IST humanoid robotics lab should be a fun place to spend the next year.

The site (which may eventually be updated an maintained here at RoboSavvy for posterity) will include:

1) Full in-depth identification of all mechanical parts of the Bioloid including a very precise 3D model.

2) Matlab Simulink linked with Sim-Mechanics for precise offline simulation and visualization.

3) Matlab Simulink Real-time-windows target (*) serial driver implementing a proprietary simple protocol with the CM5 for control-loop (PC sends speed controls to Bioloid servos, Bioloid responds with current servo positions.)

4) Matlab Simulink EZPhysics target - to test the control loop algorithm to a physics enabled simulation of Bioloid

5) Matlab Simulink Gumstix target - to dump the control loop algorithm to a Gumstix for on-board control of the Bioloid. The gumstix will connect to the Bioloid bus using the RoboStix daughter board.



(*) RTWT - is a way to run the control loop algorithm on a Windows PC in real-time. The algorithm real-time higer priority than the Windows O/S and hence runs with a real-time clock. The disadvantage is that there are hardly any I/O drivers supported in this mode. A serial driver had to be written in order to communicate with the CM5.
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Biodog » Mon Jul 16, 2007 3:14 pm

Post by Biodog
Mon Jul 16, 2007 3:14 pm

I fit can help I may give you my SolidWorks 2005 parts model (I know Rustyarmor gave a full modelisation, but I couldn't use it), knowing the fact that it's my first experience in SW so there might be mistakes/approximations.
I'm actually in Master in France and I'd be quite interested to go to Lisbon (even if I don't speak portuguese!) but it's too late, I've signed for my M2 this morning :P by the way, I'll look forward your progress!
I fit can help I may give you my SolidWorks 2005 parts model (I know Rustyarmor gave a full modelisation, but I couldn't use it), knowing the fact that it's my first experience in SW so there might be mistakes/approximations.
I'm actually in Master in France and I'd be quite interested to go to Lisbon (even if I don't speak portuguese!) but it's too late, I've signed for my M2 this morning :P by the way, I'll look forward your progress!
Biodog
Robot Builder
Robot Builder
Posts: 17
Joined: Wed Mar 14, 2007 3:31 pm

Post by srobot » Wed Jul 18, 2007 10:27 pm

Post by srobot
Wed Jul 18, 2007 10:27 pm

Lovely!

What software are you using?

Is that

1 Screen) Sim

2 Screen) Graph

3 Screen) Background

I'd love any links you may have to software.

--srobot
Lovely!

What software are you using?

Is that

1 Screen) Sim

2 Screen) Graph

3 Screen) Background

I'd love any links you may have to software.

--srobot
Dell Latitude D520, Windows XP, 4 GB RAM, 80 GB HDD, Intel Core 2 Duo. The power that's needed!

RIBO Labs, Springing Robotic Development to a New Level
srobot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 401
Joined: Sun Dec 10, 2006 1:00 am
Location: Deep in robot parts

Post by Dimitris » Thu Jan 17, 2008 1:24 am

Post by Dimitris
Thu Jan 17, 2008 1:24 am

Hi,

Has anyone tried to run this matlab interface? I followed all the steps and I'm oonly stuck at the end when building the simulink model :(

Error ../PC_code.c: 110 undeclared identifier `t'
Warning ../PC_code.c: 110 Statement has no effect
Error ../PC_code.c: 110 syntax error; found `counter' expecting `;'
Warning ../PC_code.c: 109 possible usage of t before definition
Warning ../PC_code.c: 137 unreachable code

Initially I got the above error, which seemed to be due to a random 't' at the end of a loop, which must have been a typo. So I remove it and re-build and end up with this error:

pc_code.obj .text: undefined reference to '_outp'
pc_code.obj .text: undefined reference to '_inp'
gmake: *** [../diagram.exe] Error 0x10
gmake: *** Deleting file `../diagram.exe'
### Real-Time Workshop build procedure for model: 'diagram' aborted due to an error.

... and the error message dialog gives:

Error using ==> RTW.genMakefileAndBuild

:(

Anyone any ideas???
Hi,

Has anyone tried to run this matlab interface? I followed all the steps and I'm oonly stuck at the end when building the simulink model :(

Error ../PC_code.c: 110 undeclared identifier `t'
Warning ../PC_code.c: 110 Statement has no effect
Error ../PC_code.c: 110 syntax error; found `counter' expecting `;'
Warning ../PC_code.c: 109 possible usage of t before definition
Warning ../PC_code.c: 137 unreachable code

Initially I got the above error, which seemed to be due to a random 't' at the end of a loop, which must have been a typo. So I remove it and re-build and end up with this error:

pc_code.obj .text: undefined reference to '_outp'
pc_code.obj .text: undefined reference to '_inp'
gmake: *** [../diagram.exe] Error 0x10
gmake: *** Deleting file `../diagram.exe'
### Real-Time Workshop build procedure for model: 'diagram' aborted due to an error.

... and the error message dialog gives:

Error using ==> RTW.genMakefileAndBuild

:(

Anyone any ideas???
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by Dimitris » Thu Jan 17, 2008 3:31 am

Post by Dimitris
Thu Jan 17, 2008 3:31 am

--
--
Last edited by Dimitris on Sat Jan 19, 2008 6:26 am, edited 2 times in total.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by limor » Fri Jan 18, 2008 1:09 am

Post by limor
Fri Jan 18, 2008 1:09 am

Hi Dimitris,

I will ask Pedro to respond to your query.
Hi Dimitris,

I will ask Pedro to respond to your query.
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by rustyarmor » Sat Jan 19, 2008 2:28 am

Post by rustyarmor
Sat Jan 19, 2008 2:28 am

Hi Dimitris,

The code should work. The tutorial has been tested successfully, so no reasons to worry, you will have matlab controlling the servo.

For what you say, the problem seems to be inside the PC_code.c. Copy again all the code and verify that matlab doesn't split lines. The code has been tested and it really should work. :wink:

If, after doing this, the problem maintains, try to use then, the original PC_code.c . See the following file:
http://robosavvy.com/site/Builders/rust ... cation.rar :D

Pedro
Hi Dimitris,

The code should work. The tutorial has been tested successfully, so no reasons to worry, you will have matlab controlling the servo.

For what you say, the problem seems to be inside the PC_code.c. Copy again all the code and verify that matlab doesn't split lines. The code has been tested and it really should work. :wink:

If, after doing this, the problem maintains, try to use then, the original PC_code.c . See the following file:
http://robosavvy.com/site/Builders/rust ... cation.rar :D

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

Post by Dimitris » Sat Jan 19, 2008 6:42 am

Post by Dimitris
Sat Jan 19, 2008 6:42 am

Hi,

Thanks for the code! I spotted a small difference in the code you gave me, which has a 'mux1' instead of a 'mux' simulink block, but I don't think that has any significance. Anyway I used the downloaded diagram and it built successfully!
I also noticed that the CM5 code chose servo id as 16 instead of 1, but in both cases what I got as a scope output was unfortunately a servo position (violet line) which did not follow the input but just stayed fixed at 65535
:S
Hi,

Thanks for the code! I spotted a small difference in the code you gave me, which has a 'mux1' instead of a 'mux' simulink block, but I don't think that has any significance. Anyway I used the downloaded diagram and it built successfully!
I also noticed that the CM5 code chose servo id as 16 instead of 1, but in both cases what I got as a scope output was unfortunately a servo position (violet line) which did not follow the input but just stayed fixed at 65535
:S
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Sat Jan 19, 2008 1:45 pm

Post by rustyarmor
Sat Jan 19, 2008 1:45 pm

Hi Dimitris,

mux1 or mux are just names for the block. So don’t worry about their names.

In order to work it is necessary only to change the id of the servo that you are using in the mcu code.

Code: Select all
/**************************************
  *         code to be inserted        *
  **************************************/
 
  //servo to be used
  bID = 1;


65535 as the step response means that it has occurred an error in reading the servo. Therefore try to redo this:

Before testing the application, verify if the CM5 is plugged to the PC and if it is OFF.
Then, attach your servo to the CM5.
Finally, turn on the CM5 and then press the play button.

If everything went right you must see something similar to the next graph. The initial position of the servo is in 800 encoders (violet line) and it can be seen its response to a step (yellow line).
Image

The reason you only see the violet line, is because it is a constant value at 65535 which is much higher than 800 (the step value). To see the step zoom it.

Hope it helps, :wink:

Pedro
Hi Dimitris,

mux1 or mux are just names for the block. So don’t worry about their names.

In order to work it is necessary only to change the id of the servo that you are using in the mcu code.

Code: Select all
/**************************************
  *         code to be inserted        *
  **************************************/
 
  //servo to be used
  bID = 1;


65535 as the step response means that it has occurred an error in reading the servo. Therefore try to redo this:

Before testing the application, verify if the CM5 is plugged to the PC and if it is OFF.
Then, attach your servo to the CM5.
Finally, turn on the CM5 and then press the play button.

If everything went right you must see something similar to the next graph. The initial position of the servo is in 800 encoders (violet line) and it can be seen its response to a step (yellow line).
Image

The reason you only see the violet line, is because it is a constant value at 65535 which is much higher than 800 (the step value). To see the step zoom it.

Hope it helps, :wink:

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

Post by Dimitris » Sat Jan 19, 2008 7:00 pm

Post by Dimitris
Sat Jan 19, 2008 7:00 pm

Hi,
This is the code I'm currently using.
http://robosavvy.com/Builders/Dimitris/Application.zip

It's the code you recommended downloading, I've changed servo ID to 1, rebuilt everything and also made sure that my servo has id 01 and is working properly. I downloaded the code to the cm5 and made sure I disconnected after.
I also made sure cm5 was off and plugged in to pc (why is this?) while attaching servo. Also had disconnected all other servos. Then I turned on the cm5 power. Next before pressing play on the simulink I have to click 'Connect to target' button right next to 'play' before this becomes enabled. Then I can see the step (yellow line) but the servo response remains at 65535.
Hi,
This is the code I'm currently using.
http://robosavvy.com/Builders/Dimitris/Application.zip

It's the code you recommended downloading, I've changed servo ID to 1, rebuilt everything and also made sure that my servo has id 01 and is working properly. I downloaded the code to the cm5 and made sure I disconnected after.
I also made sure cm5 was off and plugged in to pc (why is this?) while attaching servo. Also had disconnected all other servos. Then I turned on the cm5 power. Next before pressing play on the simulink I have to click 'Connect to target' button right next to 'play' before this becomes enabled. Then I can see the step (yellow line) but the servo response remains at 65535.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Sat Jan 19, 2008 7:19 pm

Post by rustyarmor
Sat Jan 19, 2008 7:19 pm

Hi,

Did the servo reacts, moves to any direction?
Hi,

Did the servo reacts, moves to any direction?
rustyarmor
Robot Builder
Robot Builder
User avatar
Posts: 19
Joined: Fri Oct 20, 2006 1:00 am

Post by Dimitris » Sat Jan 19, 2008 7:35 pm

Post by Dimitris
Sat Jan 19, 2008 7:35 pm

No movement at all! but led flashes when cm5 is turned on. Plus I just tested that the servo works fine with other programs. And its Id is definitely 01.
No movement at all! but led flashes when cm5 is turned on. Plus I just tested that the servo works fine with other programs. And its Id is definitely 01.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Sat Jan 19, 2008 8:13 pm

Post by rustyarmor
Sat Jan 19, 2008 8:13 pm

Hi Dimitris,

Try with servo 18. (Change the mcu code)

and try this:
1 disconect the com after changing the mcu code.
2 turn off cm5 and plug the servo 18.
3 in simulink press Incremental build button to build the model and wait until the play button becomes enable
4 turn on cm5
5 press the play button

The error maintains, no servo response??
Hi Dimitris,

Try with servo 18. (Change the mcu code)

and try this:
1 disconect the com after changing the mcu code.
2 turn off cm5 and plug the servo 18.
3 in simulink press Incremental build button to build the model and wait until the play button becomes enable
4 turn on cm5
5 press the play button

The error maintains, no servo response??
rustyarmor
Robot Builder
Robot Builder
User avatar
Posts: 19
Joined: Fri Oct 20, 2006 1:00 am

Post by Dimitris » Sat Jan 19, 2008 8:54 pm

Post by Dimitris
Sat Jan 19, 2008 8:54 pm

yeah, same results. But the play button is not enabled immediately after the incremental build, as I first have to click 'connect to target'. I'm using 'external' simulation mode as in the tutorial.
yeah, same results. But the play button is not enabled immediately after the incremental build, as I first have to click 'connect to target'. I'm using 'external' simulation mode as in the tutorial.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by rustyarmor » Tue Jan 22, 2008 4:39 pm

Post by rustyarmor
Tue Jan 22, 2008 4:39 pm

Hi Dimitris,

Try this one

http://robosavvy.com/Builders/rustyarmo ... tion_r.rar

Try also change the sample time to 0.02s

Hope it helps

Pedro
Hi Dimitris,

Try this one

http://robosavvy.com/Builders/rustyarmo ... tion_r.rar

Try also change the sample time to 0.02s

Hope it helps

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

Next
26 postsPage 1 of 21, 2
26 postsPage 1 of 21, 2