sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_jointControl.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-1
3 import os
4 from time import sleep
5 
6 from dynamic_graph import plug
8  create_joint_controller,
9  create_joint_trajectory_generator,
10 )
11 
12 
13 def main(robot, gain):
14  N_JOINTS = 32
15  Kp = N_JOINTS * [gain]
16  robot.timeStep = robot.device.getTimeStep()
17  dt = robot.timeStep
18 
19  robot.traj_gen = create_joint_trajectory_generator(dt, robot)
20  robot.device.control.value = N_JOINTS * [0.0]
21 
22  robot.controller = create_joint_controller(Kp)
23 
24  plug(robot.traj_gen.x, robot.controller.qDes)
25  plug(robot.traj_gen.dx, robot.controller.dqDes)
26 
27  plug(robot.device.state, robot.controller.state)
28 
29  plug(robot.controller.dqRef, robot.device.control)
30 
31  robot.controller.init(N_JOINTS)
32 
33  sleep(1.0)
34  os.system("rosservice call /start_dynamic_graph")
35  sleep(1.0)
36  robot.traj_gen.move(31, -1.0, 1.0)
37  sleep(1.1)
38  robot.traj_gen.startSinusoid(31, 1.0, 2.0)
39  sleep(10.0)
40  robot.traj_gen.stop(31)
create_entities_utils
sot_talos_balance.test.test_jointControl.main
def main(robot, gain)
Definition: test_jointControl.py:13
sot_talos_balance.create_entities_utils.create_joint_controller
def create_joint_controller(Kp)
Definition: create_entities_utils.py:176
sot_talos_balance.create_entities_utils.create_joint_trajectory_generator
def create_joint_trajectory_generator(dt, robot)
Definition: create_entities_utils.py:94