test_hironx_log.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 PKG = 'hironx_ros_bridge'
5 # rosbuild needs load_manifest
6 try:
7  import roslib
8  import hironx_ros_bridge
9 except:
10  import roslib; roslib.load_manifest(PKG)
11  import hironx_ros_bridge
12 
13 from hironx_ros_bridge import hironx_client as hironx
14 from hrpsys.hrpsys_config import euler_from_matrix
15 from hrpsys import rtm
16 
17 import os
18 import unittest
19 import time
20 import tempfile
21 
22 import math
23 import random
24 import numpy
25 
26 from rtm import connectPorts, disconnectPorts
27 
28 class TestHiro(unittest.TestCase):
29 
30  @classmethod
31  def setUpClass(cls):
32  modelfile = rospy.get_param("hironx/collada_model_filepath")
33  rtm.nshost = 'hiro014'
34  robotname = "RobotHardware0"
35 
36  cls.robot = hironx.HIRONX()
37  cls.robot.init(robotname=robotname, url=modelfile)
38 
39  @classmethod
40  def tearDownClass(cls):
41  #self.write_output_to_pdf("test-hironx.pdf") # don't know how to call this mehtod
42  True
43 
44  def test_log(self):
45  av_r = [-0.6, -90, -100, 15.2, 9.4, 3.2]
46  av_l = [0.6, -90, -100, -15.2, 9.4,-3.2]
47  self.robot.servoOn()
48  self.robot.goInitial()
49  self.robot.log_svc.maxLength(200*15*3)
50  self.robot.clearLog()
51  for j in range(3):
52  self.robot.setJointAnglesOfGroup( "rarm" , av_r, 5)
53  self.robot.waitInterpolationOfGroup("rarm")
54  self.robot.setJointAnglesOfGroup( "larm" , av_l, 5)
55  self.robot.waitInterpolationOfGroup("larm")
56  self.robot.goInitial(tm=5)
57  self.robot.saveLog("/tmp/test_hironx_log")
58  self.robot.goOffPose()
59 
60 
61 #unittest.main()
62 if __name__ == '__main__':
63  import rostest
64  rostest.rosrun(PKG, 'test_hronx_log', TestHiro)
65  print("===================================================")
66  print("# Please consult test result with following process")
67  print("sh /tmp/check-test_hironx_log.sh")
68  command = "scp hiro@hiro014:/tmp/test_hironx_log.* /tmp/;"
69  command += "gnuplot -e 'set style line 1 pointsize 1; plot "
70  for i in [5,6,7,8,9,10, 11,12,13,14,15,16]:
71  command += '"/tmp/test_hironx_log.RobotHardware0_q" using 1:%d with point pointtype %d, '%(i, i-4)
72  command += '"/tmp/test_hironx_log.sh_qOut" using 1:%d with linespoints pointtype %d, '%(i, i-4)
73  command += "0; pause -1'"
74  with open("/tmp/check-test_hironx_log.sh", "w") as f:
75  f.write(command)
76 


hironx_ros_bridge
Author(s): Kei Okada , Isaac I.Y. Saito
autogenerated on Thu May 14 2020 03:52:05