Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve interface for coordinate variables in the observation dictionary #216

Open
mitkof6 opened this issue Jan 16, 2020 · 0 comments
Open

Comments

@mitkof6
Copy link

mitkof6 commented Jan 16, 2020

Instead of iterating over the joints to get the generalized coordinate, velocities and accelerations for the observations, I would prefer to iterate over the coordinates in the compute_state_desc. You can update the code as follows if you agree:

        ## Coordinates
        res['coordinate_pos'] = {}
        res['coordinate_vel'] = {}
        res['coordinate_acc'] = {}
        for i in range(self.coordinateSet.getSize()):
            coordinate = self.coordinateSet.get(i)
            name = coordinate.getName()
            res['coordinate_pos'][name] = coordinate.getValue(self.state)
            res['coordinate_vel'][name] = coordinate.getSpeedValue(self.state)
            res['coordinate_acc'][name] = coordinate.getAccelerationValue(self.state)

This is cleaner, because a joint might have more than one coordinates and also we know the name of the coordinate instead of the joint. For example, if you do an imitation learning you might want to compare coordinates directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant