Example #1
0
 def test_get_file_path(self):
     robot_name_clean = filemgr.get_clean_name(self.tmp_robot.name)
     # scenario 1
     par_checker = os.path.join(self.tmp_robot.directory,
                                '%s.par' % robot_name_clean)
     par_format = filemgr.get_file_path(self.tmp_robot)
     self.assertEqual(par_format, par_checker)
     # scenario 2
     trm_checker = os.path.join(self.tmp_robot.directory,
                                '%s_%s.txt' % (robot_name_clean, 'trm'))
     trm_format = filemgr.get_file_path(self.tmp_robot, 'trm')
     self.assertEqual(trm_format, trm_checker)
Example #2
0
 def test_get_file_path(self):
     robot_name_clean = filemgr.get_clean_name(self.tmp_robot.name)
     # scenario 1
     par_checker = os.path.join(
         self.tmp_robot.directory,
         '%s.par' % robot_name_clean
     )
     par_format = filemgr.get_file_path(self.tmp_robot)
     self.assertEqual(par_format, par_checker)
     # scenario 2
     trm_checker = os.path.join(
         self.tmp_robot.directory,
         '%s_%s.txt' % (robot_name_clean, 'trm')
     )
     trm_format = filemgr.get_file_path(self.tmp_robot, 'trm')
     self.assertEqual(trm_format, trm_checker)
Example #3
0
 def set_par_file_path(self, path=None):
     if path is None or not os.path.isabs(path):
         file_path = filemgr.get_file_path(self)
     else:
         file_path = path
     self.par_file_path = file_path
     return file_path
Example #4
0
 def set_par_file_path(self, path=None):
     if path is None or not os.path.isabs(path):
         file_path = filemgr.get_file_path(self)
     else:
         file_path = path
     self.par_file_path = file_path
     return file_path
Example #5
0
    def file_open(self, robo, ext):
        """
        Initialize file stream

        Parameters
        ==========
        robo: Robot instance
            provides the robot's name
        ext: string
            provides the file name extention
        """
        fname = filemgr.get_file_path(robo, ext)
        self.file_out = open(fname, 'w')
Example #6
0
    def file_open(self, robo, ext):
        """
        Initialize file stream

        Parameters
        ==========
        robo: Robot instance
            provides the robot's name
        ext: string
            provides the file name extention
        """
        fname = filemgr.get_file_path(robo, ext)
        self.file_out = open(fname, 'w')
Example #7
0
 def compute_baseparams(self):
     """
     Compute the Base Inertial Parameters of the robot.
     """
     base_robo = copy.deepcopy(self)
     symo = symbolmgr.SymbolManager()
     symo.file_open(base_robo, 'regp')
     title = "Base Inertial Parameters equations"
     symo.write_params_table(base_robo, title, inert=True, dynam=True)
     # compute base inertial params
     baseparams.base_inertial_parameters(base_robo, symo)
     symo.write_line()
     title = "Grouped inertial parameters"
     symo.write_params_table(base_robo, title, inert=True, equations=False)
     symo.file_close()
     # set new name for robot with base params
     base_robo.name = base_robo.name + "_base"
     file_path = filemgr.get_file_path(base_robo)
     base_robo.set_par_file_path(file_path)
     return symo, base_robo
Example #8
0
 def compute_baseparams(self):
     """
     Compute the Base Inertial Parameters of the robot.
     """
     base_robo = copy.deepcopy(self)
     symo = symbolmgr.SymbolManager()
     symo.file_open(base_robo, 'regp')
     title = "Base Inertial Parameters equations"
     symo.write_params_table(
         base_robo, title, inert=True, dynam=True
     )
     # compute base inertial params
     baseparams.base_inertial_parameters(base_robo, symo)
     symo.write_line()
     title = "Grouped inertial parameters"
     symo.write_params_table(
         base_robo, title, inert=True, equations=False
     )
     symo.file_close()
     # set new name for robot with base params
     base_robo.name = base_robo.name + "_base"
     file_path = filemgr.get_file_path(base_robo)
     base_robo.set_par_file_path(file_path)
     return symo, base_robo