Parallel RtActivities

ParallelRtActivities represent a bunch of RtActivities that are started in parallel in the same real-time context. A ParallelRtActivity makes it possible to actuate two or more devices/robots at once, since every child Activity of a ParallelActivity is auto-started at the same time. This way, an arm can move in a desired position while driving a platform on which the arm is mounted.


A Parallel Activity


PIC

 
  // Example Code 
 
    // We will use the class "ParallelRtActivity" 
    // to actuate the YouBotArm and the YouBotPlatform at the same time 
    // The result will be that the YouBot will drive forward 
    // while bending joint number 2. (We start counting joints with 0) 
 
 
    // Start by linking the devices to an interface 
    // please note that if you want to drive around the platform 
    // you will need to select the Platforminterface 
 
    PlatformInterface platformmover = platform.use(PlatformInterface.class); 
    PtpInterface moveArm = arm.use(PtpInterface.class); 
 
    // Setting the goals 
    final double[] joint2 = { 0, 0, 1.5, 0, 0 }; 
    Frame platfgoal = platform.getBase().plus(0.3, 0, 0); 
    Frame fixedPlatfGoal = platfgoal.snapshot(World.getOrigin()); 
 
    // Create a new Object "ParallelRtActivity" 
    // and start using it like an ArrayList 
    // every activity you add will be executed simultaneously with 
    // every other motion 
    ParallelRtActivity test1 = new ParallelRtActivity(); 
    test1.addActivity(platformmover.driveTo(fixedPlatfGoal)); 
    test1.addActivity(moveArm.ptp(joint2)); 
    test1.execute(); 
    } 



While very versatile in use, the following points should be kept in mind when operating with ParallelRtActivities:

1. Contradicted movements within the same device/robot are not allowed and will lead the program to fail.
Example: If two Activities affect the same Actuator (e.g. Joint) and both Activities need to move the Actuator in opposite directions, the program will abort the entire ParallelActivity since such an action cannot be computed.

2. A ParallelRtActivity just STARTS every committed Activity at the same time, meaning that every individual activity will finish at it’s own pace unless parameterized accordingly.

3. A ParallelRtActivity is considered completed when all of its committed Activities did execute and finished moving without fail.

4. If a preceding Activity ended in a ”‘Maintain”’ State, then the sum of the devices controlled by the child-activities need to uphold that state too.

5. Likewise, if one of the child-Activities enters a ”‘Maintain”’-state, the entire ParallelActivity will change to this after every child-Activity is finished and the subsequent Activity must be capable of upholding this state.

6. The ParallelActivity can only be taken over by a subsequent Activity if EVERY child has finished moving or allow takeover themselves.

7. Likewise, a preceded Activity can only be taken over if the child Activities (in sum) are able to take over the Activity



How to create Summary




ParallelRtActivity(RtActivity... activities) returns a ParallelRtActivity


ParallelRtActivity(String name, RtActivity... activities) returns a ParallelRtActivity with a given name


Alternative: Invoke RtActivities.parallel(activities) Returns an instantly created and anonymous ParallelRtActivity




Methods Summary




addActivity(T activity);-adds an activity into the ParallelRtActivity


getActivites(); -returns a List of all committed activities