Simulation of Mobile Robot Collision Avoidance in Simulink - Error evaluating parameter 'Gain' + Undefined function or variable

2 views (last 30 days)
I encountered the following error when working on the project as taught in Part 1 of the webinar that can be found on this link:
https://www.mathworks.com/videos/mobile-robot-simulation-for-collision-avoidance-with-simulink-90193.html.
Error:
Invalid setting in 'Pioneer3DXAssembly/Kinematic Subsystem/Gain : r' for parameter 'Gain'.
Error evaluating parameter 'Gain' in 'Pioneer3DXAssembly/Kinematic Subsystem/Gain : r'
Undefined function or variable 'r'.
-------------------------------------------
The following are what I did:
1. I downloaded the related webinar files from the link below:
https://www.mathworks.com/matlabcentral/fileexchange/47208-mobile-robot-simulation-for-collision-avoidance-with-simulink
2. I took the the following files and built the xml file using the command smimport('Pioneer3DXAssembly.xml').
Files used:
1. Pioneer3DXAssembly.xml
2. CasterWheelBody_Default_sldprt
3. CasterWheelClamp_Default_sldprt
4. PioneerBody_Default_sldprt
5. WheelMain_Default_sldprt
3. I then built the Kinematic Subsystem, Planar Joint and other necessary blocks. The error mentioned occurs when I try to run Simulation-> Update Diagram. I understand the error is saying values r and b are not specified.
4. However when I run the downloaded example (MotionConstraints_Pioneer3DXAssembly.slx) which does not specify r and b as well, it successfully show the model in Mechanics Explorer.
5. One more thing to note is if I run the downloaded example first and then run the slx file I built on my own. The model will show up.
6. Does anyone know what the author has done that allows his example (MotionConstraints_Pioneer3DXAssembly.slx) to run successfully without the error I encountered?
Please help. Thank you.

Answers (1)

Zander Richard
Zander Richard on 4 Dec 2017
Edited: Zander Richard on 4 Dec 2017
Example (MotionConstraints_Pioneer3DXAssembly.slx)
This model have its model initialization function:
r = 0.095; %Wheel radius b = 0.33; %Wheel base
XD

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!