sot-torque-control  1.6.2
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
test_sot_loader_light.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 """
3 2014, LAAS/CNRS
4 @author: Andrea Del Prete
5 """
6 
7 import random
8 
9 from dynamic_graph import plug
10 # from dynamic_graph.sot.torque_control.force_torque_estimator import ForceTorqueEstimator
11 from dynamic_graph.ros import RosExport
12 from dynamic_graph.sot.application.velocity.precomputed_tasks import Application
13 
14 
15 def randTuple(size):
16  v = ()
17  for i in range(0, size - 1):
18  v = v + (random.random(), )
19  return v
20 
21 
22 def test_ros(robot):
23  # SCRIPT PARAMETERS
24  # j = 0
25  # index of joint under analysis
26  # N = 300
27  # test duration (in number of timesteps)
28  # dt = 0.001
29  # time step
30  # estimationDelay = 10
31  # delay introduced by the estimation [number of time steps]
32  createRosTopics = 1
33  # 1=true, 0=false
34 
35  # CONSTANTS
36  nj = 30
37  # number of joints
38  # rad2deg = 180 / 3.14
39 
40  app = Application(robot)
41  dq_des = nj * (0.0, )
42 
43  app.robot.device.control.value = dq_des
44 
45  if (createRosTopics == 1):
46  ros = RosExport('rosExport')
47  ros.add('vector', 'robotStateRos', 'state')
48  plug(robot.device.state, ros.robotStateRos)
49 
50 
51 # robot.device.after.addSignal('rosExport.robotStateRos')
52 
53  return ros
torque_control.test_sot_loader_light.test_ros
def test_ros(robot)
Definition: test_sot_loader_light.py:22
torque_control.test_sot_loader_light.randTuple
def randTuple(size)
Definition: test_sot_loader_light.py:15