taichi-dev/difftaichi

Why does the input state contain sinusoids?

ehannigan opened this issue · 4 comments

This is not necessarily a coding issue, but I don't know where else to ask. In mass_spring.py, the input to the neural network controller (length of n_input_states) contains n_sin_waves.

https://github.com/yuanming-hu/difftaichi/blob/242905d81d0814911d8f3c376f35b5045446bf61/examples/mass_spring.py#L102-L108

What is the purpose of feeding sine waves into the system? I read the DiffTaiChi paper and I do not see any references to the design of the mass-spring system or why you would want to input a sine wave. If it is not a simple explanation, could you point me towards a source that I could read? I appreciate it.

Thanks for the question. That's just to enforce a periodic motion. I was also curious about if a purely open-loop controller works, so I made that design.

Of course, you can change that to a close-loop controller, as in https://github.com/yuanming-hu/difftaichi/blob/242905d81d0814911d8f3c376f35b5045446bf61/examples/rigid_body.py#L113

Thanks! That I'll try both options.

Actually, one more question. I looked closer at rigid_body.py and mass_spring.py, I don't see how the definitions of nn1 are different such that mass_spring.py is open-loop and rigid_body.py is closed loop. Could you expand on that point a little more?

I think I figured it out. The mass_spring nn1 is closed loop in that the goal is used as part of the state multiplied by the weights of nn1.