Skip to content

Commit 7e16a62

Browse files
committed
FIX: position '0' is when opened and '255' when closed (calculation)
1 parent 04fd82c commit 7e16a62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

robotiq_hande_driver/src/application.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ double ApplicationLayer::Position(){
6767
}
6868

6969
void ApplicationLayer::SetPosition(double position){
70-
uint8_t raw_position = uint8_t(position / kGripperPositionStep - kGripperPositionMin);
70+
uint8_t raw_position = uint8_t(kGripperPositionMax - position / kGripperPositionStep);
7171

7272
protocol_logic_.GoTo(raw_position, 255, 255);
7373
}
@@ -90,7 +90,7 @@ void ApplicationLayer::Read(){
9090
//fault_status
9191

9292
requested_position_ = (double)protocol_logic_.GetRegPos() * kGripperPositionStep + kGripperPositionMin;
93-
position_ = (double)protocol_logic_.GetPos() * kGripperPositionStep + kGripperPositionMin;
93+
position_ = kGripperPositionMax - (double)protocol_logic_.GetPos() * kGripperPositionStep;
9494
current_ = (double)protocol_logic_.GetCurrent() * kGripperCurrentScale;
9595
}
9696

0 commit comments

Comments
 (0)