Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion direct_kinematics_ros_plugins/test/test_directKinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,21 @@ def command(startTime):
command.header.stamp = rospy.Time.now()
command.pitch_cmd_type = 1
command.target_pitch_value = -0.01
command.target_pumped_volume = 0.5
command.target_pumped_volume = -0.5
command.rudder_control_mode = 1
command.target_heading = math.pi/2
command.motor_cmd_type = 1
command.target_motor_cmd = 0.01
rospy.loginfo(command)
pub.publish(command)
time.sleep(25)

print("\n----- Descend with Pitch control (Batt pos) + Buoyancy engine + Rudder control (angle)------")
command = UwGliderCommand()
command.header.stamp = rospy.Time.now()
command.pitch_cmd_type = 1
command.target_pitch_value = 0.01
command.target_pumped_volume = -0.5
command.rudder_control_mode = 1
command.target_heading = math.pi/2
command.motor_cmd_type = 1
Expand Down
25 changes: 18 additions & 7 deletions glider_hybrid_whoi_ros_plugins/src/UnderwaterGPSROSPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,24 @@ void GazeboRosGps::Update()
fix_.position_covariance[8] = position_error_model_.drift.z*position_error_model_.drift.z + position_error_model_.gaussian_noise.z*position_error_model_.gaussian_noise.z;
#endif

// only publish if z is >= -0.1
// if (fix_.altitude >= -0.1) {
// fix_publisher_.publish(fix_);
// velocity_publisher_.publish(velocity_);
// }
fix_publisher_.publish(fix_);
velocity_publisher_.publish(velocity_);
// Check Submergence
ignition::math::Box boundingBox = this->link->BoundingBox();
double height = boundingBox.ZLength();
double z = this->link->WorldPose().Pos().Z();
bool isSubmerged = true;

// Submerged vessel
if (z + height / 2 > 0 && z < 0)
isSubmerged = false;
else if (z + height / 2 < 0)
isSubmerged = true;

// Publish msg if on surface
if (!isSubmerged)
{
fix_publisher_.publish(fix_);
velocity_publisher_.publish(velocity_);
}
}

// Register this plugin with the simulator
Expand Down