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

Real-Time servo-CM5-Matlab/Simulink Control (need help)

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
6 postsPage 1 of 1
6 postsPage 1 of 1

Real-Time servo-CM5-Matlab/Simulink Control (need help)

Post by Asiya » Mon Jan 17, 2011 11:53 am

Post by Asiya
Mon Jan 17, 2011 11:53 am

Hiii everyone,

I'm new with Bioloid & I have question regarding the Real-Time Interface between AX-12 and Simulink discussed here:
http://humanoids.dem.ist.utl.pt/pc_rs23 ... rview.html

However, the problem thatlink for the sample code (example.c) is broken (try to click on bioloid software cd):
http://humanoids.dem.ist.utl.pt/pc_rs23 ... rview.html

but I copied the code attached in the Bioloid Manual.
However, while compiling it using Programmer notepad, a lot of warning occur:

////////////////////////////////

> "make.exe" all

-------- begin --------
avr-gcc (WinAVR 20081205) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: CM5_code.c
avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./CM5_code.lst -std=gnu99 -MMD -MP -MF .dep/CM5_code.o.d CM5_code.c -o CM5_code.o
In file included from CM5_code.c:18:
c:/winavr-20081205/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr>."
CM5_code.c: In function 'main':
CM5_code.c:224: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:237: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:242: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:243: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:246: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:252: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:258: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:259: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:262: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:263: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:267: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:273: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:274: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:277: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:283: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:284: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:287: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:292: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:293: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:296: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:299: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:305: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:313: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:314: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:317: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:325: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:326: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:329: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:337: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:338: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:341: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:347: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:348: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:349: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'RxPacket':
CM5_code.c:453: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:461: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:468: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:475: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:483: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'PrintBuffer':
CM5_code.c:508: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'PrintBaudrate':
CM5_code.c:519: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:519: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:520: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:521: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness

Linking: CM5_code.elf
avr-gcc -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=CM5_code.o -std=gnu99 -MMD -MP -MF .dep/CM5_code.elf.d CM5_code.o --output CM5_code.elf -Wl,-Map=CM5_code.map,--cref -lm

Creating load file for Flash: CM5_code.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock CM5_code.elf CM5_code.hex

Creating load file for EEPROM: CM5_code.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex CM5_code.elf CM5_code.eep || exit 0

Creating Extended Listing: CM5_code.lss
avr-objdump -h -S -z CM5_code.elf > CM5_code.lss

Creating Symbol Table: CM5_code.sym
avr-nm -n CM5_code.elf > CM5_code.sym

Size after:
AVR Memory Usage
----------------
Device: atmega128

Program: 2132 bytes (1.6% Full)
(.text + .data + .bootloader)

Data: 798 bytes (19.5% Full)
(.data + .bss + .noinit)



-------- end --------


> Process Exit Code: 0
> Time Taken: 01:39


//////////////////////////////


When I tried to load hte hex file using Boot Loader in Robot Terminal I got the following error msg:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
System O.K. (CM5 Boot Loader V1.41)
-Ffffffffffffffffffffffff]fffffff
-*0@P..//\msxU-X
-d
-
-
-t
Bad Command. (‘help’ for commands definition)
-e
Bad Command. (‘help’ for commands definition)
-‘r
-c
-.&W
-8P@0?!000_pa00
-fwi’
-
-[Error:RxD Timeout]
Bad Command. (‘help’ for commands definition)
-
-[Errog Header]
Bad Command. (‘help’ for commands definition)
-
-[Error: TxID !=RxID]
Bad Command. (‘help’ for commands definition)
-
-[Error: Wrong Length]

Bad Command. (‘help’ for commands definition)
-
-
-[Error: Wrong CheckSum] (LEN:
Bad Command. (‘help’ for commands definition)
-
-RS232: BPS. RS485: BPS.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


Please I need to kown what is the problem??

Regards
Hiii everyone,

I'm new with Bioloid & I have question regarding the Real-Time Interface between AX-12 and Simulink discussed here:
http://humanoids.dem.ist.utl.pt/pc_rs23 ... rview.html

However, the problem thatlink for the sample code (example.c) is broken (try to click on bioloid software cd):
http://humanoids.dem.ist.utl.pt/pc_rs23 ... rview.html

but I copied the code attached in the Bioloid Manual.
However, while compiling it using Programmer notepad, a lot of warning occur:

////////////////////////////////

> "make.exe" all

-------- begin --------
avr-gcc (WinAVR 20081205) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: CM5_code.c
avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./CM5_code.lst -std=gnu99 -MMD -MP -MF .dep/CM5_code.o.d CM5_code.c -o CM5_code.o
In file included from CM5_code.c:18:
c:/winavr-20081205/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr>."
CM5_code.c: In function 'main':
CM5_code.c:224: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:237: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:242: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:243: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:246: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:252: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:258: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:259: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:262: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:263: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:267: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:273: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:274: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:277: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:283: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:284: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:287: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:292: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:293: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:296: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:299: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:305: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:313: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:314: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:317: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:325: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:326: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:329: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:337: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:338: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:341: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:347: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:348: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:349: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'RxPacket':
CM5_code.c:453: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:461: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:468: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:475: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:483: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'PrintBuffer':
CM5_code.c:508: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c: In function 'PrintBaudrate':
CM5_code.c:519: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:519: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:520: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness
CM5_code.c:521: warning: pointer targets in passing argument 1 of 'TxDString' differ in signedness

Linking: CM5_code.elf
avr-gcc -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=CM5_code.o -std=gnu99 -MMD -MP -MF .dep/CM5_code.elf.d CM5_code.o --output CM5_code.elf -Wl,-Map=CM5_code.map,--cref -lm

Creating load file for Flash: CM5_code.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock CM5_code.elf CM5_code.hex

Creating load file for EEPROM: CM5_code.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex CM5_code.elf CM5_code.eep || exit 0

Creating Extended Listing: CM5_code.lss
avr-objdump -h -S -z CM5_code.elf > CM5_code.lss

Creating Symbol Table: CM5_code.sym
avr-nm -n CM5_code.elf > CM5_code.sym

Size after:
AVR Memory Usage
----------------
Device: atmega128

Program: 2132 bytes (1.6% Full)
(.text + .data + .bootloader)

Data: 798 bytes (19.5% Full)
(.data + .bss + .noinit)



-------- end --------


> Process Exit Code: 0
> Time Taken: 01:39


//////////////////////////////


When I tried to load hte hex file using Boot Loader in Robot Terminal I got the following error msg:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
System O.K. (CM5 Boot Loader V1.41)
-Ffffffffffffffffffffffff]fffffff
-*0@P..//\msxU-X
-d
-
-
-t
Bad Command. (‘help’ for commands definition)
-e
Bad Command. (‘help’ for commands definition)
-‘r
-c
-.&W
-8P@0?!000_pa00
-fwi’
-
-[Error:RxD Timeout]
Bad Command. (‘help’ for commands definition)
-
-[Errog Header]
Bad Command. (‘help’ for commands definition)
-
-[Error: TxID !=RxID]
Bad Command. (‘help’ for commands definition)
-
-[Error: Wrong Length]

Bad Command. (‘help’ for commands definition)
-
-
-[Error: Wrong CheckSum] (LEN:
Bad Command. (‘help’ for commands definition)
-
-RS232: BPS. RS485: BPS.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


Please I need to kown what is the problem??

Regards
Asiya
Newbie
Newbie
Posts: 5
Joined: Sun Jan 16, 2011 1:30 pm

Post by Fritzoid » Mon Jan 17, 2011 8:12 pm

Post by Fritzoid
Mon Jan 17, 2011 8:12 pm

Once you get into the bootloader you'll see the message...

System O.K. (CM5 Boot Loader V1.41)

Next type "LD" and hit enter (this starts the download).

Now go to the Files menu and select Transmit Files.

Choose the hex file that you want to transmit using the file selector dialog and it should work.
Once you get into the bootloader you'll see the message...

System O.K. (CM5 Boot Loader V1.41)

Next type "LD" and hit enter (this starts the download).

Now go to the Files menu and select Transmit Files.

Choose the hex file that you want to transmit using the file selector dialog and it should work.
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by limor » Tue Jan 18, 2011 12:38 am

Post by limor
Tue Jan 18, 2011 12:38 am

seems like you have errors in the link between the PC and the CM5 unless you were typing random chars on purpose.

try to see that your serial cable is intact.

The real-time-windows-target mentioned in the IST article refers to a simulink real-time target with modified windows-XP running simulink at super high priority. Not sure this is what you are looking for.

If you just want matlab to talk to the robot there are easier ways.
there's documentation that comes with usb2dynamixel (probably on support.robotis.com)
seems like you have errors in the link between the PC and the CM5 unless you were typing random chars on purpose.

try to see that your serial cable is intact.

The real-time-windows-target mentioned in the IST article refers to a simulink real-time target with modified windows-XP running simulink at super high priority. Not sure this is what you are looking for.

If you just want matlab to talk to the robot there are easier ways.
there's documentation that comes with usb2dynamixel (probably on support.robotis.com)
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Asiya » Tue Jan 18, 2011 7:08 am

Post by Asiya
Tue Jan 18, 2011 7:08 am

Fritzoid wrote:Once you get into the bootloader you'll see the message...

System O.K. (CM5 Boot Loader V1.41)

Next type "LD" and hit enter (this starts the download).

Now go to the Files menu and select Transmit Files.

Choose the hex file that you want to transmit using the file selector dialog and it should work.



Thanks a lot

I don't have that error while loading now,

but I still have an eroe while communicating with Matlab :?
Fritzoid wrote:Once you get into the bootloader you'll see the message...

System O.K. (CM5 Boot Loader V1.41)

Next type "LD" and hit enter (this starts the download).

Now go to the Files menu and select Transmit Files.

Choose the hex file that you want to transmit using the file selector dialog and it should work.



Thanks a lot

I don't have that error while loading now,

but I still have an eroe while communicating with Matlab :?
Asiya
Newbie
Newbie
Posts: 5
Joined: Sun Jan 16, 2011 1:30 pm

Post by Asiya » Tue Jan 18, 2011 7:14 am

Post by Asiya
Tue Jan 18, 2011 7:14 am

limor wrote:seems like you have errors in the link between the PC and the CM5 unless you were typing random chars on purpose.

try to see that your serial cable is intact.

The real-time-windows-target mentioned in the IST article refers to a simulink real-time target with modified windows-XP running simulink at super high priority. Not sure this is what you are looking for.

If you just want matlab to talk to the robot there are easier ways.
there's documentation that comes with usb2dynamixel (probably on support.robotis.com)


Hiii Limor,

Actually I need to build a controllerin Simulink to control the Bioloid using Real-Time communication.

I did the RT modification if you mean:
//////////////////////
Real-Time Windows Target version 3.4.0 (C) The MathWorks, Inc. 1994-2009
Running on Multiprocessor APIC computer.
MATLAB performance = 100.0%
Kernel timeslice period = 1 ms
////////////////////

but now when I tried now to check the serial communication by typing:
s = serial('COM1','baudrate',57600)
fopen(s)
tline = fgets(s)


my Bioloid Turned offfffff, and even when I try to charge it, it did't work although the fuse is fine ????


What is the problem now??
limor wrote:seems like you have errors in the link between the PC and the CM5 unless you were typing random chars on purpose.

try to see that your serial cable is intact.

The real-time-windows-target mentioned in the IST article refers to a simulink real-time target with modified windows-XP running simulink at super high priority. Not sure this is what you are looking for.

If you just want matlab to talk to the robot there are easier ways.
there's documentation that comes with usb2dynamixel (probably on support.robotis.com)


Hiii Limor,

Actually I need to build a controllerin Simulink to control the Bioloid using Real-Time communication.

I did the RT modification if you mean:
//////////////////////
Real-Time Windows Target version 3.4.0 (C) The MathWorks, Inc. 1994-2009
Running on Multiprocessor APIC computer.
MATLAB performance = 100.0%
Kernel timeslice period = 1 ms
////////////////////

but now when I tried now to check the serial communication by typing:
s = serial('COM1','baudrate',57600)
fopen(s)
tline = fgets(s)


my Bioloid Turned offfffff, and even when I try to charge it, it did't work although the fuse is fine ????


What is the problem now??
Asiya
Newbie
Newbie
Posts: 5
Joined: Sun Jan 16, 2011 1:30 pm

Post by Asiya » Tue Jan 18, 2011 11:33 am

Post by Asiya
Tue Jan 18, 2011 11:33 am

OK I did return the old Firmeware of CM5,

but I want to know why do I get warnings while compilling the code in WinAvr?

And Why I don't get output in Simulink??


Thanks a lot for your help :)
OK I did return the old Firmeware of CM5,

but I want to know why do I get warnings while compilling the code in WinAvr?

And Why I don't get output in Simulink??


Thanks a lot for your help :)
Asiya
Newbie
Newbie
Posts: 5
Joined: Sun Jan 16, 2011 1:30 pm


6 postsPage 1 of 1
6 postsPage 1 of 1