Skip to content

Commit

Permalink
New mode in run_mavros.py. Fix #42
Browse files Browse the repository at this point in the history
  • Loading branch information
arturotorresg committed Aug 29, 2018
1 parent 4b5dc19 commit de78515
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion px4_bringup/launch/spawn_robot.launch
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<arg name="material" default="Orange"/>
<arg name="target_ip" default="localhost"/>
<arg name="own_ip" default="localhost"/>
<arg name="fcu_url" default="udp://:14550@localhost:14556"/>
<arg name="gcs_url" default="udp://@localhost"/>
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0"/>
Expand All @@ -35,6 +37,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

<!-- Run mavros node -->
<node pkg="px4_bringup" type="run_mavros.py" name="run_mavros_$(arg id)" output="screen"
args="-id=$(arg id) -mode=$(arg mode) -target_ip=$(arg target_ip) -own_ip=$(arg own_ip)" />
args="-id=$(arg id) -mode=$(arg mode) -target_ip=$(arg target_ip) -own_ip=$(arg own_ip) -fcu_url=$(arg fcu_url) -gcs_url=$(arg gcs_url)" />

</launch>
9 changes: 9 additions & 0 deletions px4_bringup/scripts/run_mavros.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def main():
help='IP address of the device running px4, used to set proper fcu_url')
parser.add_argument('-own_ip', type=str, default="localhost",
help='IP address of this device, used to set proper fcu_url')
parser.add_argument('-fcu_url', type=str, default="udp://:14550@localhost:14556",
help='set fcu_url manually in custom mode')
parser.add_argument('-gcs_url', type=str, default="udp://@localhost",
help='set gcs_url manually in custom mode')
args, unknown = parser.parse_known_args()
utils.check_unknown_args(unknown)

Expand Down Expand Up @@ -54,6 +58,11 @@ def main():
fcu_url = "udp://:14550@{}:14556".format(args.target_ip)
subprocess.call("rosparam set " + node_name + "/fcu_url " + fcu_url, shell=True)
subprocess.call("rosparam set " + node_name + "/gcs_url " + "udp://@{}".format(args.own_ip), shell=True)
elif args.mode =="custom":
fcu_url = "{}".format(args.fcu_url)
gcs_url = "{}".format(args.gcs_url)
subprocess.call("rosparam set " + node_name + "/fcu_url " + fcu_url, shell=True)
subprocess.call("rosparam set " + node_name + "/gcs_url " + gcs_url, shell=True)

# ...and load blacklist, config (as seen in mavros node.launch)
yaml_path = rospack.get_path("px4_bringup") + "/config/"
Expand Down
1 change: 1 addition & 0 deletions uav_abstraction_layer/launch/test_server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
- sitl: for software in the loop simulation
- serial: for serial connection to px4
- udp: for udp connection to px4
- custom: to fully customize fcu and gcs urls
-->
<!-- Launch robot id=1 -->
<include file="$(find px4_bringup)/launch/spawn_robot.launch" ns="$(arg ns_prefix)1">
Expand Down

0 comments on commit de78515

Please sign in to comment.