Tutorial: Making Things Move "Pendulum.any"

Hi, I am new to AnyBody and I am currently testing the software with the one month trial (5 days left) on behalf of the University of Central Lancashire.

Slowly working my way through the tutorials and I am having problems with Lesson 1 - making things move with a pendulum.

I have followed the instructions at url http://www.anybodytech.com/fileadmin/AnyBody/Docs/Tutorials/Making_things_move/lesson1.html

Here is my code

[SIZE=3]// Model for the “Making Things Move” tutorial.
[/SIZE]Main = {

[SIZE=3]// The actual body model goes in this folder
[/SIZE][SIZE=3]AnyFolder[/SIZE] MyModel = {

[SIZE=3]// Global Reference Frame
[/SIZE][SIZE=3]AnyFixedRefFrame[/SIZE] GlobalRef = {
}; [SIZE=3]// Global reference frame
[/SIZE]
[SIZE=3]AnySeg[/SIZE] Pendulum = {
Mass = 1;
Jii = {1, 0.01, 1}/15;
[SIZE=3]AnyRefNode[/SIZE] Origin = {
sRel = {0, 0.5, 0};
};
[SIZE=3]AnyRefNode[/SIZE] P1 = {
sRel = {0, -0.5, 0};
};
[SIZE=3]AnyDrawSeg[/SIZE] drw = {};
};
[SIZE=3]AnyKinMotion[/SIZE] JointDriver =
[SIZE=3]AnyRevoluteJoint[/SIZE] &Jnt = .Joint;
[SIZE=3]AnyFunPolynomial[/SIZE] DriverFun = {
PolyCoef = {{0, 3, 5}};
};
{
[SIZE=3]//MeasureOrganizer = {};
[/SIZE][SIZE=3]//CType = ;
[/SIZE][SIZE=3]//WeightFun = {};
[/SIZE][SIZE=3]//DriverPos0 = {};
[/SIZE][SIZE=3]//DriverVel0 = {};
[/SIZE][SIZE=3]//DriverAcc0 = {};
[/SIZE][SIZE=3]//AnyKinMeasure &<Insert name0> = <Insert object reference (or full object definition)>; You can make any number of these objects!
[/SIZE][SIZE=3]//AnyParamFun &<Insert name0> = <Insert object reference (or full object definition)>; You can make any number of these objects!
[/SIZE]};
[SIZE=3]AnyRevoluteJoint[/SIZE] Joint = {
[SIZE=3]AnyRefFrame[/SIZE] &Ground = .GlobalRef;
[SIZE=3]AnyRefFrame[/SIZE] &Pendulum = .Pendulum.Origin;
};

}; [SIZE=3]// MyModel
[/SIZE]
[SIZE=3]// The study: Operations to be performed on the model
[/SIZE][SIZE=3]AnyBodyStudy[/SIZE] MyStudy = {
[SIZE=3]AnyFolder[/SIZE] &Model = .MyModel;
Gravity = {0.0, -9.81, 0.0};
};

}; // Main

[SIZE=2]when I reload the model I get the following error msg

[SIZE=1][SIZE=1]ERROR(SCR.PRS23)[/SIZE] : [SIZE=1]C:/Users/b…i/AnyBody WIP/pendulum.any[/SIZE] : ‘JointDriver’ : Expression assignments are not allowed in declarations of AnyFolder objects
Model loading skipped

[SIZE=2]when I drill into this for an explanation I get

ERROR(SCR.PRS23) : ‘FileName(LineNo)’ : ‘TokenString’ : Expression assignments are not allowed in declarations of AnyFolder objects

Explanation:
Folder objects cannot be assigned with an expression. In this particular case, the error occur during in the declaration of the object. Maybe a reference operator is missing if you wanted to make a reference to another objects. Possible syntax:
<folder_class_name> &<reference_name> = <object_name (complete or relative)>;
<folder_class_name> <object_name> = { … };
where the former is a reference declaration and assignment and the latter is a folder declaration and assignment.

[SIZE=2]please help because I would like to move onto the next lessons before the trial expires
[/SIZE][/SIZE][/SIZE][/SIZE]

Hello Barry,

This is just a typo:

replace:
[SIZE=3]AnyKinMotion[/SIZE] JointDriver =
[SIZE=3]AnyRevoluteJoint[/SIZE] &Jnt = .Joint;
[SIZE=3]AnyFunPolynomial[/SIZE] DriverFun = {
PolyCoef = {{0, 3, 5}};
};
{

with:

[SIZE=3]AnyKinMotion[/SIZE] JointDriver = {
[SIZE=3]AnyRevoluteJoint[/SIZE] &Jnt = .Joint;
[SIZE=3]AnyFunPolynomial[/SIZE] DriverFun = {
PolyCoef = {{0, 3, 5}};
};

thanks very much for the quick reply, it works :slight_smile:

// Model for the “Making Things Move” tutorial.

Main = {

// The actual body model goes in this folder
AnyFolder MyModel = {

// Global Reference Frame
AnyFixedRefFrame GlobalRef = {
}; // Global reference frame

AnySeg Pendulum = {
Mass = 1;
Jii = {1, 0.01, 1}/15;
AnyRefNode Origin = {
sRel = {0, 0.5, 0};
};
AnyRefNode P1 = {
sRel = {0, -0.5, 0};
};
AnyDrawSeg drw = {};
};
AnyInputC3D C3D =
{
FileName = “pendulum.c3d”;
//ReadAllDataOnOff = On;
//TruncateExtraCharsInNamesOnOff = On;
//MakeNameUniqueStr = “_”;
//PointsScaleFactor = 1;
ConstructModelOnOff = Off;
ConstructChartOnOff = Off;
//ConstructWeightFunUsingResidualOnOff = Off;
//MarkerUseAllPointsOnOff = Off;
//MarkerUseCamMaskOnOff = On;
//MarkerIndices = {};
//MarkerLabels = {};
//MarkerFilterIndex = 0;
//ProcessedDataFilterIndex = 0;
//AnalogFilterIndex = -1;
/Filter =
{
z0 = {};
AutomaticInitialConditionOnOff = On;
FilterForwardBackwardOnOff = On;
N = 2;
W = {};
Fs = 0;
Fc = {10};
Type = LowPass;
};
/
//WeightThreshold = 0;
//WeightOutput = {{0, 1}, {0, 1}, {0, 1}};
//WeightTransitionTime = 0.1;
//SearchAndReplace = {};
//WriteMarkerDataToFilesOnOff = Off;
//MarkerScaleXYZ = {0.025, 0.025, 0.025};
//MarkerRGB = {0.65, 0.65, 0.65};
//MarkerDrawOnOff = On;
//MarkerInterPolType = Bspline;
//MarkerBsplineOrder = 8;
};

AnyKinDriverMarker C3Dmotion =
{
//MeasureOrganizer = {};
//CType = ;
//WeightFun = {};
//DriverPos0 = {};
//DriverVel0 = {};
//DriverAcc0 = {};
AnyRefFrame &Marker = .Pendulum.P1;
//AnyRefFrame &<Insert name1> = <Insert object reference (or full object definition)>;
AnyParamFun &Trajectory =
Main.MyModel.C3D.Points.Markers.L000.PosInterpol;
AnyDrawKinMeasure drw =
{
//Visible = On;
//Opacity = 1;
//RGB1 = {0.8, 0.3, 0.3};
//RGB2 = {0.3, 0.8, 0.3};
//RGB3 = {0.3, 0.3, 0.8};
//RGB4 = {0.8, 0.5, 0.2};
Label = Off;
Size = 0.07;
Line = Off;
//Text = “”;
//TextSize = 30;
//AnyStyleDrawMaterial &<Insert name0> = <Insert object reference (or full object definition)>; You can make any number of these objects!
};
};

AnyRevoluteJoint Joint = {
AnyRefFrame &Ground = .GlobalRef;
AnyRefFrame &Pendulum = .Pendulum.Origin;
};

}; // MyModel

// The study: Operations to be performed on the model
AnyBodyStudy MyStudy = {
AnyFolder &Model = .MyModel;
Gravity = {0.0, -9.81, 0.0};
AnyIntVar FirstFrame = Main.MyModel.C3D.Header.FirstFrameNo;
AnyIntVar LastFrame = Main.MyModel.C3D.Header.LastFrameNo;
tStart = FirstFrame/Main.MyModel.C3D.Header.VideoFrameRate+2Kinematics.ApproxVelAccPerturb;
tEnd = LastFrame/Main.MyModel.C3D.Header.VideoFrameRate-2
Kinematics.ApproxVelAccPerturb;
InitialConditions.SolverType = KinSolOverDeterminate;
Kinematics.SolverType = KinSolOverDeterminate;
};