Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMansolino committed Jul 5, 2019
1 parent 715dc6a commit ad8feed
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 41 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ target_link_libraries(pioneer3at
${catkin_LIBRARIES}
)


#############
## Install ##
#############
Expand All @@ -249,7 +250,6 @@ install(TARGETS e_puck_line
install(TARGETS complete_test
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})


install(TARGETS robot_information_parser
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

Expand All @@ -261,3 +261,6 @@ install(TARGETS panoramic_view_recorder

install(TARGETS pioneer3at
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
13 changes: 13 additions & 0 deletions launch/catch_the_bird.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/catch_the_bird.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="catch_the_bird" pkg="webots_ros" type="catch_the_bird" required="$(arg auto-close)"/>
</launch>
13 changes: 13 additions & 0 deletions launch/complete_test.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/complete_test.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="complete_test" pkg="webots_ros" type="complete_test" required="$(arg auto-close)"/>
</launch>
14 changes: 14 additions & 0 deletions launch/e_puck_line.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/e-puck_line.wbt"/>
</include>

<arg name="duration" default="20" doc="Duration in seconds"/>
<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="epuck_line" pkg="webots_ros" type="e_puck_line" args="$(arg duration)" required="$(arg auto-close)"/>
</launch>
13 changes: 13 additions & 0 deletions launch/keyboard_teleop.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/keyboard_teleop.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="keyboard_teleop" pkg="webots_ros" type="keyboard_teleop" required="$(arg auto-close)"/>
</launch>
13 changes: 13 additions & 0 deletions launch/panoramic_view_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/panoramic_view_recorder.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="panoramic_view_recorder" pkg="webots_ros" type="panoramic_view_recorder" required="$(arg auto-close)"/>
</launch>
13 changes: 13 additions & 0 deletions launch/pioneer3at.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/pioneer3at.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="pioneer3at" pkg="webots_ros" type="pioneer3at" required="$(arg auto-close)"/>
</launch>
13 changes: 13 additions & 0 deletions launch/robot_information_parser.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<!-- start Webots -->
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<include file="$(find webots_ros)/launch/webots.launch">
<arg name="mode" value="realtime"/>
<arg name="no-gui" value="$(arg no-gui)"/>
<arg name="world" value="$(env WEBOTS_HOME)/projects/languages/ros/worlds/e-puck_line.wbt"/>
</include>

<arg name="auto-close" default="false" doc="Startup mode"/>
<node name="robot_information_parser" pkg="webots_ros" type="robot_information_parser" required="$(arg auto-close)"/>
</launch>
7 changes: 7 additions & 0 deletions launch/webots.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<launch>
<arg name="world" default="" doc="Path to the world to load"/>
<arg name="mode" default="realtime," doc="Startup mode"/>
<arg name="no-gui" default="false," doc="Start Webots with minimal GUI"/>
<node name="webots" pkg="webots_ros" type="webots_launcher.py" args="--world=$(arg world) --mode=$(arg mode) --no-gui=$(arg no-gui)" required="true"/>
</launch>
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>webots_ros</name>
<version>2.0.3</version>
<version>2.0.4</version>
<description>The ROS package containing examples for interfacing ROS with the standard ROS controller of Webots</description>

<url>http://wiki.ros.org/webots_ros</url>
Expand Down
5 changes: 0 additions & 5 deletions src/catch_the_bird.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ int main(int argc, char **argv) {
float i, step;
bool birdCatched = false;

if (argc != 1) {
ROS_INFO("Usage: $ example_catch_bird.");
return 1;
}

// create a node named 'catch_the_bird' on ROS network
ros::init(argc, argv, "catch_the_bird", ros::init_options::AnonymousName);
ros::NodeHandle n;
Expand Down
5 changes: 0 additions & 5 deletions src/complete_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ void quit(int sig) {
int main(int argc, char **argv) {
string model_name = "my_robot";

if (argc != 1) {
ROS_INFO("Usage: $ complete_test.");
return 1;
}

ros::init(argc, argv, "complete_test", ros::init_options::AnonymousName);
ros::NodeHandle n;

Expand Down
2 changes: 1 addition & 1 deletion src/e_puck_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ int main(int argc, char **argv) {
int nStep = 0;

// look if a limit time was given
if (argc != 2) {
if (argc < 2) {
ROS_INFO("Usage: $ e_puck_line [duration(seconds)].");
return 1;
}
Expand Down
5 changes: 0 additions & 5 deletions src/keyboard_teleop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ void keyboardCallback(const webots_ros::Int32Stamped::ConstPtr &value) {
}

int main(int argc, char **argv) {
if (argc != 1) {
ROS_INFO("Keyboard_teleop doesn't take any arguments.");
return 1;
}

// create a node named 'keyboard_teleop' on ROS network
ros::init(argc, argv, "keyboard_teleop", ros::init_options::AnonymousName);
ros::NodeHandle n;
Expand Down
5 changes: 0 additions & 5 deletions src/panoramic_view_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ void quit(int sig) {
int main(int argc, char **argv) {
std::string controllerName;

if (argc != 1) {
ROS_INFO("Usage: $ panoramic_view_recorder.");
return 1;
}

// create a node named 'panoramic_view_recorder' on ROS network
ros::init(argc, argv, "panoramic_view_recorder", ros::init_options::AnonymousName);
ros::NodeHandle n;
Expand Down
8 changes: 1 addition & 7 deletions src/pioneer3at.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ void quit(int sig) {

int main(int argc, char **argv) {
std::string controllerName;

if (argc != 1) {
ROS_INFO("Usage: $ pioneer3at.");
return 1;
}

// create a node named 'pioneer3at' on ROS network
ros::init(argc, argv, "pioneer3at", ros::init_options::AnonymousName);
n = new ros::NodeHandle;
Expand Down Expand Up @@ -207,7 +201,7 @@ int main(int argc, char **argv) {
return 1;
}
}
ROS_INFO("Using controller: '%s'", controllerName);
ROS_INFO("Using controller: '%s'", controllerName.c_str());
// leave topic once it is not necessary anymore
nameSub.shutdown();

Expand Down
5 changes: 0 additions & 5 deletions src/pr2_beer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ void quit(int sig) {
}

int main(int argc, char **argv) {
if (argc != 1) {
ROS_INFO("pr2_beer doesn't take any arguments.");
return 1;
}

// create a node named 'pr2_beer' on ROS network
ros::init(argc, argv, "pr2_beer", ros::init_options::AnonymousName);
ros::NodeHandle n;
Expand Down
6 changes: 0 additions & 6 deletions src/robot_information_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ void quit(int sig) {
int main(int argc, char **argv) {
std::string controllerName;
std::vector<std::string> deviceList;

if (argc != 1) {
ROS_INFO("Usage: $ robot_information_parser.");
return 1;
}

// create a node named 'robot_information_parser' on ROS network
ros::init(argc, argv, "robot_information_parser", ros::init_options::AnonymousName);
ros::NodeHandle n;
Expand Down
40 changes: 40 additions & 0 deletions src/webots_launcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python

# Copyright 1996-2019 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This launcher simply start Webots."""

import optparse
import os
import sys
import subprocess

optParser = optparse.OptionParser()
optParser.add_option("--world", dest="world", default="", help="Path to the world to load.")
optParser.add_option("--mode", dest="mode", default="realtime", help="Startup mode.")
optParser.add_option("--no-gui", dest="noGui", default="false", help="Start Webots with minimal GUI.")
options, args = optParser.parse_args()

if 'WEBOTS_HOME' not in os.environ:
sys.exit('WEBOTS_HOME environment variable not defined.')
command = [os.path.join(os.environ['WEBOTS_HOME'], 'webots'), '--mode=' + options.mode, options.world]
if options.noGui == 'true':
command.append('--stdout')
command.append('--stderr')
command.append('--batch')
command.append('--no-sandbox')
command.append('--minimize')

subprocess.call(command)

0 comments on commit ad8feed

Please sign in to comment.