Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CSP support #32

Merged
merged 20 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e5c2a5f
CSP: WIP
anderssandstrom Oct 28, 2020
fc2bfe2
CSP: Add setPos to drv. disable controller in csp. WIP.
anderssandstrom Oct 28, 2020
11250e1
CSP: Correct typo in ecmcAxisReal
anderssandstrom Oct 28, 2020
f1a8f09
ecmcEntryLink: Add function to check if index is linked. DriveBase: I…
anderssandstrom Oct 28, 2020
5825d6a
Add possability to check slave number of linked entry.
anderssandstrom Oct 28, 2020
f678e9a
entryLink: Use checkEntryExist() instead of isEntryNull().
anderssandstrom Oct 29, 2020
1c3f274
CSP: WIP
anderssandstrom Oct 29, 2020
086d49a
CSP: Issue with start position. Works if start from 0 but not otherwi…
anderssandstrom Oct 29, 2020
6e23170
CSP: Add some debug printouts. WIP
anderssandstrom Oct 29, 2020
b1bb7e6
CSP: Add drv in seq. WIP
anderssandstrom Nov 3, 2020
bb6e738
CSP: refine printouts
anderssandstrom Nov 3, 2020
7db40f6
CSP: Remove printouts
anderssandstrom Nov 4, 2020
99204dc
Diag. Str: updated calc for position error and disatance to target (w…
anderssandstrom Nov 4, 2020
7d482b6
CSP: Add warning if CSP-mode and any ecmc position control params are…
anderssandstrom Nov 4, 2020
aca5408
DS402: Change timout to seconds instead of cycles. Default 15s.
anderssandstrom Nov 4, 2020
257d138
CSP: Sequencer set current pos.
anderssandstrom Nov 4, 2020
be677b5
Update RELEASE.md
anderssandstrom Nov 5, 2020
d38c4cb
CSP: Avoid jump at homing by setting the data_ struct actpos and traj…
anderssandstrom Nov 5, 2020
24092ae
Merge pull request #38 from anderssandstrom/csp
anderssandstrom Nov 5, 2020
9d75391
Merge pull request #39 from icshwi/csp
anderssandstrom Nov 5, 2020
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
Next Next commit
CSP: WIP
  • Loading branch information
anderssandstrom committed Oct 28, 2020
commit e5c2a5f948669308acd803a5c5ad0fa36763f635
8 changes: 8 additions & 0 deletions devEcmcSup/com/ecmcAsynPortDriverUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ int getAxDriveFuncType(char *objPath,
*objectFunction = ECMC_DRIVEBASE_ENTRY_INDEX_REDUCE_TORQUE_OUTPUT;
return 0;
}

// Position
nvals = strcmp(objectFunctionStr,ECMC_DRV_POSITION_STR);

if (nvals == 0) {
*objectFunction = ECMC_DRIVEBASE_ENTRY_INDEX_POSITION_SETPOINT;
return 0;
}
}
}
return ERROR_MAIN_ECMC_COMMAND_FORMAT_ERROR;
Expand Down
7 changes: 7 additions & 0 deletions devEcmcSup/main/ecmcDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#define ECMC_DRIVEBASE_ENTRY_INDEX_STATUS_WORD 2
#define ECMC_DRIVEBASE_ENTRY_INDEX_BRAKE_OUTPUT 3
#define ECMC_DRIVEBASE_ENTRY_INDEX_REDUCE_TORQUE_OUTPUT 4
#define ECMC_DRIVEBASE_ENTRY_INDEX_POSITION_SETPOINT 5

// Encoder drive entries
#define ECMC_ENCODER_ENTRY_INDEX_ACTUAL_POSITION 0
Expand Down Expand Up @@ -243,6 +244,11 @@ enum stopMode {
ECMC_STOP_MODE_RUN = 2,
};

enum driveMode {
ECMC_DRV_MODE_CSV = 0,
ECMC_DRV_MODE_CSP = 1,
};

enum interlockTypes {
ECMC_INTERLOCK_NONE = 0,
ECMC_INTERLOCK_SOFT_BWD = 1,
Expand Down Expand Up @@ -356,6 +362,7 @@ enum axisSubObjectType {
#define ECMC_DRV_STR "drv"
#define ECMC_DRV_ENABLE_STR "control"
#define ECMC_DRV_VELOCITY_STR "velocity"
#define ECMC_DRV_POSITION_STR "position"
#define ECMC_DRV_ENABLED_STR "status"
#define ECMC_DRV_BREAK_STR "brake"
#define ECMC_DRV_REDUCETORQUE_STR "reducetorque"
Expand Down
6 changes: 4 additions & 2 deletions devEcmcSup/motion/ecmcAxisData.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ typedef struct {
bool enableSoftLimitFwd : 1;
dataSource trajSource;
dataSource encSource;
operationMode operationModeCmd;
operationMode operationModeCmd;
driveMode drvMode;
} ecmcAxisDataCommand;

typedef struct {
Expand All @@ -49,7 +50,8 @@ typedef struct {
double currentPositionSetpointOld;
double currentVelocityActual;
double currentVelocitySetpoint;
int currentVelocitySetpointRaw;
int64_t currentVelocitySetpointRaw;
int64_t currentPositionSetpointRaw;
double currentvelocityFFRaw;
double cntrlError;
double cntrlOutput;
Expand Down
38 changes: 31 additions & 7 deletions devEcmcSup/motion/ecmcDriveBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,24 @@ void ecmcDriveBase::writeEntries() {
setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
}

errorCode =
writeEcEntryValue(ECMC_DRIVEBASE_ENTRY_INDEX_VELOCITY_SETPOINT,
if(data_->command_.drvMode == ECMC_DRV_MODE_CSV) {
errorCode =
writeEcEntryValue(ECMC_DRIVEBASE_ENTRY_INDEX_VELOCITY_SETPOINT,
(uint64_t)data_->status_.currentVelocitySetpointRaw);

if (errorCode) {
setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
if (errorCode) {
setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
}
}
else {
// CSP
errorCode =
writeEcEntryValue(ECMC_DRIVEBASE_ENTRY_INDEX_POSITION_SETPOINT,
(uint64_t)data_->status_.currentPositionSetpointRaw);

if (errorCode) {
setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
}
}

if (enableBrake_) {
Expand Down Expand Up @@ -260,10 +272,21 @@ int ecmcDriveBase::validate() {

// Velocity Setpoint entry output
errorCode = validateEntry(ECMC_DRIVEBASE_ENTRY_INDEX_VELOCITY_SETPOINT);
if (errorCode) {
return setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
if (errorCode) {
// Position Setpoint entry output
errorCode = validateEntry(ECMC_DRIVEBASE_ENTRY_INDEX_POSITION_SETPOINT);
if (errorCode) {
return setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
}
else {
return setErrorID(__FILE__, __FUNCTION__, __LINE__, errorCode);
}
data_->command_.drvMode = ECMC_DRV_MODE_CSP;
}
else {
data_->command_.drvMode = ECMC_DRV_MODE_CSV;
}

// Enabled entry input OR statusword
errorCode = validateEntry(ECMC_DRIVEBASE_ENTRY_INDEX_STATUS_WORD);

Expand All @@ -289,6 +312,7 @@ int ecmcDriveBase::validate() {
}
}


if (scaleDenom_ == 0) {
return setErrorID(__FILE__,
__FUNCTION__,
Expand Down