Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulated robot support in app manager #263

Merged
merged 5 commits into from Nov 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions rocon_app_manager/launch/concert_client.launch
Expand Up @@ -33,6 +33,9 @@
<arg name="interactions" default="false"/>
<arg name="interactions_list" default="[]"/>

<!-- *************************** Is simulataion ******************************* -->
<arg name="simulation" default="false"/> <!-- simulated robot -->

<!-- ************************* Rarely Used Variables ************************** -->
<arg name="firewall" default="false"/> <!-- typically false (don't let anything in), only for simulation clients -->

Expand All @@ -59,6 +62,7 @@
<arg name="robot_icon" value="$(arg robot_icon)" />
<arg name="robot_type" value="$(arg robot_type)" />
<arg name="screen" value="$(arg screen)" />
<arg name="simulation" value="$(arg simulation)" />
</include>

</launch>
2 changes: 2 additions & 0 deletions rocon_app_manager/launch/includes/_app_manager.xml
Expand Up @@ -12,6 +12,7 @@
<arg name="rapp_package_blacklist" default="[]"/>
<arg name="auto_start_rapp" default=""/> <!-- autostart a rapp, e.g. rocon_apps/chirp -->
<arg name="screen" default="false"/> <!-- verbose output from running apps -->
<arg name="simulation" default="false"/> <!-- is simulated robot in gazebo -->
<arg name="capability_server_name" default="capability_server"/> <!-- name of the capability server -->
<!-- See 'http://wiki.ros.org/rocon_app_manager/Tutorials/indigo/Automatic Rapp Installation'
on how to enable automatic rapp installation -->
Expand All @@ -28,6 +29,7 @@
<param name="auto_start_rapp" value="$(arg auto_start_rapp)"/>
<param name="local_remote_controllers_only" value="$(arg local_remote_controllers_only)"/>
<param name="screen" value="$(arg screen)"/>
<param name="simulation" value="$(arg simulation)"/>
<param name="capability_server_name" value="$(arg capability_server_name)"/>
<param name="auto_rapp_installation" value="$(arg auto_rapp_installation)" />
<remap from="app_manager/gateway_info" to="gateway/gateway_info"/>
Expand Down
2 changes: 2 additions & 0 deletions rocon_app_manager/launch/multimaster.launch
Expand Up @@ -46,6 +46,7 @@
<arg name="robot_type" default="pc"/>
<arg name="robot_icon" default="rocon_icons/cybernetic_pirate.png"/>
<arg name="screen" default="false"/> <!-- verbose output from running apps -->
<arg name="simulation" default="false"/> <!-- simulated robot -->

<include file="$(find rocon_app_manager)/launch/includes/_app_manager.xml">
<arg name="robot_name" value="$(arg robot_name)" />
Expand All @@ -56,6 +57,7 @@
<arg name="auto_start_rapp" value="$(arg auto_start_rapp)" />
<arg name="local_remote_controllers_only" value="$(arg local_remote_controllers_only)" />
<arg name="screen" value="$(arg screen)" />
<arg name="simulation" value="$(arg simulation)"/>
<arg name="capability_server_name" value="$(arg capabilities_server_name)" if="$(arg capabilities)"/>
<arg name="auto_rapp_installation" value="$(arg auto_rapp_installation)" />
</include>
Expand Down
4 changes: 3 additions & 1 deletion rocon_app_manager/launch/standalone.launch
Expand Up @@ -30,7 +30,8 @@
<arg name="robot_name" default="Cybernetic Pirate"/>
<arg name="robot_type" default="pc"/>
<arg name="robot_icon" default="rocon_icons/cybernetic_pirate.png"/>
<arg name="screen" default="true"/> <!-- verbose output from running apps -->
<arg name="screen" default="true"/> <!-- verbose output from running apps -->
<arg name="simulation" default="false"/> <!-- simulated robot -->

<include file="$(find rocon_app_manager)/launch/includes/_app_manager.xml">
<arg name="robot_name" value="$(arg robot_name)" />
Expand All @@ -40,6 +41,7 @@
<arg name="rapp_package_blacklist" value="$(arg rapp_package_blacklist)" />
<arg name="auto_start_rapp" value="$(arg auto_start_rapp)" />
<arg name="screen" value="$(arg screen)" />
<arg name="simulation" value="$(arg simulation)"/>
<arg name="auto_rapp_installation" value="$(arg auto_rapp_installation)" />
<arg name="capability_server_name" default="$(arg capabilities_server_name)"/>
</include>
Expand Down
6 changes: 4 additions & 2 deletions rocon_app_manager/src/rocon_app_manager/rapp.py
Expand Up @@ -107,7 +107,7 @@ def install(self, dependency_checker):

return success, str()

def start(self, application_namespace, gateway_name, rocon_uri_string, remappings=[], parameters=[], force_screen=False,
def start(self, application_namespace, gateway_name, rocon_uri_string, remappings=[], parameters=[], force_screen=False, simulation=False,
caps_list=None):
'''
Some important jobs here.
Expand All @@ -131,6 +131,8 @@ def start(self, application_namespace, gateway_name, rocon_uri_string, remapping
:type parameters: list of rocon_std_msgs.msg.KeyValue
:param force_screen: whether to roslaunch the app with --screen or not
:type force_screen: boolean
:param simulation: whether the rapp manager is for simulated robot or not
:type simulation: boolean
:param caps_list: this holds the list of available capabilities, if app needs capabilities
:type caps_list: CapsList
'''
Expand All @@ -142,7 +144,7 @@ def start(self, application_namespace, gateway_name, rocon_uri_string, remapping
public_parameters = utils.apply_requested_public_parameters(data['public_parameters'], parameters)

temp = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
self._launch = utils.prepare_launcher(data, public_parameters, application_namespace, gateway_name, rocon_uri_string, capability_nodelet_manager_name, force_screen, temp)
self._launch = utils.prepare_launcher(data, public_parameters, application_namespace, gateway_name, rocon_uri_string, capability_nodelet_manager_name, force_screen, simulation, temp)

# Better logic for the future, 1) get remap rules from capabilities. 2) get remap rules from requets. 3) apply them all. It would be clearer to understand the logic and easily upgradable
if 'required_capabilities' in data: # apply capability-specific remappings needed
Expand Down
1 change: 1 addition & 0 deletions rocon_app_manager/src/rocon_app_manager/rapp_manager.py
Expand Up @@ -559,6 +559,7 @@ def _process_start_app(self, req):
req.remappings,
req.parameters,
self._param['app_output_to_screen'],
self._param['simulation'],
self.caps_list)

rospy.loginfo("Rapp Manager : %s" % self._remote_name)
Expand Down
3 changes: 3 additions & 0 deletions rocon_app_manager/src/rocon_app_manager/ros_parameters.py
Expand Up @@ -41,4 +41,7 @@ def setup_ros_parameters():
# Preferred rapp configuration
param['preferred'] = rospy.get_param('~preferred',[])

# Simulation
param['simulation'] = rospy.get_param('~simulation', False)

return param
11 changes: 8 additions & 3 deletions rocon_app_manager/src/rocon_app_manager/utils.py
Expand Up @@ -33,7 +33,7 @@ def dict_to_KeyValue(d):


def _prepare_launch_text(launch_file, launch_args, public_parameters, application_namespace,
gateway_name, rocon_uri_string, capability_server_nodelet_manager_name=None):
gateway_name, rocon_uri_string, simulation, capability_server_nodelet_manager_name=None):
'''
Prepare the launch file text. This essentially wraps the rapp launcher
with the following roslaunch elements:
Expand All @@ -60,6 +60,8 @@ def _prepare_launch_text(launch_file, launch_args, public_parameters, applicatio
:type gateway_name: str
:param rocon_uri_string: used to pass down information about the platform that is running this app to the app itself.
:type rocon_uri_string: str - a rocon uri string
:param simulation: true if rapp manager is for simulated robot
:type simulation: boolen

The rocon_uri_string variable is a fixed identifier for this app manager's platform - i.e. no special
characters or wildcards should be contained therein.
Expand All @@ -71,6 +73,7 @@ def _prepare_launch_text(launch_file, launch_args, public_parameters, applicatio
launch_arg_mapping['gateway_name'] = gateway_name
launch_arg_mapping['rocon_uri'] = rocon_uri_string
launch_arg_mapping['capability_server_nodelet_manager_name'] = capability_server_nodelet_manager_name
launch_arg_mapping['simulation'] = simulation

if(application_namespace == ""):
launch_text = '<launch>\n <include file="%s">\n' % (launch_file)
Expand Down Expand Up @@ -110,7 +113,7 @@ def resolve_chain_remappings(nodes):
n.remap_args = new_remap_args_dict.items()


def prepare_launcher(data, public_parameters, application_namespace, gateway_name, rocon_uri_string, capability_nodelet_manager_name, force_screen, temp):
def prepare_launcher(data, public_parameters, application_namespace, gateway_name, rocon_uri_string, capability_nodelet_manager_name, force_screen, simulation, temp):
'''
prepare roslaunch to start rapp.
'''
Expand All @@ -122,7 +125,9 @@ def prepare_launcher(data, public_parameters, application_namespace, gateway_nam
application_namespace,
gateway_name,
rocon_uri_string,
capability_nodelet_manager_name)
simulation,
capability_nodelet_manager_name
)
temp.write(launch_text)
temp.close() # unlink it later

Expand Down
2 changes: 1 addition & 1 deletion rocon_app_utilities/src/rocon_app_utilities/rapp_loader.py
Expand Up @@ -198,7 +198,7 @@ def _get_standard_args(roslaunch_file):

:raises RappMalformedException: if launch file format is invalid
'''
standard_args = ['gateway_name', 'application_namespace', 'rocon_uri', 'capability_server_nodelet_manager_name']
standard_args = ['gateway_name', 'application_namespace', 'rocon_uri', 'capability_server_nodelet_manager_name', 'simulation']

try:
available_args = _get_available_args(roslaunch_file)
Expand Down