forked from cram2/pycram
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
virtual building: added method to launch PR2 by script
- Loading branch information
kecks
committed
Apr 22, 2024
1 parent
bd718a2
commit 109edf5
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import time | ||
import roslaunch | ||
import rospy | ||
import rospkg | ||
|
||
|
||
def launch_pr2(): | ||
""" | ||
Method to launch PR2 | ||
""" | ||
# name = 'pr2' | ||
# urdf = 'pr2.urdf' | ||
executable = 'pr2_standalone.launch' | ||
launch_robot(executable) | ||
|
||
|
||
# For future work / robots | ||
# def launch_hsrb(): | ||
# # name = 'hsrb' | ||
# # urdf = 'hsrb.urdf' | ||
# executable = 'hsrb_standalone.launch' | ||
# launch_robot(executable) | ||
|
||
|
||
# def launch_armar6(): | ||
# # name = 'armar6' | ||
# # urdf = 'armar6.urdf' | ||
# executable = 'armar6_standalone.launch' | ||
# launch_robot(executable) | ||
|
||
|
||
def launch_robot(launch_file, package='pycram', launch_folder='/launch/'): | ||
""" | ||
General method to launch a specified file in given parameters | ||
:param launch_file: File name of the launch file | ||
:param package: Name of the package | ||
:param launch_folder: Location of the launch file inside the package | ||
""" | ||
|
||
rospath = rospkg.RosPack() | ||
|
||
uuid = roslaunch.rlutil.get_or_generate_uuid(None, False) | ||
roslaunch.configure_logging(uuid) | ||
launch = roslaunch.parent.ROSLaunchParent(uuid, [rospath.get_path(package) + launch_folder + launch_file]) | ||
launch.start() | ||
|
||
rospy.loginfo(f'{launch_file} started') | ||
|
||
# Wait for ik server to launch | ||
time.sleep(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<launch> | ||
<arg name="use_knowrob" default="false"/> | ||
|
||
<node pkg="kdl_ik_service" type="start_ros_server.py" name="kdl_ik_service" output="screen" /> | ||
|
||
<!-- PR2 URDF --> | ||
<include file="$(find pr2_arm_kinematics)/launch/pr2_ik_larm_node.launch"/> | ||
<include file="$(find pr2_arm_kinematics)/launch/pr2_ik_rarm_node.launch"/> | ||
<param name="robot_description" | ||
textfile="$(find pycram)/resources/pr2.urdf"/> | ||
|
||
|
||
<!-- Use Knowrob --> | ||
<group if="$(eval use_knowrob)"> | ||
<include file="$(find knowrob)/launch/knowrob.launch"/> | ||
</group> | ||
|
||
<!-- | ||
In ROS Noetic the xacro file for boxy doesnt seem to work, as a quick fix use the line above | ||
<include file="$(find iai_boxy_description)/launch/upload_boxy.launch" /> | ||
--> | ||
<!-- | ||
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/> | ||
--> | ||
|
||
</launch> |