Simscape forces and torques: Centrifugal, gravitational, accelerative
11 Comments
Hi @Enrico,
To address your query regarding, “I'm actually working with simscape and I was wondering if any way exist to get from a multibody model acting forces components, ad function of kinematic conditions. In simpler words, how can I get centrifugal, coriolis, gravitations, and accelerative forces components action on a mass or body of the system? Let's assume as first approximation we're working with rigid body (but I imagine would be in any case a good approximation also for other cases). I don't see any evident methd for getting them easily, unless repeating all required onerous calculations (futile to say I'm not going for :-D). In robotic toolbox all these components are directly derived from internal jacobians and kinematcs conditions. I was guessing any similar feature also exist in simscape. Remarks, I'm currently using simscape under simulink environment.Suggestions?”
Please see my response to your comments below.
The documentation provided by clicking link below provides information regarding modeling a manipulator arm using Simscape. It demonstrates various modeling techniques that can help you understand how to structure your models effectively for control and simulation purposes.
https://www.mathworks.com/help/robotics/ug/model-and-control-a-manipulator-arm-with-simscape.html
Here is another link below to documentation where you can use the jointPrimitivePaths method to identify joints involved in motion and by utilizing State objects returned by computeState,you can analyze joint velocities and positions.
https://www.mathworks.com/help/sm/ug/joints_matlab_class.html
Hope this helps. Please let me know if you have any further questions.
Hi @Enrico,
The documentation provided in the link below does effectively answer your question regarding measuring forces and torques at joints within Simscape models. By leveraging the outlined procedures for sensing actuator torque, constraint forces, and total torque, you should be able to conduct a comprehensive analysis that meets your needs for detailed force characterization.
In addition, the following documentation provides essential tools for measuring various forces and torques at joints within a Simscape model.
https://www.mathworks.com/help/sm/ug/sense-forces-and-torques-at-joints.html
The link below is an interesting tutorial which should help you understand the concept of “Controlling Robot Manipulator Joints”,
Hope this answers your question.
Hi @Enrico,
To address your inquiry regarding the separation of force and torque components—centrifugal, Coriolis, gravitational, and accelerative—in Simscape Multibody, it is important to note that while the built-in sensing capabilities can measure total forces and torques at joints, isolating these specific components requires a more nuanced approach.So, this is what I would suggest, in Simscape Multibody, you can utilize blocks for force and torque sensing alongside custom calculations to separate these components. Below is an example code snippet that demonstrates how you might set up a model to compute these forces:
% Define parameters mass = 5; % Mass in kg g = 9.81; % Acceleration due to gravity in m/s^2 angular_velocity = [0; 0; 2]; % Angular velocity vector in rad/s linear_velocity = [1; 0; 0]; % Linear velocity vector in m/s
% Calculate forces F_gravity = mass * g; % Gravitational force F_centrifugal = mass * (angular_velocity(3)^2 * 1); % Assuming radius of rotation is 1m F_coriolis = 2 * mass * cross(linear_velocity, angular_velocity); % Coriolis force F_acceleration = mass * [0; 0; 2]; % Example acceleration in z-direction
% Total force calculation (as an example) F_total = F_gravity + F_centrifugal + F_coriolis + F_acceleration;
% Display results
disp('Gravitational Force:');
disp(F_gravity);
disp('Centrifugal Force:');
disp(F_centrifugal);
disp('Coriolis Force:');
disp(F_coriolis);
disp('Accelerative Force:');
disp(F_acceleration);
disp('Total Force:');
disp(F_total);
Please bear in mind when working with complex mechanical systems in Simscape, it’s beneficial to simulate various scenarios where these forces act independently to better understand their interactions. By utilizing visualization tools within Simulink or MATLAB, you can gain insights into how changes in one component affect others. Moreover, consider integrating sensor blocks that allow you to monitor joint forces directly while also implementing custom calculations for more detailed analysis. This dual approach will help you achieve a comprehensive understanding of your system dynamics.
Hi @Enrico,
There are bunch of robotics examples using Simscape provided in the link below, have you thoroughly reviewed them and tried to manipulate the parameters to find out the solution you are seeking.
https://www.mathworks.com/help/sm/examples.html?category=sm-robotics&s_tid=CRUX_topnav
I studied some of them and was able to implement code snippet which demonstrates how to extract these forces in Simscape:
% Load your Simscape model mdl = 'your_model_name'; load_system(mdl);
% Create KinematicsSolver object kinSolver = simscape.multibody.KinematicsSolver(mdl);
For more information on simscape.multibody.KinematicsSolver, please refer to,
% Define your rigid body (replace 'RigidBody' with your actual body name) bodyName = 'your_body_name'; body = simscape.multibody.RigidBody(bodyName);
For more information regarding simscape.multibody.RigidBody, please refer to, https://www.mathworks.com/help/sm/ref/simscape.multibody.rigidbody-class.html?searchHighlight=simscape.multibody.RigidBody&s_tid=srchtitle_support_results_1_simscape.multibody.RigidBody
% Get current state information state = getState(kinSolver);
For more information regarding getState, please refer to, https://www.mathworks.com/help/aerotbx/ug/aero.fixedwing.state.getstate.html?searchHighlight=getState&s_tid=srchtitle_support_results_1_getState
% Extract parameters m = body.Mass; % Mass of the body g = 9.81; % Acceleration due to gravity
% Calculate Gravitational Force F_gravity = [0; 0; -m * g]; % Assuming downward gravity
% Calculate Centrifugal and Coriolis Forces v = state.Velocity; % Linear velocity vector from state omega = state.AngularVelocity; % Angular velocity vector from state r = norm(state.Position); % Radius from axis (example)
F_centrifugal = m * (norm(v)^2 / r); F_coriolis = 2 * m * cross(v, omega);
% Display Forces
disp('Gravitational Force:');
disp(F_gravity);
disp('Centrifugal Force:');
disp(F_centrifugal);
disp('Coriolis Force:');
disp(F_coriolis);
I would encourage you to consider the examples provided in the link above. Try to build your code in small steps, then go for solving challenging debug phases encountered in the code and the more you learn from your mistakes, the more you will learn. Hope, this helps.
Answers (1)
0 votes
2 Comments
Categories
Find more on Multibody Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!