-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Brazilian-Institute-of-Robotics/maze_solver
Maze solver
- Loading branch information
Showing
15 changed files
with
277 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
find . \! -user doogie -exec chown doogie '{}' + | ||
|
||
source "/opt/ros/$ROS_DISTRO/setup.bash" | ||
|
||
exec gosu doogie "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM ros:kinetic-ros-base | ||
|
||
ARG DOCKER_USER=doogie | ||
|
||
RUN useradd -s /bin/bash ${DOCKER_USER} | ||
|
||
# install gosu | ||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y gosu; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
gosu nobody true | ||
|
||
# install common dev tools | ||
RUN export DEBIAN_FRONTEND=noninteractive; \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
bash-completion \ | ||
pkg-config \ | ||
git \ | ||
vim \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir /home/${DOCKER_USER} && chown ${DOCKER_USER}:${DOCKER_USER} /home/${DOCKER_USER}; | ||
|
||
WORKDIR /home/${DOCKER_USER} | ||
|
||
COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<library path="lib/libgazebo_ground_truth"> | ||
|
||
<class name="doogie_gazebo/GroundTruth" type="doogie_gazebo::GroundTruth" base_class_type="doogie_localization::BaseLocalization"> | ||
<description> | ||
A gazebo ground truth implementation using nav_msgs/Odom msg. | ||
</description> | ||
</class> | ||
|
||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef DOOGIE_GAZEBO_GROUND_TRUTH_HPP_ | ||
#define DOOGIE_GAZEBO_GROUND_TRUTH_HPP_ | ||
|
||
#include <gazebo_msgs/ModelStates.h> | ||
#include <geometry_msgs/PoseStamped.h> | ||
#include <nav_msgs/Odometry.h> | ||
|
||
#include <message_filters/subscriber.h> | ||
#include <tf2_ros/message_filter.h> | ||
#include <tf2_ros/buffer.h> | ||
#include <tf2_ros/transform_broadcaster.h> | ||
#include <tf2_ros/transform_listener.h> | ||
|
||
#include "doogie_localization/base_localization.hpp" | ||
|
||
namespace doogie_gazebo { | ||
|
||
class GroundTruth : public doogie_localization::BaseLocalization { | ||
public: | ||
GroundTruth(); | ||
explicit GroundTruth(const std::string& odom_frame); | ||
virtual ~GroundTruth() = default; | ||
void odomCallBack(const nav_msgs::OdometryConstPtr &odometry_msg); | ||
double getCurrentXPosition() override; | ||
double getCurrentYPosition() override; | ||
double getCurrentYawOrientation() override; | ||
double getCurrentNormalizedYawOrientation() override; | ||
|
||
private: | ||
ros::NodeHandle nh_; | ||
ros::NodeHandle pn_{"~"}; | ||
|
||
std::string odom_frame_; | ||
|
||
tf2_ros::Buffer tf_buffer_; | ||
tf2_ros::TransformListener tf_listener_{tf_buffer_}; | ||
tf2_ros::TransformBroadcaster tf_broadcaster_; | ||
|
||
message_filters::Subscriber<nav_msgs::Odometry> odom_sub_; | ||
tf2_ros::MessageFilter<nav_msgs::Odometry> tf2_filter_; | ||
|
||
geometry_msgs::PoseStamped current_pose_; | ||
geometry_msgs::Twist current_velocity_; | ||
}; | ||
|
||
} // doogie_gazebo | ||
|
||
#endif // DOOGIE_GAZEBO_GROUND_TRUTH_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0"?> | ||
<launch> | ||
|
||
<arg name="namespace" default="doogie"/> | ||
|
||
<include file="$(find doogie_gazebo)/launch/robot_launch.launch"> | ||
<arg name="namespace" value="$(arg namespace)"/> | ||
</include> | ||
|
||
<group ns="$(arg namespace)"> | ||
<!--Note: all names [ such as nodes, topics, params...] called inside '<group ns>' will be prefixed by | ||
/doogie (e.g., /doogie/robot_description) --> | ||
|
||
<!-- doogie_move_in_maze controller --> | ||
<include file="$(find doogie_navigation)/launch/move_in_maze.launch"/> | ||
|
||
<!-- doogie_perception --> | ||
<include file="$(find doogie_perception)/launch/doogie_perception.launch"> | ||
<arg name="ns" value="$(arg namespace)"/> | ||
</include> | ||
|
||
<!-- wall_distances publisher --> | ||
<node name="ir_sensor_data_acc_node" pkg="doogie_gazebo" type="ir_sensor_data_acc_node" output="screen"> | ||
<rosparam file="$(find doogie_gazebo)/config/sensor_commons.yaml" command="load"/> | ||
</node> | ||
|
||
<!-- rviz occupancy grid --> | ||
<include file="$(find doogie_rviz)/launch/maze_map.launch"> | ||
<arg name="ns" value="$(arg namespace)"/> | ||
</include> | ||
|
||
</group> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<launch> | ||
|
||
<arg name="namespace" default="doogie"/> | ||
|
||
<include file="$(find doogie_gazebo)/launch/sim_move_base_interface.launch"> | ||
<arg name="namespace" value="$(arg namespace)"/> | ||
</include> | ||
|
||
<group ns="$(arg namespace)"> | ||
<!--Note: all names [ such as nodes, topics, params...] called inside '<group ns>' will be prefixed by | ||
/doogie (e.g., /doogie/robot_description) --> | ||
|
||
<include file="$(find doogie_navigation)/launch/maze_solver.launch"/> | ||
|
||
</group> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "doogie_gazebo/ground_truth.hpp" | ||
|
||
#include <angles/angles.h> | ||
#include <pluginlib/class_list_macros.h> | ||
#include <tf2/utils.h> | ||
#include <tf2_geometry_msgs/tf2_geometry_msgs.h> | ||
|
||
namespace doogie_gazebo { | ||
|
||
GroundTruth::GroundTruth() : GroundTruth("odom") {} | ||
|
||
GroundTruth::GroundTruth(const std::string& odom_frame) | ||
: odom_frame_(odom_frame) | ||
, tf2_filter_(odom_sub_, tf_buffer_, odom_frame, 1, nullptr) { | ||
std::string topic_name = "/gazebo/ground_truth"; | ||
pn_.getParam("input_topic", topic_name); | ||
odom_sub_.subscribe(nh_, topic_name, 1); | ||
tf2_filter_.registerCallback(boost::bind(&GroundTruth::odomCallBack, this, _1)); | ||
} | ||
|
||
void GroundTruth::odomCallBack(const nav_msgs::OdometryConstPtr &odometry_msg) { | ||
ROS_DEBUG_THROTTLE(0.5, "odom callback"); | ||
current_pose_.header = odometry_msg->header; | ||
current_pose_.pose = odometry_msg->pose.pose; | ||
current_velocity_ = odometry_msg->twist.twist; | ||
|
||
tf_buffer_.transform(current_pose_, current_pose_, odom_frame_); | ||
ROS_DEBUG_THROTTLE(1.0, "Doogie Position(x:%f y:%f z:%f)\n", | ||
current_pose_.pose.position.x, | ||
current_pose_.pose.position.y, | ||
current_pose_.pose.position.z); | ||
|
||
tf2::Stamped<tf2::Transform> temp; | ||
tf2::fromMsg(current_pose_, temp); | ||
geometry_msgs::TransformStamped gt_tf = tf2::toMsg(temp); | ||
gt_tf.child_frame_id = "ground_truth"; | ||
tf_broadcaster_.sendTransform(gt_tf); | ||
} | ||
|
||
double GroundTruth::getCurrentXPosition() { | ||
return current_pose_.pose.position.x; | ||
} | ||
|
||
double GroundTruth::getCurrentYPosition() { | ||
return current_pose_.pose.position.y; | ||
} | ||
|
||
double GroundTruth::getCurrentYawOrientation() { | ||
return tf2::getYaw(current_pose_.pose.orientation); | ||
} | ||
|
||
double GroundTruth::getCurrentNormalizedYawOrientation() { | ||
return angles::normalize_angle(getCurrentYawOrientation()); | ||
} | ||
|
||
} // doogie_gazebo | ||
|
||
PLUGINLIB_EXPORT_CLASS(doogie_gazebo::GroundTruth, doogie_localization::BaseLocalization) |
Oops, something went wrong.