A plugin for computing the score of the scan and dock task. This plugin derives from the generic ScoringPlugin class. Check out that plugin for other required SDF elements. This plugin requires the following SDF parameters: More...
#include <scan_dock_scoring_plugin.hh>
Public Member Functions | |
ScanDockScoringPlugin () | |
Public Member Functions inherited from ScoringPlugin | |
void | Exit () |
Shutdown Gazebo and ROS. More... | |
ScoringPlugin () | |
Class constructor. More... | |
Private Member Functions | |
void | Load (gazebo::physics::WorldPtr _world, sdf::ElementPtr _sdf) |
void | OnReady () override |
Callback executed when the task state transition into "ready". More... | |
void | OnRunning () override |
Callback executed when the task state transition into "running". More... | |
bool | ParseSDF (sdf::ElementPtr _sdf) |
Parse all SDF parameters. More... | |
void | Update () |
Callback executed at every world update. More... | |
Private Attributes | |
double | colorBonusPoints = 10.0 |
Points granted when the color sequence is correct. More... | |
std::unique_ptr< ColorSequenceChecker > | colorChecker |
In charge of receiving the team submission and compare it with the color sequence from the light buoy. More... | |
bool | colorSubmissionProcessed = false |
Whether we have processed the color sequence submission or not. More... | |
std::string | colorTopic |
Name of colorTopic for the light buoy. More... | |
double | correctDockBonusPoints = 10.0 |
Points granted when the vehicle successfully dock-and-undock in the specified bay. More... | |
double | dockBonusPoints = 10.0 |
Points granted when the vehicle successfully dock-and-undock in any bay. More... | |
std::vector< std::unique_ptr< DockChecker > > | dockCheckers |
Monitor all the available bays to decide when the vehicle docks. More... | |
bool | enableColorChecker = true |
To check colors or not. More... | |
std::vector< std::string > | expectedSequence |
Expected color sequence. More... | |
gazebo::transport::PublisherPtr | lightBuoySequencePub |
Publish the color sequence. More... | |
gazebo::transport::NodePtr | node |
gazebo Node More... | |
gazebo::event::ConnectionPtr | updateConnection |
Pointer to the update event connection. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ScoringPlugin | |
gazebo::common::Time | ElapsedTime () const |
Elapsed time in the running state. More... | |
void | Finish () |
Finish the current task. This will set the "finished" flag in the task message to true. More... | |
double | GetRunningStateDuration () |
Get running duration. More... | |
double | GetTimeoutScore () |
Get the timeoutScore. More... | |
void | Load (gazebo::physics::WorldPtr _world, sdf::ElementPtr _sdf) |
virtual void | ReleaseVehicle () |
Tries to release the vehicle in case is locked. More... | |
gazebo::common::Time | RemainingTime () const |
Remaining time in the running state. More... | |
double | Score () const |
Get the current score. More... | |
void | SetScore (double _newScore) |
Set the score. More... | |
void | SetTimeoutScore (double _timeoutScore) |
Set the score in case of timeout. More... | |
std::string | TaskName () const |
Get the task name. More... | |
std::string | TaskState () const |
Get the task state. More... | |
Protected Attributes inherited from ScoringPlugin | |
gazebo::common::Time | lastCollisionTime |
Last collision time. More... | |
double | runningStateDuration = 300.0 |
Duration (seconds) of the running state (max task time). More... | |
vrx_gazebo::Task | taskMsg |
The next task message to be published. More... | |
std::string | taskName = "undefined" |
The name of the task. More... | |
ros::Publisher | taskPub |
Publisher for the task state. More... | |
gazebo::physics::ModelPtr | vehicleModel |
Pointer to the vehicle to score. More... | |
std::string | vehicleName |
The name of the vehicle to score. More... | |
gazebo::physics::WorldPtr | world |
A world pointer. More... | |
A plugin for computing the score of the scan and dock task. This plugin derives from the generic ScoringPlugin class. Check out that plugin for other required SDF elements. This plugin requires the following SDF parameters:
<enable_color_checker>: Optional parameter to turn off color checker service - default is true. <robot_namespace>: Optional parameter with the ROS namespace. <color_sequence_service>: Optional paramter with the ROS service used to receive the color submission. <color_topic>: Optional gazebo topic used to publish the color sequence defaults to /vrx/light_buoy/new_pattern <color_1>: Expected first color of the sequence (RED, GREEN, BLUE, YELLOW). <color_2>: Expected second color of the sequence (RED, GREEN, BLUE, YELLOW). <color_3>: Expected third color of the sequence (RED, GREEN, BLUE, YELLOW). <color_bonus_points>: Points granted when the color sequence is correct. Default value is 10. <bays>: Contains at least one of the following blocks: <bay>: A bay represents a potential play where a vehicle can dock. It has the following required elements: <name>The name of the bay. This is used for debugging only. <internal_activation_topic>The gazebo topic used to receive notifications from the internal activation zone. <external_activation_topic>The gazebo topic used to receive notifications from the external activation zone. <min_dock_time>Minimum amount of seconds to stay docked to be considered a fully successfull dock. <dockAllowed> Whether is allowed to dock in this bay or not. <dock_bonus_points>: Points granted when the vehicle successfully dock-and-undock in any bay. Default value is 10. <correct_dock_bonus_points>: Points granted when the vehicle successfully dock-and-undock in the specified bay. Default value is 10. <symbol>: Required string with format <COLOR>_<SHAPE>, where color can be "red", "green", "blue", "yellow" and color can be "triangle", "circle", "cross". If this parameter is present, a ROS message will be sent in OnReady(). The vehicle should dock in the bay matching this color and shape.
Here's an example: <plugin name="scan_dock_scoring_plugin" filename="libscan_dock_scoring_plugin.so">
<vehicle>wamv</vehicle> <task_name>scan_dock</task_name> <initial_state_duration>3</initial_state_duration> <ready_state_duration>3</ready_state_duration> <running_state_duration>300</running_state_duration> <release_joints> <joint> <name>wamv_external_pivot_joint</name> </joint> <joint> <name>wamv_external_riser</name> </joint> </release_joints>
<robot_namespace>vrx</robot_namespace> <color_sequence_service>scan_dock/color_sequence</color_sequence_service> <color_1>red</color_1> <color_2>green</color_2> <color_3>blue</color_3>
<bays> <bay> <name>bay1</name> <internal_activation_topic> /vrx/dock_2018/bay_1_internal/contain </internal_activation_topic> <external_activation_topic> /vrx/dock_2018/bay_1_external/contain </external_activation_topic> <min_dock_time>10.0</min_dock_time> <dock_allowed>false</dock_allowed> </bay>
<bay> <name>bay2</name> <internal_activation_topic> /vrx/dock_2018/bay_2_internal/contain </internal_activation_topic> <external_activation_topic> /vrx/dock_2018/bay_2_external/contain </external_activation_topic> <min_dock_time>10.0</min_dock_time> <dock_allowed>true</dock_allowed> <symbol>red_circle</symbol> </bay> </bays> </plugin>
Definition at line 306 of file scan_dock_scoring_plugin.hh.
ScanDockScoringPlugin::ScanDockScoringPlugin | ( | ) |
Definition at line 331 of file scan_dock_scoring_plugin.cc.
|
private |
Definition at line 337 of file scan_dock_scoring_plugin.cc.
|
overrideprivatevirtual |
Callback executed when the task state transition into "ready".
Reimplemented from ScoringPlugin.
Definition at line 608 of file scan_dock_scoring_plugin.cc.
|
overrideprivatevirtual |
Callback executed when the task state transition into "running".
Reimplemented from ScoringPlugin.
Definition at line 617 of file scan_dock_scoring_plugin.cc.
|
private |
Parse all SDF parameters.
[in] | _sdf | SDF elements. |
Definition at line 356 of file scan_dock_scoring_plugin.cc.
|
private |
Callback executed at every world update.
Definition at line 539 of file scan_dock_scoring_plugin.cc.
|
private |
Points granted when the color sequence is correct.
Definition at line 351 of file scan_dock_scoring_plugin.hh.
|
private |
In charge of receiving the team submission and compare it with the color sequence from the light buoy.
Definition at line 339 of file scan_dock_scoring_plugin.hh.
|
private |
Whether we have processed the color sequence submission or not.
Definition at line 348 of file scan_dock_scoring_plugin.hh.
|
private |
Name of colorTopic for the light buoy.
Definition at line 362 of file scan_dock_scoring_plugin.hh.
|
private |
Points granted when the vehicle successfully dock-and-undock in the specified bay.
Definition at line 359 of file scan_dock_scoring_plugin.hh.
|
private |
Points granted when the vehicle successfully dock-and-undock in any bay.
Definition at line 355 of file scan_dock_scoring_plugin.hh.
|
private |
Monitor all the available bays to decide when the vehicle docks.
Definition at line 342 of file scan_dock_scoring_plugin.hh.
|
private |
To check colors or not.
Definition at line 345 of file scan_dock_scoring_plugin.hh.
|
private |
Expected color sequence.
Definition at line 365 of file scan_dock_scoring_plugin.hh.
|
private |
Publish the color sequence.
Definition at line 332 of file scan_dock_scoring_plugin.hh.
|
private |
gazebo Node
Definition at line 329 of file scan_dock_scoring_plugin.hh.
|
private |
Pointer to the update event connection.
Definition at line 335 of file scan_dock_scoring_plugin.hh.