Skip to content

Commit

Permalink
updated example structure, added python example
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Nov 3, 2023
1 parent 0b851a1 commit 422538d
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion cpp/waypoint_flier/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15.0)
project(waypoint_flier)
project(example_waypoint_flier)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
4 changes: 2 additions & 2 deletions cpp/waypoint_flier/config/dynparam.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

PACKAGE='waypoint_flier'
PACKAGE='example_waypoint_flier'
import roslib;
roslib.load_manifest(PACKAGE)

Expand All @@ -11,4 +11,4 @@ params = gen.add_group("waypoint_flier parameters");

params.add("waypoint_idle_time", double_t, 1, "The time to wait before flying to the next waypoint", 1, 0, 60);

exit(gen.generate(PACKAGE, "waypoint_flier", "dynparam"))
exit(gen.generate(PACKAGE, "example_waypoint_flier", "dynparam"))
4 changes: 2 additions & 2 deletions cpp/waypoint_flier/launch/waypoint_flier.launch
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<group ns="$(arg UAV_NAME)">

<!-- WaypointFlier nodelet -->
<node pkg="nodelet" type="nodelet" name="waypoint_flier" args="$(arg nodelet) waypoint_flier/WaypointFlier $(arg nodelet_manager)" launch-prefix="$(arg launch_prefix_debug)" output="screen">
<node pkg="nodelet" type="nodelet" name="waypoint_flier" args="$(arg nodelet) example_waypoint_flier/WaypointFlier $(arg nodelet_manager)" launch-prefix="$(arg launch_prefix_debug)" output="screen">

<!-- Parameters loaded from launch file -->
<param name="uav_name" value="$(arg UAV_NAME)" />

<!-- ROS parameters config file -->
<rosparam file="$(find waypoint_flier)/config/waypoint_flier.yaml" />
<rosparam file="$(find example_waypoint_flier)/config/waypoint_flier.yaml" />

<!-- Subscribers (note that the topic names will also be remapped using the namespace as a prefix) -->
<remap from="~odom_uav_in" to="estimation_manager/odom_main" />
Expand Down
2 changes: 1 addition & 1 deletion cpp/waypoint_flier/nodelets.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library path="lib/libWaypointFlier">
<class name="waypoint_flier/WaypointFlier" type="waypoint_flier::WaypointFlier" base_class_type="nodelet::Nodelet">
<class name="example_waypoint_flier/WaypointFlier" type="example_waypoint_flier::WaypointFlier" base_class_type="nodelet::Nodelet">
<description>WaypointFlier nodelet</description>
</class>
</library>
7 changes: 2 additions & 5 deletions cpp/waypoint_flier/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<package format="2">

<name>waypoint_flier</name>
<name>example_waypoint_flier</name>
<version>1.0.0</version>
<description>waypoint_flier</description>
<description>The Example Waypoint Flier</description>

<maintainer email="[email protected]">Matej Petrlik</maintainer>
<author email="[email protected]">Matej Petrlik</author>
Expand All @@ -21,10 +21,7 @@
<depend>dynamic_reconfigure</depend>

<export>

<!-- The plugins.xml file defines nodelet as a plugin -->
<nodelet plugin="${prefix}/nodelets.xml" />

</export>

</package>
20 changes: 10 additions & 10 deletions cpp/waypoint_flier/src/waypoint_flier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <dynamic_reconfigure/server.h>

/* this header file is created during compilation from python script dynparam.cfg */
#include <waypoint_flier/dynparamConfig.h>
#include <example_waypoint_flier/dynparamConfig.h>

/* for smart pointers (do not use raw pointers) */
#include <memory>
Expand Down Expand Up @@ -52,7 +52,7 @@
using vec2_t = mrs_lib::geometry::vec_t<2>;
using vec3_t = mrs_lib::geometry::vec_t<3>;

namespace waypoint_flier
namespace example_waypoint_flier
{

/* class WaypointFlier //{ */
Expand Down Expand Up @@ -126,12 +126,12 @@ class WaypointFlier : public nodelet::Nodelet {

// | ------------------- dynamic reconfigure ------------------ |

typedef waypoint_flier::dynparamConfig Config;
typedef dynamic_reconfigure::Server<waypoint_flier::dynparamConfig> ReconfigureServer;
boost::recursive_mutex mutex_dynamic_reconfigure_;
boost::shared_ptr<ReconfigureServer> reconfigure_server_;
void callbackDynamicReconfigure(Config& config, uint32_t level);
waypoint_flier::dynparamConfig last_drs_config_;
typedef example_waypoint_flier::dynparamConfig Config;
typedef dynamic_reconfigure::Server<example_waypoint_flier::dynparamConfig> ReconfigureServer;
boost::recursive_mutex mutex_dynamic_reconfigure_;
boost::shared_ptr<ReconfigureServer> reconfigure_server_;
void callbackDynamicReconfigure(Config& config, uint32_t level);
example_waypoint_flier::dynparamConfig last_drs_config_;

// | --------------------- waypoint idling -------------------- |

Expand Down Expand Up @@ -642,8 +642,8 @@ double WaypointFlier::distance(const mrs_msgs::Reference& waypoint, const geomet

//}

} // namespace waypoint_flier
} // namespace example_waypoint_flier

/* every nodelet must include macros which export the class as a nodelet plugin */
#include <pluginlib/class_list_macros.h>
PLUGINLIB_EXPORT_CLASS(waypoint_flier::WaypointFlier, nodelet::Nodelet);
PLUGINLIB_EXPORT_CLASS(example_waypoint_flier::WaypointFlier, nodelet::Nodelet);
2 changes: 1 addition & 1 deletion cpp/waypoint_flier/tmux/session.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ windows:
- waypointflier:
layout: tiled
panes:
- waitForControl; roslaunch waypoint_flier waypoint_flier.launch
- waitForControl; roslaunch example_waypoint_flier waypoint_flier.launch
- 'history -s rosservice call /$UAV_NAME/waypoint_flier/fly_to_first_waypoint'
- 'history -s rosservice call /$UAV_NAME/waypoint_flier/start_waypoints_following'
- 'history -s rosservice call /$UAV_NAME/waypoint_flier/stop_waypoints_following'
Expand Down
2 changes: 1 addition & 1 deletion cpp/waypoint_flier_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15.0)
project(waypoint_flier_simple)
project(example_waypoint_flier_simple)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
4 changes: 2 additions & 2 deletions cpp/waypoint_flier_simple/launch/waypoint_flier_simple.launch
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<group ns="$(arg UAV_NAME)">

<!-- WaypointFlierSimple nodelet -->
<node pkg="nodelet" type="nodelet" name="waypoint_flier_simple" args="$(arg nodelet) waypoint_flier_simple/WaypointFlierSimple $(arg nodelet_manager)" launch-prefix="$(arg launch_prefix_debug)" output="screen">
<node pkg="nodelet" type="nodelet" name="waypoint_flier_simple" args="$(arg nodelet) example_waypoint_flier_simple/WaypointFlierSimple $(arg nodelet_manager)" launch-prefix="$(arg launch_prefix_debug)" output="screen">

<!-- ROS parameters config file -->
<rosparam file="$(find waypoint_flier_simple)/config/waypoint_flier.yaml" />
<rosparam file="$(find example_waypoint_flier_simple)/config/waypoint_flier.yaml" />

<!-- Subscribers (note that the topic names will also be remapped using the namespace as a prefix) -->
<remap from="~odom_in" to="estimation_manager/odom_main" />
Expand Down
2 changes: 1 addition & 1 deletion cpp/waypoint_flier_simple/nodelets.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library path="lib/libWaypointFlierSimple">
<class name="waypoint_flier_simple/WaypointFlierSimple" type="waypoint_flier_simple::WaypointFlierSimple" base_class_type="nodelet::Nodelet">
<class name="example_waypoint_flier_simple/WaypointFlierSimple" type="example_waypoint_flier_simple::WaypointFlierSimple" base_class_type="nodelet::Nodelet">
<description>WaypointFlierSimple nodelet</description>
</class>
</library>
7 changes: 2 additions & 5 deletions cpp/waypoint_flier_simple/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<package format="2">

<name>waypoint_flier_simple</name>
<name>example_waypoint_flier_simple</name>
<version>1.0.0</version>
<description>waypoint_flier_simple</description>
<description>Example for the Simple Waypoint Flier</description>

<maintainer email="[email protected]">Daniel Hert</maintainer>
<author email="[email protected]">Daniel Hert</author>
Expand All @@ -20,10 +20,7 @@
<depend>mrs_msgs</depend>

<export>

<!-- The plugins.xml file defines nodelet as a plugin -->
<nodelet plugin="${prefix}/nodelets.xml" />

</export>

</package>
6 changes: 3 additions & 3 deletions cpp/waypoint_flier_simple/src/waypoint_flier_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <random>
//}

namespace waypoint_flier_simple
namespace example_waypoint_flier_simple
{

/* class WaypointFlierSimple //{ */
Expand Down Expand Up @@ -231,8 +231,8 @@ double WaypointFlierSimple::getRandomDouble(double min, double max) {

//}

} // namespace waypoint_flier_simple
} // namespace example_waypoint_flier_simple

/* every nodelet must include macros which export the class as a nodelet plugin */
#include <pluginlib/class_list_macros.h>
PLUGINLIB_EXPORT_CLASS(waypoint_flier_simple::WaypointFlierSimple, nodelet::Nodelet);
PLUGINLIB_EXPORT_CLASS(example_waypoint_flier_simple::WaypointFlierSimple, nodelet::Nodelet);
2 changes: 1 addition & 1 deletion cpp/waypoint_flier_simple/tmux/session.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ windows:
- waypointflier:
layout: tiled
panes:
- waitForControl; roslaunch waypoint_flier_simple waypoint_flier_simple.launch
- waitForControl; roslaunch example_waypoint_flier_simple waypoint_flier_simple.launch
- 'history -s rosservice call /$UAV_NAME/waypoint_flier_simple/start'
- rviz:
layout: tiled
Expand Down

0 comments on commit 422538d

Please sign in to comment.