Getting Trajectories
Go to this link to get pouring trajectories.
Place the trajectory pickle files in the ./trajs
folder at the root of this project
The files to access the pretext data is pouring_dataloader.py
Getting Pretext Task Dataset
Go to this link to get data for the pretext task.
The files to access the pretext data is pretext_task_dataloader.py
Robot Infra
A few useful files that would help interfacing with the robots. Hopefully, we can build this up to have first class I/O and Teleoperation support.
Collecting Trajectories
- Download xARM Studio.
- Attach the gripper of the robot and initilize it's initial position.
- Go to recordings and collect a trajectory.
- Download a suitable trajectory.
Note on collecting a trajectory:
- Mark 15 positions on the table.
- Put a cup at that position
- Add a cup to the gripper of the robot and put almonds in it.
- Manually take the robot and do the pouring.
- Save the recording.
- xARM studio has a very easy to use UI for this.
Parsing Trajectory
Now, we would like to collect image observations with those trajectories.
Take the trajectory and extract it in the ./trajs/
folder. The format of the traejctories for pouring should be as follows:
trajs/{cup_type}/{cup_type}_pos_{num}.traj
where cup type represents the type of cup and num represents the trajectory number.
-
Now run
python parse_traj.py --cup-type <red_cup/plastic_cup...> --num <1-15>
which will take the trajectory and parse it and save the parsed trajectory in./parsed_trajs/<name_of_traj_file>
-
This might take a while as we collect image observation for each action.
The parsed trejctory is of this data type:
List[Dict]
, where the dict has the following keys:
{
'rgb': Image observation
'dep': Depth observation,
'state_joint_angles': The joint angles of the xarm robot currently,
'state_cartesian_info': The x, y,z , yaw pitch and roll of the robot.
'actions': The actions i.e the joint angles that the robot should go to next.
}
Running a policy on the robot
- Configure the robot state.
- Run
deploy_policy.py --expID 200x --algo <mlp/ndp>
to deploy a certain policy. The expID represents the policy which is meant to be deployed and the algo argument represents whether the policy is a MLP or an NDP.
Useful Functions
All utils functions are in utils.py
Realsense Camera stuff
- init realsense camera:
_start_realsense()
- Get image and depth observations:
get_img_and_depth()
- init xarm:
get_arm()
, gives you an object which can be used to control the robot.
Robot end effector control
step()
: moves the end effector by a delta x, y and zmove()
: moved the end effector to a particular x,y,z, yaw, pitch, rollset_joint_angles()
: sets the robot into a specific joint angle configuration (the xarm has 7 joints, so 7 values)_get_state()