
(* 2x1 flyways 2 xbots - delete group, get group status, get macro status *)
FUNCTION_BLOCK Example09_groupstatus
	(*create group 1 from xbot 1 and 2*)
	xbotID_array32[0] := 1;xbotID_array32[1] := 2;
	PMC_CreateXbotGroup1(PM_Controller := PM_Controller,Execute := Execute,GroupID := 1,nXbots := 2,XbotID := xbotID_array32);

	(*get status of group 1*)
	PMC_GetGroupStatus1(PM_Controller := PM_Controller,Execute := PMC_CreateXbotGroup1.Done,GroupID := 1);
	group_state1 := PMC_GetGroupStatus1.State;
	nxbots1 := PMC_GetGroupStatus1.nXbots;
	return_xbotID_array1 := PMC_GetGroupStatus1.XbotID;

	(*bond group 1*)
	PMC_BondXbotGroup1(PM_Controller := PM_Controller,Execute := PMC_GetGroupStatus1.Done,GroupID := 1,IsBond := TRUE,Mode := 0);

	(*get status of group 1*)
	PMC_GetGroupStatus2(PM_Controller := PM_Controller,Execute := PMC_BondXbotGroup1.Done,GroupID := 1);
	group_state2 := PMC_GetGroupStatus2.State;
	nxbots2 := PMC_GetGroupStatus2.nXbots;
	return_xbotID_array2 := PMC_GetGroupStatus2.XbotID;

	(*delete group 1*)
	PMC_DeleteXbotGroup1(PM_Controller := PM_Controller,Execute := PMC_GetGroupStatus2.Done,GroupID := 1);

	(*get status of group 1*)
	PMC_GetGroupStatus3(PM_Controller := PM_Controller,Execute := PMC_DeleteXbotGroup1.Done,GroupID := 1);
	group_state3 := PMC_GetGroupStatus3.State;
	nxbots3 := PMC_GetGroupStatus3.nXbots;
	return_xbotID_array3 := PMC_GetGroupStatus3.XbotID;

	(*clear macro 128*)
	PMC_ClearMacro1(PM_Controller := PM_Controller,Execute := PMC_GetGroupStatus3.Done,MacroID := 128);

	(*get status of macro 128*)
	PMC_GetMacroStatus1(PM_Controller := PM_Controller,Execute := PMC_ClearMacro1.Done,MacroID := 128);
	macro_state1 := PMC_GetMacroStatus1.State;
	nCmds1 := PMC_GetMacroStatus1.nCmds;

	(*add command to macro 128*)
	PMC_XYMotion1(PM_Controller := PM_Controller,Execute := PMC_GetMacroStatus1.Done,cmdLB := 9,XbotID := 128,Mode := 0,Type_ := 0,PosX := 0.9,PosY := 0.06,EndVel := 0,MaxVel := 1,MaxAcc := 10);

	(*add command to macro 128*)
	PMC_XYMotion2(PM_Controller := PM_Controller,Execute := PMC_XYMotion1.Done,cmdLB := 10,XbotID := 128,Mode := 0,Type_ := 0,PosX := 0.06,PosY := 0.06,EndVel := 0,MaxVel := 1,MaxAcc := 10);

	(*save macro 128*)
	PMC_SaveMacro1(PM_Controller := PM_Controller,Execute := PMC_XYMotion2.Done,MacroID := 128);

	(*get status of macro 128*)
	PMC_GetMacroStatus2(PM_Controller := PM_Controller,Execute := PMC_SaveMacro1.Done,MacroID := 128);
	macro_state2 := PMC_GetMacroStatus2.State;
	nCmds2 := PMC_GetMacroStatus2.nCmds;

	Done := PMC_GetMacroStatus2.Done;
END_FUNCTION_BLOCK
