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

Added: Modified fetch robot xml #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

josiahls
Copy link

Added fetch/main.xml .

Results from loading:
image

Modified dir struct:
image

Notes:
The only change this pull request makes is adding a fetch robot that can be loaded without error.
I needed to comment out the <camera tags (is there a way to support these or no?), and add type="hinge" to joints that did not have the types. I went ahead and kept the backup files to compare the original and the changed xml.

There are no fetch objects, environments, or anything else in this branch, however I plan to begin adding that code to my github as well. But still, I am making the pull request A. so that others can see that someone is trying to get the fetch to work, and B. so others might be willing to help.

Loaded via custom Fetch robot locomotor:
image

@josiahls
Copy link
Author

josiahls commented Jan 27, 2019

I am not sure if this is just how pybullet allows the robot to move however after several steps I get:
image
The main issue is the fingers becoming disconnected because they are being moved beyond their limit. Now I understand that this is actually shown by joints_at_limit and the point is to train the robot to not move beyond what it is physically supposed to, however shouldn't there be a way to force it to avoid movements beyond itself in the xml? like below:
image
Like are there parameters that I am missing to prevent this, are is the point to check the joints_at_limit and simply don't do actions that break any of the limits? This issue seems to be only related to the 'slide' joint type.

I am looking at the current ways the environments are setup and they involve applying the action, doing a global step, then determing which joints are outside of their limits. Obviously this is not a big deal for RL, but if I want to test a regular planner, it needs to know that an action is going to be invalid preferably before executing that action (both due to self limits, but also environment collisions).

Are there any implimentations of this that I can reference? I'm not an expert in gym environments (but getting this fetch to spawn actually helped me a lot in terms of understanding how to make and test gym envs) so I might not be super familier if there are already some that do action validation.

@josiahls
Copy link
Author

Also, I am currently working on the URDF version of fetch, which is showing more promise:
image

Both models demonstrate collisions.

Which I understand is kind of moving farther from the Mujoco simulation, however the bullet Mujoco format support just does not seem to be there. So at best, the model with look ugly.

@benelot
Copy link
Owner

benelot commented Jan 28, 2019 via email

@benelot
Copy link
Owner

benelot commented Jan 28, 2019

I am just about to look into your fetch robot to see what might be wrong with it.

If in doubt how to implement a proper env for pybullet-gym check out the reacher_env.py (it is a manipulator as fetch probably is):
https://github.com/benelot/pybullet-gym/blob/master/pybulletgym/envs/roboschool/envs/manipulation/reacher_env.py

@josiahls
Copy link
Author

josiahls commented Jan 28, 2019 via email

@benelot
Copy link
Owner

benelot commented Jan 28, 2019

That was the problem. I set the slider joint just as they are done in the pendulum. Here is my diff:

diff --git a/pybulletgym/envs/assets/mjcf/fetch/main.xml b/pybulletgym/envs/assets/mjcf/fetch/main.xml
index 621f9e3..a1c7451 100755
--- a/pybulletgym/envs/assets/mjcf/fetch/main.xml
+++ b/pybulletgym/envs/assets/mjcf/fetch/main.xml
@@ -160,7 +160,7 @@
													 <site name="grip_r" pos="0.02 -0.01 0" rgba="0 1 0 1"
														   size="0.01 0.01 0.01"/>
													 <inertial diaginertia="0.1 0.1 0.1" mass="4" pos="-0.01 0 0"/>
-                                                    <joint type="slide" axis="0 1 0" name="r_gripper_finger_joint"
+                                                    <joint type="slide" axis="0 1 0" limited="true" pos="0 0 0" name="r_gripper_finger_joint"
															range="0 0.05"/>
													 <geom pos="0 -0.008 0" size="0.0385 0.007 0.0135" type="box"
														   name="r_gripper_finger_link" material="gripper_finger_mat"
@@ -170,7 +170,7 @@
													 <site name="grip_l" pos="0.02 0.01 0" rgba="0 1 0 1"
														   size="0.01 0.01 0.01"/>
													 <inertial diaginertia="0.1 0.1 0.1" mass="4" pos="-0.01 0 0"/>
-                                                    <joint type="slide" axis="0 -1 0" name="l_gripper_finger_joint"
+                                                    <joint type="slide" axis="0 -1 0" limited="true" pos="0 0 0" name="l_gripper_finger_joint"
															range="0 0.05"/>
													 <geom pos="0 0.008 0" size="0.0385 0.007 0.0135" type="box"
														   name="l_gripper_finger_link" material="gripper_finger_mat"

I basically added limited="true" and pos="0 0 0". You can check if limited="true" alone would work as well.

@benelot
Copy link
Owner

benelot commented Jan 28, 2019

You should try to stick with the mujoco, I intend to support the openai code as closely as possible to support future updates. In case things do not work, just ask and I might be able to help.

@benelot
Copy link
Owner

benelot commented Nov 15, 2019

Did you continue to work on this?

@josiahls
Copy link
Author

Hi, I haven't touched it in a few months. Been in the process of learning DQN's / DDPGs in general. Might pick back up in a few weeks though since I have some base line models.

Originally I was doing a URDF version of fetch, I can try getting the MJCF version to work instead. One remaining issue with MJCF is the complete lack fo pybullet texturing control. So when I attempt to have a fetch bot that can reach torward an object, everything has 1 texture... Of course, its been a few months, so maybe things have changed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants