Random scene generation example implementation. More...
#include "scene_example.hh"
Functions | |
std::regex | g_regex_uid (REGEX_XML_UID) |
std::regex | g_regex_model (REGEX_XML_MODEL) |
int | main (int argc, char **argv) |
void | addModelFromFile (gap::msgs::WorldUtilsRequest &msg, const std::string &file) |
Function prototypes. More... | |
void | addDynamicModels (gap::msgs::WorldUtilsRequest &msg) |
Add objects in global grid to WorldUtils spawn request. More... | |
void | updateObjects (gap::msgs::VisualUtilsRequest &msg) |
Add objects in global grid to VisualUtils update request. More... | |
void | addMoveObject (gap::msgs::WorldUtilsRequest &msg, const std::string &name, const bool is_light, const ignition::math::Pose3d &pose) |
Add move object command to WorldUtils request. More... | |
ignition::math::Pose3d | getRandomCameraPose () |
Obtain random camera pose in dome. More... | |
ignition::math::Pose3d | getRandomLightPose () |
Obtain random light pose in dome. More... | |
void | createNameSet () |
Create set with names of existing objects. More... | |
void | addProjections (gap::msgs::CameraUtilsRequest &msg) |
Add 3D points to projection request. More... | |
void | moveCamera (gazebo::transport::PublisherPtr pub) |
Move camera to global camera pose. More... | |
void | captureScene (gazebo::transport::PublisherPtr pub, int iteration) |
Send CameraUtils request to capture current scene. More... | |
bool | waitForMove () |
Wait for camera to move to new pose. More... | |
bool | waitForVisuals () |
Wait for visuals to update. More... | |
bool | waitForCamera () |
Wait for camera to save frame to disk. More... | |
bool | waitForProjections () |
Wait for projected points. More... | |
void | onVisualUtilsResponse (VisualUtilsResponsePtr &_msg) |
Callback function for VisualUtils response. More... | |
void | onWorldUtilsResponse (WorldUtilsResponsePtr &_msg) |
Callback function for WorldUtils response. More... | |
void | onCameraUtilsResponse (CameraUtilsResponsePtr &_msg) |
Callback function for CameraUtils response. More... | |
void | setPhysics (gazebo::transport::PublisherPtr pub, bool enable) |
Enables/disables physics engine. More... | |
void | storeAnnotations (const std::string &path, const int iteration) |
Store current scene annotations. More... | |
Variables | |
ObjectGrid | g_grid (3, 3, 3, 3, 1) |
const int | g_obj_min {2} |
const int | g_obj_max {7} |
const bool | g_move_light {true} |
const ignition::math::Vector3d | g_light_pos {1.5, 1.5, 5.5} |
const ignition::math::Vector3d | g_camera_pos {1.5, 1.5, 3.2} |
const int | g_viewpoint {FIXED_VIEW} |
bool | g_moved {false} |
std::mutex | g_moved_mutex |
bool | g_camera_ready {false} |
std::mutex | g_camera_ready_mutex |
bool | g_points_ready {false} |
std::mutex | g_points_ready_mutex |
bool | g_visuals_ready {false} |
std::mutex | g_visuals_ready_mutex |
std::set< std::string > | g_names |
ignition::math::Pose3d | g_camera_pose |
Random scene generation example implementation.
Generates a scene with up to 10 objects in a 4x4 grid.
void addDynamicModels | ( | gap::msgs::WorldUtilsRequest & | msg | ) |
Add objects in global grid to WorldUtils spawn request.
msg | WorldUtils request message |
void addModelFromFile | ( | gap::msgs::WorldUtilsRequest & | msg, |
const std::string & | file | ||
) |
Function prototypes.
Adds an SDF model to a WorldUtils request
msg | WorldUtils request message |
file | SDF file with model |
void addMoveObject | ( | gap::msgs::WorldUtilsRequest & | msg, |
const std::string & | name, | ||
const bool | is_light, | ||
const ignition::math::Pose3d & | pose | ||
) |
Add move object command to WorldUtils request.
msg | WordlUtils request |
name | Object name |
is_light | Whether object is a light |
pose | New object pose |
void addProjections | ( | gap::msgs::CameraUtilsRequest & | msg | ) |
Add 3D points to projection request.
void captureScene | ( | gazebo::transport::PublisherPtr | pub, |
int | iteration | ||
) |
Send CameraUtils request to capture current scene.
pub | Publisher for CameraUtils request topic |
iteration | Current iteration |
void createNameSet | ( | ) |
Create set with names of existing objects.
std::regex g_regex_model | ( | REGEX_XML_MODEL | ) |
std::regex g_regex_uid | ( | REGEX_XML_UID | ) |
ignition::math::Pose3d getRandomCameraPose | ( | ) |
Obtain random camera pose in dome.
ignition::math::Pose3d getRandomLightPose | ( | ) |
Obtain random light pose in dome.
int main | ( | int | argc, |
char ** | argv | ||
) |
void moveCamera | ( | gazebo::transport::PublisherPtr | pub | ) |
Move camera to global camera pose.
void onCameraUtilsResponse | ( | CameraUtilsResponsePtr & | _msg | ) |
Callback function for CameraUtils response.
_msg | Incoming message |
void onVisualUtilsResponse | ( | VisualUtilsResponsePtr & | _msg | ) |
Callback function for VisualUtils response.
_msg | Incoming message |
void onWorldUtilsResponse | ( | WorldUtilsResponsePtr & | _msg | ) |
Callback function for WorldUtils response.
_msg | Incoming message |
void setPhysics | ( | gazebo::transport::PublisherPtr | pub, |
bool | enable | ||
) |
Enables/disables physics engine.
pub | WorldUtils publisher ptr |
enable | Desired physics engine status |
void storeAnnotations | ( | const std::string & | path, |
const int | iteration | ||
) |
Store current scene annotations.
path | Path to dataset folder |
iteration | Current iteration |
void updateObjects | ( | gap::msgs::VisualUtilsRequest & | msg | ) |
Add objects in global grid to VisualUtils update request.
bool waitForCamera | ( | ) |
Wait for camera to save frame to disk.
bool waitForMove | ( | ) |
Wait for camera to move to new pose.
bool waitForProjections | ( | ) |
Wait for projected points.
bool waitForVisuals | ( | ) |
Wait for visuals to update.
const ignition::math::Vector3d g_camera_pos {1.5, 1.5, 3.2} |
ignition::math::Pose3d g_camera_pose |
bool g_camera_ready {false} |
std::mutex g_camera_ready_mutex |
ObjectGrid g_grid(3, 3, 3, 3, 1) |
const ignition::math::Vector3d g_light_pos {1.5, 1.5, 5.5} |
const bool g_move_light {true} |
bool g_moved {false} |
std::mutex g_moved_mutex |
std::set<std::string> g_names |
const int g_obj_max {7} |
const int g_obj_min {2} |
bool g_points_ready {false} |
std::mutex g_points_ready_mutex |
const int g_viewpoint {FIXED_VIEW} |
bool g_visuals_ready {false} |
std::mutex g_visuals_ready_mutex |