Controls the shape and color of a symbol. More...
#include <symbol_controller.hh>
Public Member Functions | |
virtual void | Load (gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf) |
void | Shuffle () |
Create a new combination of shape/color. More... | |
SymbolController ()=default | |
Constructor. More... | |
Private Member Functions | |
void | Publish (const ros::TimerEvent &_event) |
Publish the current shape/color combination. This callback is used for publishing the current combination after some time to make sure that all subscribers are up and runnig. More... | |
void | Publish () |
Publish the current shape/color combination. More... | |
bool | Shuffle (std_srvs::Trigger::Request &_req, std_srvs::Trigger::Response &_res) |
ROS service callback for creating a new shape/color combination. More... | |
void | ShuffleColor () |
Choose a new random color. More... | |
void | ShuffleShape () |
Choose a new random shape. More... | |
Private Attributes | |
ros::ServiceServer | changePatternServer |
Service to generate a new random shape/color. More... | |
std::string | color |
The current color. More... | |
ros::NodeHandle | nh |
Node handle. More... | |
std::string | shape |
The current shape. More... | |
std::vector< ros::Publisher > | symbolPubs |
Publisher to set the color to each of the 3 potential shapes. More... | |
ros::Timer | timer |
Timer triggered in simulated time to update the shape/color for. More... | |
Static Private Attributes | |
static std::map< std::string, std_msgs::ColorRGBA > | kColors |
List of the color options (red, green, blue, and no color) with their string name for logging. More... | |
static std::vector< std::string > | kShapes |
List of the shape options (circle, cross, triangle) with their string name for logging. More... | |
Controls the shape and color of a symbol.
It selects a shape (triangle, cross, circle) and a color (red, green, blue) and applies to the current symbol This plugin can be configured with the following SDF tags:
<robotNamespace> ROS namespace of Node, can be used to have multiple plugins. <shape> "triangle", "cross" or "circle". If ommited, the shape will be randomly selected. <color> "red", "green" or "blue". If ommited, the color will be randomly selected.
Definition at line 43 of file symbol_controller.hh.
|
default |
Constructor.
|
virtual |
Definition at line 53 of file symbol_controller.cc.
|
private |
Publish the current shape/color combination. This callback is used for publishing the current combination after some time to make sure that all subscribers are up and runnig.
[in] | _event | Unused. |
Definition at line 187 of file symbol_controller.cc.
|
private |
Publish the current shape/color combination.
Definition at line 193 of file symbol_controller.cc.
void SymbolController::Shuffle | ( | ) |
Create a new combination of shape/color.
Definition at line 150 of file symbol_controller.cc.
|
private |
ROS service callback for creating a new shape/color combination.
[in] | _req | Unused. |
[out] | _res | Service result. |
Definition at line 141 of file symbol_controller.cc.
|
private |
Choose a new random color.
Definition at line 172 of file symbol_controller.cc.
|
private |
Choose a new random shape.
Definition at line 158 of file symbol_controller.cc.
|
private |
Service to generate a new random shape/color.
Definition at line 95 of file symbol_controller.hh.
|
private |
The current color.
Definition at line 86 of file symbol_controller.hh.
|
staticprivate |
List of the color options (red, green, blue, and no color) with their string name for logging.
Definition at line 79 of file symbol_controller.hh.
|
staticprivate |
List of the shape options (circle, cross, triangle) with their string name for logging.
Definition at line 83 of file symbol_controller.hh.
|
private |
Node handle.
Definition at line 98 of file symbol_controller.hh.
|
private |
The current shape.
Definition at line 89 of file symbol_controller.hh.
|
private |
Publisher to set the color to each of the 3 potential shapes.
Definition at line 92 of file symbol_controller.hh.
|
private |
Timer triggered in simulated time to update the shape/color for.
Definition at line 102 of file symbol_controller.hh.