Skip to content
Snippets Groups Projects
Commit d8d4b1d6 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Started wiki page about namespaces

parent 94661ceb
No related branches found
No related tags found
No related merge requests found
# ROS Namespace Conventions
## Environment Variables
### ``ROS_NAMESPACE`` Environment Variable
All computers part of the ``D-FaLL-System`` should have the environment variable ``ROS_NAMESPACE`` set to the value ``dfall``.
You can check this from any terminal window with the command
```
echo $ROS_NAMESPACE
```
This environment vairable is set in the file:
```
pps_ws/src/d_fall_pps/launch/Config.sh
```
The environemnt variable is set by the following line in that file:
```
export ROS_NAMESPACE='dfall'
```
### ``DEFAULT_{AGENT,COORD}_ID`` Environment Variables
The ``Config.sh`` also sets the environment variables for the default agent ID and the default coordinator ID, called ``DFALL_DEFAULT_AGENT_ID`` and ``DFALL_DEFAULT_COORD_ID``. These are set by the following line in the ``Config.sh`` file:
```
export DFALL_DEFAULT_AGENT_ID=$(cat /etc/dfall_default_agent_id)
export DFALL_DEFAULT_COORD_ID=$(cat /etc/dfall_default_coord_id)
```
This is the only place in the whole ``D-FaLL-System`` where the files ``/etc/dfall_default_{agent,coord}_id`` are referred to.
NOTE:
- These files should never be access from within any code,<br>
- To use these default ID's within any code, they should be added as parameters when launch the respective node,<br>
- The launch files is the only place where the default ID environment variables should be used.<br>
## Launching nodes
To be filled in
\ No newline at end of file
<launch> <launch>
<!-- INPUT ARGUMENT OF THE AGENT's ID --> <!-- INPUT ARGUMENT OF THE AGENT's ID -->
<arg name="agentid" default="$(optenv DFALL_DEFAULT_ID)" /> <arg name="agentID" default="$(optenv DFALL_DEFAULT_AGENT_ID)" />
<!-- Example of how to use the value in agentid --> <!-- Example of how to use the value in agentID -->
<!-- <param name="param" value="$(arg agentid)"/> --> <!-- <param name="param" value="$(arg agentID)"/> -->
<group ns="agent$(arg agentid)"> <group ns="agent$(arg agentID)">
<!-- CRAZY RADIO --> <!-- CRAZY RADIO -->
<node <node
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
type = "PPSClient" type = "PPSClient"
> >
<rosparam command="load" file="$(find d_fall_pps)/param/ClientConfig.yaml" /> <rosparam command="load" file="$(find d_fall_pps)/param/ClientConfig.yaml" />
<param name="agentID" value="$(arg agentid)" /> <param name="agentID" value="$(arg agentID)" />
</node> </node>
<!-- SAFE CONTROLLER --> <!-- SAFE CONTROLLER -->
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
type = "ParameterService" type = "ParameterService"
> >
<param name="type" type="str" value="agent" /> <param name="type" type="str" value="agent" />
<param name="agentID" type="str" value="$(arg agentid)" /> <param name="agentID" type="str" value="$(arg agentID)" />
<rosparam <rosparam
command = "load" command = "load"
file = "$(find d_fall_pps)/param/SafeController.yaml" file = "$(find d_fall_pps)/param/SafeController.yaml"
......
export ROS_MASTER_URI=http://teacher:11311 export ROS_MASTER_URI=http://teacher:11311
export ROS_IP=$(hostname -I | awk '{print $1;}') export ROS_IP=$(hostname -I | awk '{print $1;}')
export DFALL_DEFAULT_ID=$(cat /etc/dfall_default_id) export DFALL_DEFAULT_AGENT_ID=$(cat /etc/dfall_default_agent_id)
export DFALL_DEFAULT_COORD_ID=$(cat /etc/dfall_default_coord_id)
export ROS_NAMESPACE='dfall' export ROS_NAMESPACE='dfall'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment