Create your own Lab Activity

Lablet offers a very powerful facility to create highly customised lab activities for laboratory classes. A lab activity can be build by connecting various activity sheets. There is, for example, a general purpose sheet which can be used for most parts of the lab activity. This sheet has quite a powerful layout facility and can be used to place text, question, check boxes and other lab activity components. Other sheets are, for example,  an video analysis sheet or a sheet to calculate the velocity and the acceleration of a moving object.

Summery of lab activity sheets and components:

  • Question Sheet: The question sheet is a general purpose sheet that can hold various child components:
    • Header: A header component to structure the sheet.
    • Check box: A check box that needs to be ticked to proceed.
    • Text question: A text question that requires at least one character input to proceed.
    • Question to estimate the potential energy: This component asked to specify the weight and the height of the thrown ball. From these values the potential energy and how many throws one can perform with that amount of energy has to be calculated.
    • Take video view: A view that asked to start a camera experiment. It’s also possible to redo an experiment from here.
    • Graph view: Displays a graph from taken experiment data. The shown axes are configurable.
  • Analyse video sheet: From this sheet, a video analysis can be started. At the first launch of the analysis, students end up on the help screen of the video settings screen. This is to encourage the students to first set the correct start and end points of the video. It’s possible to go back too this sheet later on and update or redo the video analysis.
  • Velocity and acceleration sheet: On this sheet, you are asked to calculate the velocity and acceleration for three successive data points. Furthermore, you have to select the correct units from a drop down menu. Once a column is filled correctly, this is visualised with a green tick mark and an automatically filled results table.

 

Add a New Lab Activity

In order to add a new lab activity a new script file with the ending “.lua” has to be put into the directory:
Android/data/nz.ac.aucklanduni.physics.lablet/files/scripts
on the tablet. Note that this path may vary depending on the device. When going back to the main lab activity screen, the new lab activity shows up in the upper list.

The structure of a lab activity script is quite simple. There is a header with meta information of the script and one main function that is called by Lablet when loading the lab activity script:

Lablet = {
    interface = 1.0,
    title = "Title of the Activity"
}

function Lablet.buildActivity(builder) {

}

This function can be used to set up the lab activity using the provided script builder. The following code sets up a lab activity with five sheets:

Lablet = {
    interface = 1.0,
    title = "Activity with five sheets"
}

function Lablet.buildActivity(scriptBuilder) {
	-- add a introduction sheet
	local intro = scriptBuilder:create("Sheet")
	scriptBuilder:add(intro)
	intro:setTitle("Stage 1 Physics Laboratory")
	intro:addHeader("Lab equipment:")
	intro:addText("Have you got the lab equipment? Check the following:")
	intro:addCheckQuestion("a metre rule for setting the length scale in the video")
	intro:addCheckQuestion("a ball")

	-- add a sheet with three camera experiment component in a horizontal layout
	local takeVideosSheet = scriptBuilder:create("Sheet")
	scriptBuilder:add(takeVideosSheet)
	takeVideosSheet:setMainLayoutOrientation("horizontal")
	takeVideosSheet:setTitle("Take Videos:")
	cameraExperimentItem = takeVideosSheet:addCameraExperiment();
	cameraExperimentItem:setDescriptionText("Please take a free fall video:")
	local experimentFreeFall = cameraExperimentItem:getExperiment()
	cameraExperimentItem2 = takeVideosSheet:addCameraExperiment();
	cameraExperimentItem2:setDescriptionText("Please take a up down video:")
	local experimentUpDown = cameraExperimentItem2:getExperiment()
	cameraExperimentItem3 = takeVideosSheet:addCameraExperiment()
	cameraExperimentItem3:setDescriptionText("Please take a projectile video:")
	local experimentProjectile = cameraExperimentItem3:getExperiment()

	-- analysis free fall
	local experimentAnalysisFreeFall = scriptBuilder:create("MotionAnalysis")
	scriptBuilder:add(experimentAnalysisFreeFall)
	experimentAnalysisFreeFall:setTitle("Mark Data Points")
	experimentAnalysisFreeFall:setExperiment(experimentFreeFall)
	experimentAnalysisFreeFall:setDescriptionText("Please analyse the free fall video:")

	-- analysis up down
	local experimentAnalysisUpDown = scriptBuilder:create("MotionAnalysis")
	scriptBuilder:add(experimentAnalysisUpDown)
	experimentAnalysisUpDown:setTitle("Mark Data Points")
	experimentAnalysisUpDown:setExperiment(experimentUpDown)
	experimentAnalysisUpDown:setDescriptionText("Please analyse the up down video:")

	-- analysis projectile
	local experimentAnalysisProjectile = scriptBuilder:create("MotionAnalysis")
	scriptBuilder:add(experimentAnalysisProjectile)
	experimentAnalysisProjectile:setTitle("Mark Data Points")
	experimentAnalysisProjectile:setExperiment(experimentProjectile)
	experimentAnalysisProjectile:setDescriptionText("Please analyse the projectile video:")
}

The first sheet has a vertical layout and contains a header component, a description text component and two check box components. The second sheet has a horizontal layout and contains three camera experiment components. By calling getExperiment() on the camera experiment component you can get a reference to that experiment. In the following three sheets the respective experiment reference is then passed on to an “ExperimentAnalysis” sheet.

Group Layout Example

The following example shows an example of how to set up a sheet with a more complicated layout. Lablet’s general purpose lab activity sheets “Sheet” supports a group layout containers, i.e. a component can be put into a horizontal or vertical layout. Furthermore, these group layout containers can be nested. Once you created a group layout container, you can add a new component to this container by providing the container as an additional argument for the add function. For example:

Lablet = {
    interface = 1.0,
    title = "Layout Demo"
}

function Lablet.buildActivity(scriptBuilder) {
	local sheet = scriptBuilder:create("Sheet")
	scriptBuilder:add(sheet)
	sheet:setTitle("Group Layout Demo")
	sheet:addQuestion("header line")

	-- start a new horizontal layout
	local horizontalLayout = sheet:addHorizontalGroupLayout()
	sheet:addText("left", horizontalLayout)

	-- add a vertical layout into the horizontal layout
	local verticalLayout = sheet:addVerticalGroupLayout(horizontalLayout)
	sheet:addQuestion("top", verticalLayout)
	sheet:addQuestion("bottom", verticalLayout)

	sheet:addText("right", horizontalLayout)

	sheet:addCheckQuestion("check box")
	sheet:addQuestion("footer line")
}

This code gives the following layout:

Complex layouts in a lab activity.

Complex layouts in a lab activity.

Other examples

For more complex examples look at the existing lab activities in the source code:
Lab activity scripts

Leave a Reply

Your email address will not be published. Required fields are marked *