Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mavros_extras/obstacle_distance: Change namespace, add angle_offset #1370

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mavros/launch/px4_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,8 @@ wheel_odometry:
frame_id: "odom"
child_frame_id: "base_link"

# obstacle_distance
obstacle_distance:
mav_frame: "GLOBAL" # PX4 1.10 supports GLOBAL, LOCAL_NED, BODY_FRD

# vim:set ts=2 sw=2 et:
4 changes: 3 additions & 1 deletion mavros_extras/src/plugins/obstacle_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using mavlink::common::MAV_DISTANCE_SENSOR;
class ObstacleDistancePlugin : public plugin::PluginBase {
public:
ObstacleDistancePlugin() : PluginBase(),
obstacle_nh("~obstacle")
obstacle_nh("~obstacle_distance")
{ }

void initialize(UAS &uas_)
Expand Down Expand Up @@ -109,6 +109,8 @@ class ObstacleDistancePlugin : public plugin::PluginBase {
obstacle.min_distance = req->range_min * 1e2; //!< [centimeters]
obstacle.max_distance = req->range_max * 1e2; //!< [centimeters]
obstacle.frame = utils::enum_value(frame);
// Assume angle_increment is positive and incoming message is in a FRD/NED frame
obstacle.angle_offset = req->angle_min * RAD_TO_DEG; //!< [degrees]

ROS_DEBUG_STREAM_NAMED("obstacle_distance", "OBSDIST: sensor type: " << utils::to_string_enum<MAV_DISTANCE_SENSOR>(obstacle.sensor_type)
<< std::endl << obstacle.to_yaml());
Expand Down