Skip to contents

This function sets up an OpenSim `AnalyzeTool` for calculating joint reactions and generates the corresponding XML setup file. The function configures parameters for the model, force sets, and joint reactions, and can either save the setup to a file or return the configured `AnalyzeTool` object for further use.

Usage

setup_joint_reaction_osim(
  model_file = "model_scaled.osim",
  replace_force_set = FALSE,
  force_set_file = "reserve_actuators.xml",
  results_directory = ".",
  start_time = 0,
  end_time = 3,
  solve_for_equilibrium_for_auxiliary_states = TRUE,
  coordinates_file = NULL,
  controls_file = NULL,
  states_file = NULL,
  in_degrees = TRUE,
  forces_file = "force.sto",
  on_body = "parent",
  in_frame = "child",
  joint_name = "all",
  step_interval = 1,
  setup_filename = "setup_jr.xml",
  write_file = FALSE,
  return_object = TRUE
)

Arguments

model_file

A character string specifying the path to the scaled OpenSim model file. Default is "model_scaled.osim".

replace_force_set

A logical value indicating whether to replace the force set. Default is `FALSE`.

force_set_file

A character string specifying the path to the force set XML file. Default is "reserve_actuators.xml".

results_directory

A character string specifying the directory for storing results. Default is the current working directory.

start_time

A numeric value specifying the start time for the analysis. Default is `0`.

end_time

A numeric value specifying the end time for the analysis. Default is `3`.

solve_for_equilibrium_for_auxiliary_states

A logical value specifying whether to solve for equilibrium for auxiliary states. Default is `TRUE`.

coordinates_file

A character string specifying the path to the coordinates file. Default is `NULL`.

controls_file

A character string specifying the path to the controls file. Default is `NULL`.

states_file

A character string specifying the path to the states file. Default is `NULL`.

in_degrees

A logical value indicating whether the joint reaction angles should be returned in degrees. Default is `TRUE`.

forces_file

A character string specifying the path to the forces file. Default is "force.sto".

on_body

A character string specifying the body to which the joint reaction is applied. Default is 'child'.

in_frame

A character string specifying the frame in which to compute the joint reaction. Default is "child".

joint_name

A character string specifying the name of the joint(s) for the joint reaction. Default is 'all'.

step_interval

A numeric value specifying the step interval for the analysis. Default is `1`.

setup_filename

A character string specifying the name of the output setup XML file. Default is "setup_jr.xml".

write_file

A logical value indicating whether to write the XML setup file to disk. Default is `FALSE`.

return_object

A logical value indicating whether to return the `AnalyzeTool` object. Default is `TRUE`.

Value

If `write_file` is `TRUE`, writes the XML setup file to disk. If `return_object` is `TRUE`, returns the `AnalyzeTool` object. If neither is `TRUE`, the function returns `NULL` invisibly.