...
 
Commits (2)
......@@ -68,7 +68,7 @@ void Basecontroller::UpdateMotorTargetVelocities() {
mRamp.GenerateRamp(*mRampedVelocities, *mTargetVelocities);
for (auto motor : *mMotors) {
motor->getPdoHandle()->setTargetVelocity(
motor->GetPdoHandle()->setTargetVelocity(
mRampedVelocities->dataByType()[motor->ordinal_in_datagram]);
}
}
......@@ -226,8 +226,8 @@ Error Basecontroller::CyclicCANSyncCallback() {
UpdateMotorTargetVelocities();
for (auto motor : *mMotors) {
motor->getPdoHandle()->getStatusWord((*mStatus_word)[motor->ordinal_in_datagram]);
motor->getPdoHandle()->getVelocityActualValue(
motor->GetPdoHandle()->getStatusWord((*mStatus_word)[motor->ordinal_in_datagram]);
motor->GetPdoHandle()->getVelocityActualValue(
mActualVelocities->dataByType()[motor->ordinal_in_datagram]);
}
......
......@@ -36,7 +36,6 @@ private:
void sendCommandToRos(Ethprotocol::Cmd command);
InstanceFactory& mInstanceFactory;
EthHandler::DeviceId mDevice_id;
bool mRos_link_enabled;
......@@ -44,8 +43,6 @@ private:
bool mCritical_fault;
Motor* mMotor;
EMROSCmdType::AuxiliaryController::TargetPositionsInterface* mTargetPositions;
EMROSCmdType::AuxiliaryController::ActualPositionsInterface* mActualPositions;
EthHandler::ObserverEthHandler mObserver_eth;
MsgBoxHandler::ObserverMsgBox mObserver_msg_box;
......@@ -56,8 +53,6 @@ private:
ProfilePositionMode mProfilePositionHandle;
HomingMode mHomingModeHandle;
uint8_t mCntSyncLeftTillResetStartTravelBit;
enum OperationalState {
POSITIONING_STATE, HOMING_STATE
}mOperationalState;
......
......@@ -11,11 +11,9 @@ namespace {
using namespace EMROSCmdType::AuxiliaryController;
AuxiliaryController::AuxiliaryController() :
mInstanceFactory(*InstanceFactory::instance()), mDevice_id(DEVICE_ID), mRos_link_enabled(
false), mHeartbeat(true), mCritical_fault(false), mMotor(
MotorManagerAux::instance()->GetMotor("MotorAuxiliaryOne")), mTargetPositions(
mInstanceFactory.GetTargetPositionsInstance()), mActualPositions(
mInstanceFactory.GetActualPositionsInstance()), mObserver_eth(
mDevice_id(DEVICE_ID), mRos_link_enabled(false), mHeartbeat(true), mCritical_fault(
false), mMotor(
MotorManagerAux::instance()->GetMotor("MotorAuxiliaryOne")), mObserver_eth(
mDevice_id, &AuxiliaryController::EthMsgCallback, this), mObserver_msg_box(
mDevice_id, &AuxiliaryController::MsgBoxCallback, this), mObserver_msg_box_broadcast(
EMROSCmdType::BROADCAST_ID,
......@@ -25,18 +23,13 @@ AuxiliaryController::AuxiliaryController() :
period_for_reporting_actual_values_in_cansyncs,
&AuxiliaryController::SendActualPositionsCallback, this), mProfilePositionHandle(
ProfilePositionMode(this->mMotor)), mHomingModeHandle(
this->mMotor), mOperationalState(
POSITIONING_STATE), mCntSyncLeftTillResetStartTravelBit(0) {
this->mMotor), mOperationalState(POSITIONING_STATE) {
EnterPositioningState();
//PreConfigurePositionMode();
//mMotor->SetApplicationConfigFinished();
}
AuxiliaryController::~AuxiliaryController() {
delete &mMotor;
delete &mTargetPositions;
delete &mActualPositions;
}
Error AuxiliaryController::MsgBoxCallback(
......@@ -84,44 +77,37 @@ Error AuxiliaryController::EthMsgCallback(
EthHandler::Dataframe tx_eth_msg { };
switch (dataframe.getData().cmd) {
case SET_ABSOLUT_POSITION_MODE:
mProfilePositionHandle.ConfigureAbsolutePositionMode();
break;
case SET_RELATIVE_POSITION_MODE:
mProfilePositionHandle.ConfigureRelativePositionMode();
break;
case SET_IMMIDIATE_ADAPTION_OF_NEW_MOVE_ORDERS:
mProfilePositionHandle.ConfigureImmidiateAdaptionOfNewMoveOrders();
break;
case SET_FINISH_MOVE_BEFORE_NEW_MOVE_ORDERS:
mProfilePositionHandle.ConfigureFinishMoveOrdersBeforeNewMoveOrders();
break;
case TARGET_POSITION:
CopyTargetPositionFromDataFrame(dataframe);
mProfilePositionHandle.SetTargetPosition(mTargetPositions);
mProfilePositionHandle.SetTargetPosition(dataframe);
mProfilePositionHandle.SetStartTravelCommand();
mCntSyncLeftTillResetStartTravelBit = time_to_set_start_travel_order_in_syncs;
break;
case HOME_TO_NEGATIVE_LIMIT_SWITCH_AND_INDEX_METHOD_1:
EnterHomingState(homing_mode::method::code::method_1_home_to_negative_limit_switch_and_index);
EnterHomingState(
homing_mode::method::code::method_1_home_to_negative_limit_switch_and_index);
break;
case HOME_TO_POSITIVE_LIMIT_SWITCH_AND_INDEX_METHOD_2:
EnterHomingState(homing_mode::method::code::method_2_home_to_positive_limit_switch_and_index);
EnterHomingState(
homing_mode::method::code::method_2_home_to_positive_limit_switch_and_index);
break;
case HOME_TO_NEGATIVE_LIMIT_SWITCH_METHOD_17:
EnterHomingState(homing_mode::method::code::method_17_home_to_negative_limit_switch);
EnterHomingState(
homing_mode::method::code::method_17_home_to_negative_limit_switch);
break;
case HOME_TO_POSITIVE_LIMIT_SWITCH_METHOD_18:
EnterHomingState(homing_mode::method::code::method_18_home_to_positive_limit_switch);
EnterHomingState(
homing_mode::method::code::method_18_home_to_positive_limit_switch);
break;
case HOME_TO_INDEX_IN_NEGATIVE_DIRECTION_METHOD_33:
EnterHomingState(homing_mode::method::code::method_33_home_to_negative_index);
EnterHomingState(
homing_mode::method::code::method_33_home_to_negative_index);
break;
case HOME_TO_INDEX_IN_POSITIVE_DIRECTION_METHOD_34:
EnterHomingState(homing_mode::method::code::method_34_home_to_positive_index);
EnterHomingState(
homing_mode::method::code::method_34_home_to_positive_index);
break;
case HOME_TO_CURRENT_POSITION_METHOD_35:
EnterHomingState(homing_mode::method::code::method_35_home_to_current_position);
EnterHomingState(
homing_mode::method::code::method_35_home_to_current_position);
break;
default:
break;
......@@ -164,39 +150,16 @@ Error AuxiliaryController::SendActualPositionsCallback() {
tx_eth_msg.setData().cmd = ACTUAL_POSITION;
tx_eth_msg.setData().time =
CANSyncHandler::instance()->GetTimeOfLastSyncInUs();
mProfilePositionHandle.GetActualPosition(mActualPositions);
status = mActualPositions->get(tx_eth_msg.setData().payload.begin(),
Ethprotocol::MAX_PAYLOAD_LENGTH);
status = mProfilePositionHandle.GetActualPosition(tx_eth_msg);
if (status == Error::ERROR) {
return (Error::ERROR);
return Error::ERROR;
}
tx_eth_msg.setData().payload_length = Ethprotocol::PayLen(
mActualPositions->getRawSize());
EthHandler::instance()->SendEthMsg(tx_eth_msg);
}
return (status);
}
Error AuxiliaryController::CopyTargetPositionFromDataFrame(
const EthHandler::Dataframe& dataframe) {
Error status { Error::NO_ERROR };
status = mTargetPositions->set(dataframe.getData().payload.begin(),
dataframe.getData().payload_length);
if (status == Error::ERROR) {
OFCLoggerRTClient::instance()->InsertError(__PRETTY_FUNCTION__,
"wrong data size for target positions)");
}
return (status);
}
//void AuxiliaryController::PreConfigurePositionMode() {
// mProfilePositionHandle.ResetStartTravelCommand();
// mProfilePositionHandle.ConfigureAbsolutePositionMode();
// mProfilePositionHandle.ConfigureImmidiateAdaptionOfNewMoveOrders();
//}
Error AuxiliaryController::CheckAndResetHeartbeat() {
if (mHeartbeat == true) {
mHeartbeat = false;
......@@ -214,45 +177,38 @@ void AuxiliaryController::ReactToCriticalError() {
" security heartbeat failed");
}
void AuxiliaryController::EnterPositioningState(){
mProfilePositionHandle.ResetStartTravelCommand();
void AuxiliaryController::EnterPositioningState() {
mOperationalState = POSITIONING_STATE;
mMotor->SetTargetModeOfOperation(
modes_of_operation_specific::code::ProfilePosition);
mProfilePositionHandle.ConfigureAbsolutePositionMode();
mProfilePositionHandle.ConfigureImmidiateAdaptionOfNewMoveOrders();
mMotor->SetApplicationConfigFinished();
mProfilePositionHandle.PreparePositioning();
}
void AuxiliaryController::PerformPositioningState() {
if (mProfilePositionHandle.IsSetPointAcknoledged()){
mProfilePositionHandle.ResetStartTravelCommand();
}
mProfilePositionHandle.PerformCyclicDuties();
}
Error AuxiliaryController::EnterHomingState(homing_mode::method::type homing_method)
{
mOperationalState =HOMING_STATE;
if(mHomingModeHandle.StartHomingProcedure(homing_method)==Error::ERROR){
Error AuxiliaryController::EnterHomingState(
homing_mode::method::type homing_method) {
mOperationalState = HOMING_STATE;
if (mHomingModeHandle.StartHomingProcedure(homing_method) == Error::ERROR) {
return Error::ERROR;
}else{
} else {
return Error::NO_ERROR;
}
}
void AuxiliaryController::PerformHomingState()
{
if(mHomingModeHandle.PerformHomingProcedure() == Error::ERROR){
void AuxiliaryController::PerformHomingState() {
if (mHomingModeHandle.PerformHomingProcedure() == Error::ERROR) {
sendCommandToRos(HOMING_ERROR);
EnterPositioningState();
}else if (mHomingModeHandle.IsHomingProcedureFinished()) {
OFCLoggerRTClient::instance()->InsertInfo("Homing of ",mMotor->name," complete");
} else if (mHomingModeHandle.IsHomingProcedureFinished()) {
OFCLoggerRTClient::instance()->InsertInfo("Homing of ", mMotor->name,
" complete");
sendCommandToRos(HOMING_COMPLETED_SUCCESSFULLY);
EnterPositioningState();
}
}
void AuxiliaryController::sendCommandToRos(Ethprotocol::Cmd command){
void AuxiliaryController::sendCommandToRos(Ethprotocol::Cmd command) {
if (mRos_link_enabled == true) {
EthHandler::Dataframe tx_eth_msg;
tx_eth_msg.clearData();
......@@ -265,5 +221,3 @@ void AuxiliaryController::sendCommandToRos(Ethprotocol::Cmd command){
}
Subproject commit 6a312e36234cd99cd697ba6505c131b3e094e7ba
Subproject commit cad2db03b333e51e5566a78e4ca983e534b3d35b
......@@ -212,10 +212,10 @@ Error MecanumGUI::HandleRTOutput()
int32_t actual_wheel_fr, actual_wheel_fl, actual_wheel_rr, actual_wheel_rl;
char string[500]{0};
mMotor_front_left.getPdoHandle()->getVelocityActualValue(actual_wheel_fl);
mMotor_front_right.getPdoHandle()->getVelocityActualValue(actual_wheel_fr);
mMotor_rear_left.getPdoHandle()->getVelocityActualValue(actual_wheel_rl);
mMotor_rear_right.getPdoHandle()->getVelocityActualValue(actual_wheel_rr);
mMotor_front_left.GetPdoHandle()->getVelocityActualValue(actual_wheel_fl);
mMotor_front_right.GetPdoHandle()->getVelocityActualValue(actual_wheel_fr);
mMotor_rear_left.GetPdoHandle()->getVelocityActualValue(actual_wheel_rl);
mMotor_rear_right.GetPdoHandle()->getVelocityActualValue(actual_wheel_rr);
std::snprintf(string,500, "Actual vel: \nFL: %li \nFR: %li \nRL: %li \nRR: %li\n", actual_wheel_fl, actual_wheel_fr, actual_wheel_rl, actual_wheel_rr);
Graphics::SelectColor(COLOR_BLUE);
......@@ -444,10 +444,10 @@ Error DifferentialGUI::HandleRTOutput()
char string[500] {0};
mMotor_left.getPdoHandle()->getVelocityActualValue(actual_vel_wheel_left);
mMotor_right.getPdoHandle()->getVelocityActualValue(actual_vel_wheel_right);
mMotor_left.getPdoHandle()->getTargetVelocity(target_vel_wheel_left);
mMotor_right.getPdoHandle()->getTargetVelocity(target_vel_wheel_right);
mMotor_left.GetPdoHandle()->getVelocityActualValue(actual_vel_wheel_left);
mMotor_right.GetPdoHandle()->getVelocityActualValue(actual_vel_wheel_right);
mMotor_left.GetPdoHandle()->getTargetVelocity(target_vel_wheel_left);
mMotor_right.GetPdoHandle()->getTargetVelocity(target_vel_wheel_right);
std::snprintf(string, 500, "Actual \nvelocities: \nL: %li \nR: %li \nTarget \nvelocities: \nL: %li \nR: %li \nBattery \nV: %limV \nA: %limA \nCap: %imAh",
actual_vel_wheel_left, actual_vel_wheel_right, target_vel_wheel_left, target_vel_wheel_right, batteryVoltage_mV, batteryCurrent_mA, batteryRemCap_mAh);
......
......@@ -16,8 +16,7 @@ namespace {
const SdoHandler::NodeId node_id_Motor_2 = 0x2;
const SdoHandler::NodeId node_id_Motor_3 = 0x3;
const SdoHandler::NodeId node_id_Motor_4 = 0x4;
//const SdoHandler::Index idx_powerboard_connector_motor_1 = 0x6110;
const SdoHandler::Index idx_powerboard_connector_motor_1 = 0x6113; // TODO Workaround redirekt Output
const SdoHandler::Index idx_powerboard_connector_motor_1 = 0x6110;
const SdoHandler::Index idx_powerboard_connector_motor_2 = 0x6111;
const SdoHandler::Index idx_powerboard_connector_motor_3 = 0x6112;
const SdoHandler::Index idx_powerboard_connector_motor_4 = 0x6113;
......
This diff is collapsed.
......@@ -33,23 +33,23 @@ protected:
mMotorLeft(NodeIdLeftMotor, "MotorLeft", ORDINAL_IN_DATAGRAM_WD_MOTOR_LEFT),
mMotorRight(NodeIdRightMotor, "MotorRight", ORDINAL_IN_DATAGRAM_WD_MOTOR_RIGHT)
{
mMotorLeft.getPdoHandle()->status_word.updateMapping(0xA100, 1);
mMotorLeft.getPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 1);
mMotorLeft.getPdoHandle()->position_actual_value.updateMapping(0xA1C0, 1);
mMotorLeft.getPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 2);
mMotorLeft.getPdoHandle()->control_word.updateMapping(0xA580, 1);
mMotorLeft.getPdoHandle()->mode_of_operation.updateMapping(0xA480, 1);
mMotorLeft.getPdoHandle()->target_position.updateMapping(0xA640, 1);
mMotorLeft.getPdoHandle()->target_velocity.updateMapping(0xA640, 2);
mMotorLeft.GetPdoHandle()->status_word.updateMapping(0xA100, 1);
mMotorLeft.GetPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 1);
mMotorLeft.GetPdoHandle()->position_actual_value.updateMapping(0xA1C0, 1);
mMotorLeft.GetPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 2);
mMotorLeft.GetPdoHandle()->control_word.updateMapping(0xA580, 1);
mMotorLeft.GetPdoHandle()->mode_of_operation.updateMapping(0xA480, 1);
mMotorLeft.GetPdoHandle()->target_position.updateMapping(0xA640, 1);
mMotorLeft.GetPdoHandle()->target_velocity.updateMapping(0xA640, 2);
mMotorRight.getPdoHandle()->status_word.updateMapping(0xA100, 2);
mMotorRight.getPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 2);
mMotorRight.getPdoHandle()->position_actual_value.updateMapping(0xA1C0, 3);
mMotorRight.getPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 4);
mMotorRight.getPdoHandle()->control_word.updateMapping(0xA580, 2);
mMotorRight.getPdoHandle()->mode_of_operation.updateMapping(0xA480, 2);
mMotorRight.getPdoHandle()->target_position.updateMapping(0xA640, 3);
mMotorRight.getPdoHandle()->target_velocity.updateMapping(0xA640, 4);
mMotorRight.GetPdoHandle()->status_word.updateMapping(0xA100, 2);
mMotorRight.GetPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 2);
mMotorRight.GetPdoHandle()->position_actual_value.updateMapping(0xA1C0, 3);
mMotorRight.GetPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 4);
mMotorRight.GetPdoHandle()->control_word.updateMapping(0xA580, 2);
mMotorRight.GetPdoHandle()->mode_of_operation.updateMapping(0xA480, 2);
mMotorRight.GetPdoHandle()->target_position.updateMapping(0xA640, 3);
mMotorRight.GetPdoHandle()->target_velocity.updateMapping(0xA640, 4);
AddMotor(&mMotorLeft);
AddMotor(&mMotorRight);
......@@ -70,14 +70,14 @@ protected:
MotorManagerAux() :
mMotorAuxiliaryOne(NodeIdAuxiliaryMotorOne, "MotorAuxiliaryOne", ORDINAL_IN_DATAGRAM_AUX_MOTOR)
{
mMotorAuxiliaryOne.getPdoHandle()->status_word.updateMapping(0xA100, 3);
mMotorAuxiliaryOne.getPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 3);
mMotorAuxiliaryOne.getPdoHandle()->position_actual_value.updateMapping(0xA1C0, 5);
mMotorAuxiliaryOne.getPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 6);
mMotorAuxiliaryOne.getPdoHandle()->control_word.updateMapping(0xA580, 3);
mMotorAuxiliaryOne.getPdoHandle()->mode_of_operation.updateMapping(0xA480, 3);
mMotorAuxiliaryOne.getPdoHandle()->target_position.updateMapping(0xA640, 5);
mMotorAuxiliaryOne.getPdoHandle()->target_velocity.updateMapping(0xA640, 6);
mMotorAuxiliaryOne.GetPdoHandle()->status_word.updateMapping(0xA100, 3);
mMotorAuxiliaryOne.GetPdoHandle()->mode_of_operation_display.updateMapping(0xA000, 3);
mMotorAuxiliaryOne.GetPdoHandle()->position_actual_value.updateMapping(0xA1C0, 5);
mMotorAuxiliaryOne.GetPdoHandle()->velocity_actual_value.updateMapping(0xA1C0, 6);
mMotorAuxiliaryOne.GetPdoHandle()->control_word.updateMapping(0xA580, 3);
mMotorAuxiliaryOne.GetPdoHandle()->mode_of_operation.updateMapping(0xA480, 3);
mMotorAuxiliaryOne.GetPdoHandle()->target_position.updateMapping(0xA640, 5);
mMotorAuxiliaryOne.GetPdoHandle()->target_velocity.updateMapping(0xA640, 6);
AddMotor(&mMotorAuxiliaryOne);
}
......
......@@ -57,16 +57,17 @@ class ProfilePositionMode {
public:
ProfilePositionMode(Motor *motor);
~ProfilePositionMode();
void PreparePositioning();
void PerformCyclicDuties();
void SetStartTravelCommand();
void ResetStartTravelCommand();
void ConfigureAbsolutePositionMode();
void ConfigureRelativePositionMode();
void ConfigureImmidiateAdaptionOfNewMoveOrders();
void ConfigureFinishMoveOrdersBeforeNewMoveOrders();
void SetTargetPosition(
EMROSCmdType::AuxiliaryController::TargetPositionsInterface* targetPositions);
void GetActualPosition(
EMROSCmdType::AuxiliaryController::ActualPositionsInterface* actualPositions);
void SetTargetPosition(const EthHandler::Dataframe& rx_dataframe);
Error GetActualPosition(EthHandler::Dataframe& tx_dataframe);
void SetHalt();
void ResetHalt();
bool IsSetPointAcknoledged();
......@@ -74,6 +75,11 @@ public:
private:
void SetControlwordBit(uint8_t bit_position);
void ResetControlwordBit(uint8_t bit_position);
Error CopyTargetPositionFromDataFrame(
const EthHandler::Dataframe& dataframe);
Motor* mMotor;
EMROSCmdType::AuxiliaryController::TargetPositionsInterface* mTargetPositions;
EMROSCmdType::AuxiliaryController::ActualPositionsInterface* mActualPositions;
};
......@@ -183,11 +183,11 @@ Error HomingMode::PerformIdleStateState() {
}
void HomingMode::SetControlwordBit(uint8_t bit_position) {
ControlWorldHelper::SetBit(bit_position, mMotor->getPdoHandle());
ControlWorldHelper::SetBit(bit_position, mMotor->GetPdoHandle());
}
void HomingMode::ResetControlwordBit(uint8_t bit_position) {
ControlWorldHelper::ResetBit(bit_position, mMotor->getPdoHandle());
ControlWorldHelper::ResetBit(bit_position, mMotor->GetPdoHandle());
}
void HomingMode::SetStartTravelCommand() {
......@@ -202,7 +202,7 @@ void HomingMode::ResetStartTravelCommand() {
statusword::type HomingMode::GetMaskedStatusword() {
statusword::type value = 0;
mMotor->getPdoHandle()->getStatusWord(value);
mMotor->GetPdoHandle()->getStatusWord(value);
return value & homing_mode::statusword_specific::mask::homing_general;
}
......
This diff is collapsed.
#include "../inc/profile_position_mode.h"
#include "../inc/controlword_helper.h"
#include "../../system/inc/factories.h"
ProfilePositionMode::ProfilePositionMode(Motor *motor) :
mMotor(motor), mTargetPositions(
InstanceFactory::instance()->GetTargetPositionsInstance()), mActualPositions(
InstanceFactory::instance()->GetActualPositionsInstance()) {
}
ProfilePositionMode::ProfilePositionMode(Motor *motor):
mMotor(motor)
{
ProfilePositionMode::~ProfilePositionMode() {
delete &mTargetPositions;
delete &mActualPositions;
}
void ProfilePositionMode::PreparePositioning() {
ResetStartTravelCommand();
mMotor->SetTargetModeOfOperation(
modes_of_operation_specific::code::ProfilePosition);
ConfigureAbsolutePositionMode();
ConfigureImmidiateAdaptionOfNewMoveOrders();
mMotor->SetApplicationConfigFinished();
}
void ProfilePositionMode::SetStartTravelCommand()
{
SetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::start_travel));
void ProfilePositionMode::PerformCyclicDuties() {
if (IsSetPointAcknoledged()) {
ResetStartTravelCommand();
}
}
void ProfilePositionMode::ResetStartTravelCommand()
{
ResetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::start_travel));
void ProfilePositionMode::SetStartTravelCommand() {
SetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::start_travel));
}
void ProfilePositionMode::ResetStartTravelCommand() {
ResetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::start_travel));
}
void ProfilePositionMode::ConfigureAbsolutePositionMode()
{
ResetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::position_mode));
void ProfilePositionMode::ConfigureAbsolutePositionMode() {
ResetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::position_mode));
}
void ProfilePositionMode::ConfigureRelativePositionMode()
{
SetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::position_mode));
void ProfilePositionMode::ConfigureRelativePositionMode() {
SetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::position_mode));
}
void ProfilePositionMode::ConfigureImmidiateAdaptionOfNewMoveOrders()
{
SetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::execute_immediately));
void ProfilePositionMode::ConfigureImmidiateAdaptionOfNewMoveOrders() {
SetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::execute_immediately));
}
void ProfilePositionMode::ConfigureFinishMoveOrdersBeforeNewMoveOrders()
{
ResetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::execute_immediately));
ResetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::change_on_setpoint));
void ProfilePositionMode::ConfigureFinishMoveOrdersBeforeNewMoveOrders() {
ResetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::execute_immediately));
ResetControlwordBit(
uint8_t(
profile_position_mode::controlword_specific::bit::change_on_setpoint));
}
void ProfilePositionMode::SetTargetPosition(EMROSCmdType::AuxiliaryController::TargetPositionsInterface* targetPositions)
{
mMotor->getPdoHandle()->setTargetPosition(
targetPositions->dataByType()[mMotor->ordinal_in_datagram]);
void ProfilePositionMode::SetTargetPosition(
const EthHandler::Dataframe& dataframe) {
CopyTargetPositionFromDataFrame(dataframe);
mMotor->GetPdoHandle()->setTargetPosition(
mTargetPositions->dataByType()[mMotor->ordinal_in_datagram]);
}
void ProfilePositionMode::GetActualPosition(EMROSCmdType::AuxiliaryController::ActualPositionsInterface* actualPositions)
{
mMotor->getPdoHandle()->getPositionActualValue(
actualPositions->dataByType()[mMotor->ordinal_in_datagram]);
Error ProfilePositionMode::GetActualPosition(
EthHandler::Dataframe& tx_dataframe) {
}
mMotor->GetPdoHandle()->getPositionActualValue(
mActualPositions->dataByType()[mMotor->ordinal_in_datagram]);
void ProfilePositionMode::SetHalt()
{
SetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::halt));
}
Error status { Error::NO_ERROR };
status = mActualPositions->get(tx_dataframe.setData().payload.begin(),
Ethprotocol::MAX_PAYLOAD_LENGTH);
if (status == Error::NO_ERROR) {
tx_dataframe.setData().payload_length = Ethprotocol::PayLen(
mActualPositions->getRawSize());
}
return status;
void ProfilePositionMode::ResetHalt()
{
ResetControlwordBit(uint8_t(profile_position_mode::controlword_specific::bit::halt));
}
void ProfilePositionMode::SetControlwordBit(uint8_t bit_position)
{
ControlWorldHelper::SetBit(bit_position,mMotor->getPdoHandle());
void ProfilePositionMode::SetHalt() {
SetControlwordBit(
uint8_t(profile_position_mode::controlword_specific::bit::halt));
}
void ProfilePositionMode::ResetControlwordBit(uint8_t bit_position)
{
ControlWorldHelper::ResetBit(bit_position,mMotor->getPdoHandle());
void ProfilePositionMode::ResetHalt() {
ResetControlwordBit(
uint8_t(profile_position_mode::controlword_specific::bit::halt));
}
bool ProfilePositionMode::IsSetPointAcknoledged(){
bool ProfilePositionMode::IsSetPointAcknoledged() {
statusword::type value = 0;
mMotor->getPdoHandle()->getStatusWord(value);
mMotor->GetPdoHandle()->getStatusWord(value);
namespace ns_alias = profile_position_mode::statusword_specific;
value &= ns_alias::mask::setpoint_acknoledge;
return (value == ns_alias::code::setpoint_is_acknoledged);
}
void ProfilePositionMode::SetControlwordBit(uint8_t bit_position) {
ControlWorldHelper::SetBit(bit_position, mMotor->GetPdoHandle());
}
void ProfilePositionMode::ResetControlwordBit(uint8_t bit_position) {
ControlWorldHelper::ResetBit(bit_position, mMotor->GetPdoHandle());
}
Error ProfilePositionMode::CopyTargetPositionFromDataFrame(
const EthHandler::Dataframe& dataframe) {
Error status { Error::NO_ERROR };
status = mTargetPositions->set(dataframe.getData().payload.begin(),
dataframe.getData().payload_length);
if (status == Error::ERROR) {
OFCLoggerRTClient::instance()->InsertError(__PRETTY_FUNCTION__,
"wrong data size for target positions)");
}
return (status);
}