Skip to content

Commit

Permalink
add target heading
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Lehr committed Oct 2, 2014
1 parent 7a2b75e commit 250eb97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion buoy.orogen
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ task_context "ServoingOnWall" do
output_port("aligned_position_cmd", "base::LinearAngular6DCommand")

property("distance_to_buoy", "double", 1)
property("angle_to_wall", "double", 0)
property("target_heading", "double", 1.57)
property("heading_step_size", "double", 0.1)


property("aligned_distance", "double", 0.5)

Expand Down
6 changes: 5 additions & 1 deletion tasks/ServoingOnWall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ void ServoingOnWall::updateHook()
}

double heading_step = base::Angle::normalizeRad(base::getYaw(orientation.orientation) + _heading_step_size.get());
if(heading_step > _target_heading.get()){
heading_step = _target_heading.get();
}


Eigen::Vector3d buoy_rel_pos_in_world = orientation.orientation * buoy.world_coord;
Eigen::Vector3d buoy_offset = orientation.orientation.inverse() * (Eigen::AngleAxisd(heading_step, Eigen::Vector3d::UnitZ()) * Eigen::Vector3d(_distance_to_buoy.get(),0,0));
Expand All @@ -89,7 +93,7 @@ void ServoingOnWall::updateHook()
std::cout << "------------------------------------------------------" << std::endl;
std::cout << "result: + " << aligned_cmd.linear.transpose() << std::endl;

if(world_cmd.linear.norm() < _aligned_distance.get() && state() != ALIGNED){
if(world_cmd.linear.norm() < _aligned_distance.get() && base::getYaw(orientation.orientation) && state() != ALIGNED){
state(ALIGNED);
}

Expand Down

0 comments on commit 250eb97

Please sign in to comment.