CodeGenerator

51 views
Skip to first unread message

Ciro Arena

unread,
Jun 20, 2021, 4:37:08 AM6/20/21
to Robotics & Machine Vision Toolboxes
Hi everyone, I have a problem about a command of Robotics Toolbox: CodeGenerator.

I need to have a simulink block which implements forward dynamics.

I discovered a command that help me to generate automatically this simulink block.

cg = CodeGenerator(twolink);
cg.everything();


I can open these simulink blocks, but I can't use them. Simulink give me errors. Do you have information about this? Thanks

Himanshu Varshney

unread,
Jun 20, 2021, 5:15:33 AM6/20/21
to Robotics & Machine Vision Toolboxes
What is the error you are getting?
please specify the error clearly.

Ciro Arena

unread,
Jun 20, 2021, 6:03:42 AM6/20/21
to Robotics & Machine Vision Toolboxes
Hi sorry. Before I was wrong to send the message.
Problem is quite simple. I want to understand if I can use simulink blocks generated with command CodeGenerator, for MY OWN Simulink models.
I wrote this code:

cg = CodeGenerator(robot);
cg.everything();

and finally in the current folder, it appears a folder called ROBOT. Now in this folder there is a file simulink called ROBOTslib.slx, where there are many simulink blocks which allow me to calculate forward kinematics, Jacobian and so on. (See picture 1)

Now I decided to copy and past one of these simulink blocks in a my simulink file, for example fkine, because I want to calculate forward kinematic in Simulink (see picture 2). But when i run this file, it gives me the followiing error (see picture 3)

I hope I have explained this problem well
picture_2.png
picture_3.png
picture_1.png

Himanshu Varshney

unread,
Jun 20, 2021, 7:37:55 AM6/20/21
to robotics...@googlegroups.com
I know this and faced the same problem.

Did you try to use the 'reshape' block in simulation? If not, try to use that and then check the dimension of signals.

Let me know the result and any error (if arise).

Thanks & Regards
=============================================
The best preparation for tomorrow is doing your best today.
Himanshu Varshney
Final Year | Post Graduate
Mechatronics Engineering
Instrumentation & Control Engineering Dept.
Netaji Subhas University of Technology (NSUT)
formerly Netaji Subhas Institute of Technology (NSIT)
New Delhi, Delhi-110078, India
M: +917073173991
=============================================

--
You received this message because you are subscribed to the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotics-tool-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotics-tool-box/c82068c4-e360-4733-89aa-0d048cf98525n%40googlegroups.com.

Ciro Arena

unread,
Jun 20, 2021, 11:57:29 AM6/20/21
to Robotics & Machine Vision Toolboxes
Thank you very much for your help. This error doesn't appear any more. 

Unfortunately now I have another problem: when I use CodeGenerator, many Simulink blocks (shown in picture 1) are created. But in particular for Coriolis block and friction block all the elements are zero. I try to explain better: Coriolis Matrix and friction matrix have all elements equal to zero. Whereas I HAVEN'T this problem for Inertia block, fkine block or Jacobian block, because there appear non-zero elements.

I don't Know if i was been clear. Thanks for the attention.
Reply all
Reply to author
Forward
0 new messages