<commit_before>#!/usr/bin/env python
import math
import sys
import time
import pybullet as p
from time import sleep

class Simulation:
    def __init__(self, directory):
        self.t = 0
        self.dt = 0.001

        # Instantiating Bullet
        physicsClient = p.connect(p.GUI)
        p.setGravity(0, 0, -10)

        # Loading floor
        planeId = p.loadURDF('bullet/plane.urdf')

        # Loading robot
        cubeStartPos = [0, 0, 0.75]
        cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0])
        self.robot = p.loadURDF(directory+"/robot.urdf",
                            cubeStartPos, cubeStartOrientation)

        # In case we want to read SDF, but PyBullet can't do that properly so far
        # https://github.com/bulletphysics/bullet3/issues/2651
        # self.robot = p.loadSDF(directory+"/robot.sdf")[0]
        # p.resetBasePositionAndOrientation(self.robot, cubeStartPos, cubeStartOrientation)

        # Engine parameters
        p.setPhysicsEngineParameter(fixedTimeStep=self.dt)
        p.setRealTimeSimulation(1)
        # p.setPhysicsEngineParameter(numSolverIterations=5)
        # p.setPhysicsEngineParameter(numSubSteps=1)

        # Retrieving joints and frames
        self.joints = {}
        self.frames = {}

        # Collecting the available joints
        for k in range(p.getNumJoints(self.robot)):
            jointInfo = p.getJointInfo(self.robot, k)
            name = jointInfo[1].decode('utf-8')<commit_msg>Floor plane loaded from same dir as simulation.py. Allowing running bullet.py from another location<commit_after>#!/usr/bin/env python
import math
import sys
import os
import time
import pybullet as p
from time import sleep

class Simulation:
    def __init__(self, directory):
        self.t = 0
        self.dt = 0.001

        # Instantiating Bullet
        physicsClient = p.connect(p.GUI)
        p.setGravity(0, 0, -10)

        # Loading floor
        planeDirectory = os.path.dirname(os.path.abspath(__file__))
        planeId = p.loadURDF(planeDirectory+'/bullet/plane.urdf')

        # Loading robot
        cubeStartPos = [0, 0, 0.75]
        cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0])
        self.robot = p.loadURDF(directory+"/robot.urdf",
                            cubeStartPos, cubeStartOrientation)

        # In case we want to read SDF, but PyBullet can't do that properly so far
        # https://github.com/bulletphysics/bullet3/issues/2651
        # self.robot = p.loadSDF(directory+"/robot.sdf")[0]
        # p.resetBasePositionAndOrientation(self.robot, cubeStartPos, cubeStartOrientation)

        # Engine parameters
        p.setPhysicsEngineParameter(fixedTimeStep=self.dt)
        p.setRealTimeSimulation(1)
        # p.setPhysicsEngineParameter(numSolverIterations=5)
        # p.setPhysicsEngineParameter(numSubSteps=1)

        # Retrieving joints and frames
        self.joints = {}
        self.frames = {}

        # Collecting the available joints
        for k in range(p.getNumJoints(self.robot)):
            jointInfo = p.getJointInfo(self.robot, k)
            name = jointInfo[1].decode('utf-8')
{'fraction_non_alphanumeric': 0.09968051118210862, 'fraction_numerical': 0.017891373801916934, 'mean_word_length': 2.4983240223463685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7078254', 'n_tokens_mistral': 1028, 'n_tokens_neox': 955, 'n_words': 208}