Draw a AnyDrawSphere using AnyKinCoM


I tried to draw a AnyDrawSphere using AnyKinCoM object.

I want to draw a sphere at the total CoM including the robot model.

I tried to use the following code:

AnyKinCoM TotalCOM =
  AnyFolder &robot_upper_body = .EnvironmentModel_UpperBody.Segs;
  AnyFolder &robot_lower_body = .EnvironmentModel_LowerBody.Segs;
  AnyDrawSphere renderSphere =
      RGB = {0, 1, 1};
      ScaleXYZ = 0.05*{1,1,1};
      Position = .Pos;

But I could see the following error message:

ERROR(SCR.EXP10) : Environment.any : ‘Position’ : Expression evaluation failed at moment ‘Const’ :
Environment.any(49) : TotalCOM.Pos : argument will not be ready for evaluation until moment ‘PosVar’

Would you please let me know a good idea to do it?

Best regards,

Hi Moonki,

The position vector of the sphere can not be used for this, it has to be a const.

The position vector is just an offset to the reference frame it has been attached to.

There are two alternative ways:
[li]use the AnyVector for displaying a sphere. It can be done by altering the line caps and make the line really thin it is not elegant but it works. Please have look in the toolbox/mocap/forceplate4 class for an example of this.
[/li][li] simply construct a dummy segment, drive it and display the sphere on this seg.

Best regards