mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
add bunker Actuator feedback function
This commit is contained in:
@@ -24,6 +24,16 @@ struct BunkerCoreState {
|
||||
RcStateMessage rc_state;
|
||||
};
|
||||
|
||||
struct BunkerActuatorState {
|
||||
AgxMsgTimeStamp time_stamp;
|
||||
|
||||
// actuator state
|
||||
ActuatorHSStateMessage actuator_hs_state[2];
|
||||
ActuatorLSStateMessage actuator_ls_state[2];
|
||||
// - for v1 robots only
|
||||
ActuatorStateMessageV1 actuator_state[2];
|
||||
};
|
||||
|
||||
struct BunkerInterface {
|
||||
virtual ~BunkerInterface() = default;
|
||||
|
||||
@@ -31,6 +41,7 @@ struct BunkerInterface {
|
||||
|
||||
// get robot state
|
||||
virtual BunkerCoreState GetRobotState() = 0;
|
||||
virtual BunkerActuatorState GetActuatorState() = 0;
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
|
||||
@@ -47,6 +47,19 @@ class BunkerBase : public AgilexBase<ParserType>, public BunkerInterface {
|
||||
bunker_state.rc_state = state.rc_state;
|
||||
return bunker_state;
|
||||
}
|
||||
|
||||
BunkerActuatorState GetActuatorState() override {
|
||||
auto actuator = AgilexBase<ParserType>::GetActuatorStateMsgGroup();
|
||||
|
||||
BunkerActuatorState bunker_actuator;
|
||||
bunker_actuator.time_stamp = actuator.time_stamp;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
bunker_actuator.actuator_hs_state[i] = actuator.actuator_hs_state[i];
|
||||
bunker_actuator.actuator_ls_state[i] = actuator.actuator_ls_state[i];
|
||||
bunker_actuator.actuator_state[i] = actuator.actuator_state[i];
|
||||
}
|
||||
return bunker_actuator;
|
||||
}
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class BunkerRobot : public RobotCommonInterface, public BunkerInterface {
|
||||
|
||||
// get robot state
|
||||
BunkerCoreState GetRobotState() override;
|
||||
BunkerActuatorState GetActuatorState() override;
|
||||
|
||||
private:
|
||||
RobotCommonInterface* robot_;
|
||||
|
||||
@@ -42,4 +42,9 @@ BunkerCoreState BunkerRobot::GetRobotState() {
|
||||
auto bunker = dynamic_cast<BunkerInterface*>(robot_);
|
||||
return bunker->GetRobotState();
|
||||
}
|
||||
|
||||
BunkerActuatorState BunkerRobot::GetActuatorState() {
|
||||
auto bunker = dynamic_cast<BunkerInterface*>(robot_);
|
||||
return bunker->GetActuatorState();
|
||||
}
|
||||
} // namespace westonrobot
|
||||
Reference in New Issue
Block a user