<commit_before>import opensim as osim

import sys

# Get the model
model = osim.Model("../models/gait9dof18musc_Thelen_BigSpheres_20161017.osim")

# Enable the visualizer
model.setUseVisualizer(True)

# Construct the controller
brain = osim.PrescribedController()
muscleSet = model.getMuscles();
hamstrings_r = muscleSet.get(0);
brain.addActuator(hamstrings_r);
brain.prescribeControlForActuator("hamstrings_r",
                                  osim.StepFunction(0.5, 3.0, 0.3, 1.0))

# Add it to the model
model.addController(brain)

# Initialize simulation
state = model.initSystem()
model.equilibrateMuscles(state)
manager = osim.Manager(model)
manager.setInitialTime(0)
manager.setFinalTime(10.0)

# Simulatie
manager.integrate(state)<commit_msg>'manual' control<commit_after>import opensim as osim

import sys

# -- CONFIG --
stepsize = 0.05
nsteps = 100

# Get the model
model = osim.Model("../models/gait9dof18musc_Thelen_BigSpheres_20161017.osim")

# Enable the visualizer
model.setUseVisualizer(True)

# Construct the controller
muscleSet = model.getMuscles()

# Initialize simulation
state = model.initSystem()
model.equilibrateMuscles(state)
manager = osim.Manager(model)

actControls = osim.Vector(1, 0.0);
time = osim.Vector(1, state.getTime());

actControls[0] = 1

# Simulatie
for i in range(0,nsteps):
    # activate the muscles corresponding to the current step
    # yes, this makes no sense, it's just a test
    muscle = muscleSet.get(i % 18)
    muscle.setActivation(state, 20)
    manager.setInitialTime(stepsize * i)
    manager.setFinalTime(stepsize * (i + 1))
    manager.integrate(state)
{'fraction_non_alphanumeric': 0.11090458488228006, 'fraction_numerical': 0.03283767038413878, 'mean_word_length': 4.686619718309859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7357605', 'n_tokens_mistral': 587, 'n_tokens_neox': 548, 'n_words': 120}