stationkeeping_scoring_plugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef VRX_GAZEBO_STATIONKEEPING_SCORING_PLUGIN_HH_
19 #define VRX_GAZEBO_STATIONKEEPING_SCORING_PLUGIN_HH_
20 
21 #include <geographic_msgs/GeoPoseStamped.h>
22 #include <ros/ros.h>
23 #include <memory>
24 #include <string>
25 #include <gazebo/common/Events.hh>
26 #include <gazebo/common/Timer.hh>
27 #include <gazebo/physics/World.hh>
28 #include <sdf/sdf.hh>
31 
55 {
58 
59  // Documentation inherited.
60  public: void Load(gazebo::physics::WorldPtr _world,
61  sdf::ElementPtr _sdf);
62 
64  private: void Update();
65 
66  // Documentation inherited.
67  private: void OnReady() override;
68 
69  // Documentation inherited.
70  private: void OnRunning() override;
71 
73  private: void PublishGoal();
74 
76  private: gazebo::event::ConnectionPtr updateConnection;
77 
79  private: std::string goalTopic = "/vrx/station_keeping/goal";
80 
82  private: std::string poseErrorTopic = "/vrx/station_keeping/pose_error";
83 
85  private: std::string meanErrorTopic = "/vrx/station_keeping/rms_error";
86 
88  private: std::unique_ptr<ros::NodeHandle> rosNode;
89 
92 
95 
98 
100  private: double goalX;
101 
103  private: double goalY;
104 
106  private: double goalYaw;
107 
109  private: double goalLat;
110 
112  private: double goalLon;
113 
115  private: double poseError;
116 
118  private: unsigned int sampleCount = 0;
119 
121  private: double totalPoseError = 0;
122 
124  private: double meanError;
125 
127  private: gazebo::common::Timer timer;
128 
131 };
132 
133 #endif
void OnReady() override
Callback executed when the task state transition into "ready".
std::string poseErrorTopic
Topic where 2D pose error is published.
A plugin for computing the score of the station keeping task. This plugin derives from the generic Sc...
WaypointMarkers waypointMarkers
Waypoint visualization markers.
double meanError
Cumulative 2D RMS error in meters.
double goalY
Goal pose in local (Gazebo) coordinates.
double poseError
Combined 2D pose error (distance and yaw).
ros::Publisher goalPub
Publisher for the goal.
void Update()
Callback executed at every world update.
double goalLon
Goal pose in spherical (WGS84) coordinates.
double goalLat
Goal pose in spherical (WGS84) coordinates.
void PublishGoal()
Publish the goal pose.
gazebo::event::ConnectionPtr updateConnection
Pointer to the update event connection.
std::string meanErrorTopic
Topic where mean pose error is published.
std::string goalTopic
Topic where the task stats are published.
double goalYaw
Goal pose in local (Gazebo) coordinates.
double totalPoseError
Sum of all pose error scores calculated so far.
void Load(gazebo::physics::WorldPtr _world, sdf::ElementPtr _sdf)
A plugin that provides common functionality to any scoring plugin. This plugin defines four different...
void OnRunning() override
Callback executed when the task state transition into "running".
This class is used to display waypoint markers. Cylindrical Gazebo markers are drawn with text on top...
std::unique_ptr< ros::NodeHandle > rosNode
ROS node handle.
unsigned int sampleCount
Number of instant pose error scores calculated so far .
ros::Publisher meanErrorPub
Publisher for the current mean error.
gazebo::common::Timer timer
Timer used to calculate the elapsed time docked in the bay.
ros::Publisher poseErrorPub
Publisher for the combined 2D pose error.
double goalX
Goal pose in local (Gazebo) coordinates.


vrx_gazebo
Author(s): Brian Bingham , Carlos Aguero
autogenerated on Thu May 7 2020 03:54:56