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