{"action":"created","issue":{"url":"https://api.github.com/repos/dartsim/dart/issues/560","labels_url":"https://api.github.com/repos/dartsim/dart/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/dartsim/dart/issues/560/comments","events_url":"https://api.github.com/repos/dartsim/dart/issues/560/events","html_url":"https://github.com/dartsim/dart/issues/560","id":118394816,"number":560,"title":"Faster simulation/Energy consumption?","user":{"login":"costashatz","id":1283922,"avatar_url":"https://avatars.githubusercontent.com/u/1283922?v=3","gravatar_id":"","url":"https://api.github.com/users/costashatz","html_url":"https://github.com/costashatz","followers_url":"https://api.github.com/users/costashatz/followers","following_url":"https://api.github.com/users/costashatz/following{/other_user}","gists_url":"https://api.github.com/users/costashatz/gists{/gist_id}","starred_url":"https://api.github.com/users/costashatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/costashatz/subscriptions","organizations_url":"https://api.github.com/users/costashatz/orgs","repos_url":"https://api.github.com/users/costashatz/repos","events_url":"https://api.github.com/users/costashatz/events{/privacy}","received_events_url":"https://api.github.com/users/costashatz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-11-23T14:40:40Z","updated_at":"2015-11-25T00:58:58Z","closed_at":"2015-11-24T17:29:58Z","body":"Hello,\r\n\r\nWe are implementing robotics evolutionary algorithms and so far we've been using our own custom physics simulator (robdyn\\[1\\]) to produce the desired simulations. As we are extending our robot repository (we already have 2 hexapods, one mobile base+manipulator and we are waiting a humanoid), we think it's time to change to a better and more configurable physics engine/simulator. DART provides an easier to use and more robust toolkit than ODE for robotics, while also maintaining the ability to write custom code (which is crucial for us). So I wanted to ask you some questions:\r\n\r\n - After some quick experiments using our hexapod (see \\[2\\]) to walk, our custom simulator (although not being extremely accurate) is around 3-4 times faster than DART (only with a PD controller, no gui, no special things). Are there some parameters or tricks that I can do to speed up simulation time? As this is for evolutionary algorithms and thousands of simulations need to be ran, we could sacrifice a little accuracy for speed. With our custom simulator, typical runs take 10-12 days.\r\n - The other thing that it's important to us (and we cannot get it with our custom simulator easily) is energy consumption of the motors. I did a quick search in the API, but I didn't find anything. Is there a way to easily get the energy consumption for each motor(joint)?\r\n\r\nMany thanks in advance!\r\n\r\n\r\n\\[1\\]: https://github.com/resibots/robdyn\r\n\\[2\\]: https://www.youtube.com/watch?v=T-c17RKh3uE\r\n "},"comment":{"url":"https://api.github.com/repos/dartsim/dart/issues/comments/159451963","html_url":"https://github.com/dartsim/dart/issues/560#issuecomment-159451963","issue_url":"https://api.github.com/repos/dartsim/dart/issues/560","id":159451963,"user":{"login":"jslee02","id":4038467,"avatar_url":"https://avatars.githubusercontent.com/u/4038467?v=3","gravatar_id":"","url":"https://api.github.com/users/jslee02","html_url":"https://github.com/jslee02","followers_url":"https://api.github.com/users/jslee02/followers","following_url":"https://api.github.com/users/jslee02/following{/other_user}","gists_url":"https://api.github.com/users/jslee02/gists{/gist_id}","starred_url":"https://api.github.com/users/jslee02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jslee02/subscriptions","organizations_url":"https://api.github.com/users/jslee02/orgs","repos_url":"https://api.github.com/users/jslee02/repos","events_url":"https://api.github.com/users/jslee02/events{/privacy}","received_events_url":"https://api.github.com/users/jslee02/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T00:58:58Z","updated_at":"2015-11-25T00:58:58Z","body":"> But how can a joint stay in a fixed angle? I have PD controllers and there should always be some small deviation in the joint angles between time steps.\r\n\r\nIf we assume that the actual controller of the real hardware is able to control the joint to stay in a fixed angle, then we can make it happenes in the simulation as well. DART's Joint supports [several actuator types](https://github.com/dartsim/dart/blob/master/dart/dynamics/Joint.h#L82). You may have used `FORCE` type, which is default. If you change the actuator type of the joint to `LOCKED`, for example, the joint will perfectly stay in the current angle. Internally, `LOCKED` joint is regarded as an kinematic joint. This means the kinematic joint values such as joint positions, velocities, and accelerations now become the input for the joint, and the forward dynamics algorithm computes joint forces that is required to achieve the kinematic joint values.\r\n\r\nSimilarly, there are `VELOCITY` and `SERVO` types that both of them take desired joint velocities. The differences of the two types is that `VELOCITY` always achieves the desired velocity regardless how much joint force is required, whereas `SERVO` **tries** to achieve the desired velocity with given joint for limits. If `SERVO` joint need more forces than the limits then it will fail to achieve the desired velocity just like a real servo motor.\r\n\r\n`SERVO` actuator type is not implemented yet but I'm working on it. It's expected to be finished within this week."}}