test-parameter-server.py
Go to the documentation of this file.
1 import sys
2 import unittest
3 from os.path import abspath, dirname, join
4 
5 from dynamic_graph.sot.core.parameter_server import ParameterServer
6 from example_robot_data import load_full
7 
8 import parameter_server_conf as param_server_conf
9 
10 param_server = ParameterServer("param_server")
11 param_server.init(0.001, "talos.urdf", "talos")
12 
13 # Control time interval
14 dt = 0.001
15 robot_name = "robot"
16 
17 urdfPath = param_server_conf.urdfFileName
18 urdfDir = param_server_conf.model_path
19 
20 
21 class TestParameterServer(unittest.TestCase):
22  def test_set_parameter(self):
23  # Read talos model
24  path = join(dirname(dirname(abspath(__file__))), "models", "others", "python")
25  sys.path.append(path)
26 
27  _, _, urdf_file_name, _ = load_full("talos")
28  with open(urdf_file_name) as fs:
29  urdf_rrbot_model_string = fs.read()
30 
31  param_server.setParameter("/robot_description", urdf_rrbot_model_string)
32  model2_string = param_server.getParameter("/robot_description")
33 
34  self.assertEqual(urdf_rrbot_model_string, model2_string)
35 
36  aValue = 0.122
37  param_server.setParameterDbl("/specificities/feet/right/size/height", aValue)
38  a2Value = param_server.getParameterDbl("/specificities/feet/right/size/height")
39  self.assertEqual(aValue, a2Value)
40 
41 
42 if __name__ == "__main__":
43  unittest.main()
test-parameter-server.TestParameterServer.test_set_parameter
def test_set_parameter(self)
Definition: test-parameter-server.py:22
test-parameter-server.TestParameterServer
Definition: test-parameter-server.py:21


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:32