Skip to content

Commit

Permalink
Introduce Ros_mpCtrlGrpNo2GrpId(..)
Browse files Browse the repository at this point in the history
A platform-specific mpCtrlGrpNo2GrpId(..) wrapper.
  • Loading branch information
gavanderhoorn committed Jun 8, 2023
1 parent 980f7d9 commit 06e7eb2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/CtrlGroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,34 @@ void Ros_CtrlGrp_Cleanup(CtrlGroup* ctrlGroup)
mpSemDelete(ctrlGroup->inc_q.q_lock);
}


//-------------------------------------------------------------------
// Search through the control group to find the GroupId that matches
// the group number
//-------------------------------------------------------------------
MP_GRP_ID_TYPE Ros_mpCtrlGrpNo2GrpId(int groupNo)
{
#if defined (YRC1000) || defined (YRC1000u)
return mpCtrlGrpNo2GrpId(groupNo);

#elif defined (FS100) || defined (DX200)
MP_GRP_ID_TYPE grp_id;

for(grp_id = MP_R1_GID; grp_id < MP_S24_GID; ++grp_id)
{
if(groupNo == mpCtrlGrpId2GrpNo(grp_id))
return grp_id;
}

return -1;

#else
#error "Ros_mpCtrlGrpNo2GrpId: unsupported platform"

#endif
}


//-------------------------------------------------------------------
// Get the commanded pulse position in pulse (in motoman joint order)
// Used for MOTION SERVER connection for positional planning calculations.
Expand Down
2 changes: 2 additions & 0 deletions src/CtrlGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ typedef struct
extern CtrlGroup* Ros_CtrlGroup_Create(int groupNo, BOOL bIsLastGrpToInit, float interpolPeriod);
extern void Ros_CtrlGrp_Cleanup(CtrlGroup* ctrlGroup);

extern MP_GRP_ID_TYPE Ros_mpCtrlGrpNo2GrpId(int groupNo);

extern BOOL Ros_CtrlGroup_GetPulsePosCmd(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
extern BOOL Ros_CtrlGroup_GetFBPulsePos(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
extern BOOL Ros_CtrlGroup_GetFBServoSpeed(CtrlGroup* ctrlGroup, long pulseSpeed[MAX_PULSE_AXES]);
Expand Down
2 changes: 2 additions & 0 deletions src/MotoPlusExterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ extern int mpNICData(USHORT if_no, ULONG* ip_addr, ULONG* subnet_mask, UCHAR* ma

extern size_t mpNumBytesFree(void);

#if defined (YRC1000) || defined (YRC1000u)
extern MP_GRP_ID_TYPE mpCtrlGrpNo2GrpId(int grp_no);
#endif

#endif // MOTOROS2_MOTOPLUS_EXTERNS_H

0 comments on commit 06e7eb2

Please sign in to comment.