Skip to content

Commit 9bf76d2

Browse files
fjonath1cpaxton
authored andcommitted
Fix background normal direction to always be on opposite direction of z camera axis
1 parent f1d4d8a commit 9bf76d2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/ros_sequential_scene_parsing.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ void RosSceneHypothesisAssessor::setNodeHandle(const ros::NodeHandle &nh)
8080
nh.param("small_obj_g_comp",GRAVITY_SCALE_COMPENSATION,3);
8181
nh.param("sim_freq_multiplier",SIMULATION_FREQUENCY_MULTIPLIER,1.);
8282

83+
std::cerr << "Debug mode: " << debug_mode << std::endl;
84+
this->setDebugMode(debug_mode);
85+
8386
// physics engine solver settings: check http://bulletphysics.org/mediawiki-1.5.8/index.php/BtContactSolverInfo
8487
int num_iterations;
8588
bool split_impulse, randomize_order;
@@ -91,6 +94,8 @@ void RosSceneHypothesisAssessor::setNodeHandle(const ros::NodeHandle &nh)
9194
this->physics_engine_.setPhysicsSolverSetting(num_iterations, randomize_order,
9295
int(split_impulse), impulse_penetration_threshold);
9396

97+
this->physics_engine_.setGravityFromBackgroundNormal(background_normal_as_gravity_);
98+
9499
SCALED_GRAVITY_MAGNITUDE = SCALING * GRAVITY_MAGNITUDE / GRAVITY_SCALE_COMPENSATION;
95100

96101
if (load_table){
@@ -106,9 +111,6 @@ void RosSceneHypothesisAssessor::setNodeHandle(const ros::NodeHandle &nh)
106111
std::cerr << "Failed to load the background points\n";
107112
}
108113

109-
std::cerr << "Debug mode: " << debug_mode << std::endl;
110-
this->setDebugMode(debug_mode);
111-
112114
this->obj_database_.setObjectFolderLocation(object_folder_location);
113115
if (this->fillObjectPropertyDatabase()) this->obj_database_.loadDatabase(this->physical_properties_database_);
114116
this->physics_engine_.setObjectPenaltyDatabase(this->obj_database_.getObjectPenaltyDatabase());

src/sequential_scene_parsing.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ void SceneHypothesisAssessor::addBackground(ImagePtr background_image, int mode)
5454
btVector3 normal_bt = convertEigenToBulletVector(normal);
5555
float coeff = coefficients->values[3];
5656

57+
// make the plane normal to always point in opposite direction to the camera frame Z axis
58+
if (normal_bt.dot(btVector3(0,0,1)) > 0)
59+
{
60+
normal_bt = -normal_bt;
61+
coeff = -coeff;
62+
}
63+
5764
Eigen::Vector4f cloud_centroid;
5865
pcl::compute3DCentroid(*background_image,cloud_centroid);
5966
btVector3 bt_cloud_centroid(cloud_centroid[0],cloud_centroid[1],cloud_centroid[2]);

0 commit comments

Comments
 (0)