def main(): """ Implementation of the ``install`` script.""" args = get_argument_parser().parse_args() pkg, pkgpath = args.pkgpath[0].split('/', 1) job_name = args.job or pkg.split('_', 1)[0] # Any unspecified arguments are on the args object as None. These are filled # in by the Job constructor when passed as Nones. j = robot_upstart.Job(name=job_name, interface=args.interface, user=args.user, workspace_setup=args.setup, rosdistro=args.rosdistro, master_uri=args.master, log_path=args.logdir, systemd_after=args.systemd_after) for this_pkgpath in args.pkgpath: pkg, pkgpath = this_pkgpath.split('/', 1) if not pkg: print( "Unable to locate package your job launch is in." " Installation aborted. " + DESC_PKGPATH + "\npkgpath passed: {}.".format(pkgpath)) return 1 found_path = find_in_workspaces(project=pkg, path=pkgpath, first_match_only=True) if not found_path: print "Unable to locate path %s in package %s. Installation aborted." % ( pkgpath, pkg) return 1 if os.path.isfile(found_path[0]): # Single file, install just that. j.add(package=pkg, filename=pkgpath) else: # Directory found, install everything within. j.add(package=pkg, glob=os.path.join(pkgpath, "*")) if args.augment: j.generate_system_files = False if args.wait: j.roslaunch_wait = True provider = providers.detect_provider() if args.provider == 'upstart': provider = providers.Upstart if args.provider == 'systemd': provider = providers.Systemd if args.symlink: j.symlink = True j.install(Provider=provider) return 0
def main(): """ Implementation of the ``uninstall`` script.""" args = get_argument_parser().parse_args() j = robot_upstart.Job(name=args.jobname[0], rosdistro=args.rosdistro) j.uninstall() return 0
def test_install_glob(self): j = robot_upstart.Job(name="baz") j.add('robot_upstart', glob='test/launch/*.launch') j.install(sudo=None, root=self.root_dir) self.assertTrue( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "baz.d/a.launch")), "Launch file not copied.") self.assertTrue( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "baz.d/b.launch")), "Launch file not copied.")
def test_uninstall(self): j = robot_upstart.Job(name="boo") j.add('robot_upstart', glob='test/launch/*.launch') j.install(sudo=None, root=self.root_dir) j.uninstall(sudo=None, root=self.root_dir) self.assertFalse( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "boo.d")), "Job dir not removed.") self.assertFalse( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "usr/sbin/foo-start")), "Start script not removed.")
def test_install_launcher(self): j = robot_upstart.Job(name="bar") j.add('robot_upstart', 'test/launch/a.launch') j.install(sudo=None, root=self.root_dir) self.assertTrue( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "bar.d/a.launch")), "Launch file not copied.") self.assertFalse( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "bar.d/b.launch")), "Launch copied which shouldn't have been.")
def test_uninstall_user_file(self): j = robot_upstart.Job(name="goo") j.add('robot_upstart', glob='test/launch/*.launch') j.install(sudo=None, root=self.root_dir) with open( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "goo.d/c.launch"), "w") as f: f.write("<launch></launch>") j.uninstall(sudo=None, root=self.root_dir) self.assertTrue( os.path.exists( self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "goo.d/c.launch")), "User launch file wrongly removed.")
def test_install(self): j = robot_upstart.Job(name="foo") j.install(sudo=None, root=self.root_dir) self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-start")), "Start script not created.") self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-stop")), "Stop script not created.") self.assertTrue(os.path.exists(self.pjoin("etc/init/foo.conf")), "Upstart configuration file not created.") self.assertEqual( 0, subprocess.call(["bash", "-n", self.pjoin("usr/sbin/foo-start")]), "Start script not valid bash syntax.") self.assertEqual( 0, subprocess.call(["bash", "-n", self.pjoin("usr/sbin/foo-stop")]), "Stop script not valid bash syntax.")
def main(): """ Implementation of the ``install`` script.""" args = get_argument_parser().parse_args() pkg, pkgpath = args.pkgpath[0].split('/', 1) job_name = args.job or pkg.split('_', 1)[0] # Any unspecified arguments are on the args object as None. These are filled # in by the Job constructor when passed as Nones. j = robot_upstart.Job(name=job_name, interface=args.interface, user=args.user, workspace_setup=args.setup, rosdistro=args.rosdistro, master_uri=args.master, log_path=args.logdir) found_path = find_in_workspaces(project=pkg, path=pkgpath, first_match_only=True) if not found_path: print "Unable to locate path %s in package %s. Installation aborted." % ( pkgpath, pkg) if os.path.isfile(found_path[0]): # Single file, install just that. j.add(package=pkg, filename=pkgpath) else: # Directory found, install everything within. j.add(package=pkg, glob=os.path.join(pkgpath, "*")) if args.augment: j.generate_system_files = False j.install() return 0
#!/usr/bin/env python import robot_upstart j = robot_upstart.Job('rtcrobot', master_uri='http://192.168.5.10:11311') j.symlink = True #j.add(package="rtcrobot_webinterface", filename="launch/webserver.launch") j.add(package="rtcrobot_base", filename="launch/rtcrobot_common.launch") j.install()
to $ROS_DISTRO from the current environment. master_uri (str) - For systems with multiple computers, you may want this job to launch with ROS_MASTER_URI pointing to another machine. log_path (str) - The location to set ROS_LOG_DIR to. If changed from the default of using /tmp, it is the user’s responsibility to manage log rotation. master_service (str) - Optional: Specify the name of the service that should start roscore, preferably one that will be persistent. When specified, other services that launch nodes/params will activate only after the master service """ # CORE ---------------------------------------------------------------# j = robot_upstart.Job(name=roscore_service_name) # service name j.interface = rosip_interface j.symlink = True j.log_path = log_dir j.master_uri = master # j.user = '******' # j.workspace_setup ="../setup.bash" j.add(package="mira_description", filename="launch/display.launch") # j.install() # NODES ---------------------------------------------------------------#
#!/usr/bin/env python import os import robot_upstart j = robot_upstart.Job("AXIS_SETUP") j.add(package="axis_camera", filename="launch/axis.launch") j.install()
#!/usr/bin/env python import robot_upstart j = robot_upstart.Job('rtcrobot') j.add(package="rtcrobot_webinterface", filename="launch/webserver.launch") #j.add(package="rtcrobot_base", filename="launch/rtcrobot_common.launch") j.install()
import robot_upstart st=robot_upstart.Job() st.add(package="Robotics_Lab_UAV",filename="Data_collection_UAV.launch") st.install()