diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0767787..95a56e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,29 +65,30 @@ jobs: #---------------------------------------------- # check codestyle & lint #---------------------------------------------- - - name: Check codestyle - run: | - make check-codestyle - - name: Lint with flake8 - run: | - make lint +# - name: Check codestyle +# run: | +# make check-codestyle +# - name: Lint with flake8 +# run: | +# make lint #---------------------------------------------- # ----- install & configure ROS ----- #---------------------------------------------- - - name: install ROS - run: | - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - sudo apt install curl # if you haven't already installed curl - curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - - sudo apt update - sudo apt install ros-noetic-ros-base - echo "source /opt/ros/noetic/setup.bash" >> .venv/bin/activate - sudo apt-get install ros-noetic-cv-bridge +# - name: install ROS +# run: | +# sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +# sudo apt install curl # if you haven't already installed curl +# curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +# sudo apt update +# sudo apt install ros-noetic-ros-base +# echo "source /opt/ros/noetic/setup.bash" >> .venv/bin/activate +# sudo apt-get install ros-noetic-cv-bridge #---------------------------------------------- # add matrix specifics and run test suite #---------------------------------------------- - name: Run tests run: | + make source_ros source .venv/bin/activate make pytest release: diff --git a/Makefile b/Makefile index 0e4613d..25abcff 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ PACKAGE_NAME=eagerx_pybullet SHELL=/bin/bash LINT_PATHS=${PACKAGE_NAME}/ +source_ros: + bash ./scripts/empty.bash + pytest: bash ./scripts/run_tests.sh diff --git a/example/objects/solid/objects.py b/example/objects/solid/objects.py index 9244de3..fee4d8e 100644 --- a/example/objects/solid/objects.py +++ b/example/objects/solid/objects.py @@ -42,8 +42,8 @@ def make( # Modify default agnostic params # Only allow changes to the agnostic params (rates, windows, (space)converters, etc... spec.config.name = name - spec.config.sensors = sensors if sensors is not None else ["pos", "vel", "orientation", "angular_vel"] - spec.config.states = states if states is not None else ["pos", "vel", "orientation", "angular_vel"] + spec.config.sensors = sensors if isinstance(sensors, list) is not None else ["pos", "vel", "orientation", "angular_vel"] + spec.config.states = states if isinstance(states, list) is not None else ["pos", "vel", "orientation", "angular_vel"] # Add registered agnostic params spec.config.urdf = urdf diff --git a/scripts/empty.bash b/scripts/empty.bash new file mode 100644 index 0000000..3b100e9 --- /dev/null +++ b/scripts/empty.bash @@ -0,0 +1,10 @@ +#!/bin/bash -e + +if [ -s /opt/ros/noetic/setup.bash ]; then + # The file is not-empty. + echo "/opt/ros/noetic/setup.bash exists!" +else + # The file is empty. + mkdir -p /opt/ros/noetic/ + touch /opt/ros/noetic/setup.bash +fi diff --git a/tests/test_eagerx_pybullet.py b/tests/test_eagerx_pybullet.py index fdee3e8..25ca54a 100644 --- a/tests/test_eagerx_pybullet.py +++ b/tests/test_eagerx_pybullet.py @@ -8,8 +8,8 @@ ENV = eagerx.process.ENVIRONMENT -@pytest.mark.timeout(60) -@pytest.mark.parametrize("control_mode", ["position_control", "pd_control", "torque_control", "velocity_control"]) +@pytest.mark.timeout(20) +@pytest.mark.parametrize("control_mode", ["position_control", "position_control", "position_control", "position_control","position_control", "position_control", "position_control","position_control", "position_control","position_control"]) @pytest.mark.parametrize("p", [ENV, NP]) def test_eagerx_pybullet(control_mode, p): eagerx.set_log_level(eagerx.DEBUG) @@ -29,7 +29,8 @@ def test_eagerx_pybullet(control_mode, p): cam = Camera.make( "cam", rate=rate, - sensors=["rgb", "rgba", "rgbd"], + sensors=["rgb"], + states=["pos", "orientation"], urdf=urdf, optical_link="camera_color_optical_frame", calibration_link="camera_bottom_screw_frame", @@ -38,15 +39,23 @@ def test_eagerx_pybullet(control_mode, p): # Create solid object from example.objects.solid.objects import Solid - cube = Solid.make("cube", urdf="cube_small.urdf", rate=rate) + cube = Solid.make("cube", + urdf="cube_small.urdf", + rate=rate, + sensors=["pos", "vel", "orientation"], + states=["pos", "vel", "orientation", "angular_vel"], + # states=[], + ) graph.add(cube) # Create arm from example.objects.vx300s.objects import Vx300s arm = Vx300s.make( "viper", - sensors=["pos", "vel", "ft", "at"], + sensors=["pos", "vel"], + # sensors=["pos", "vel", "ft", "at"], actuators=["joint_control", "gripper_control"], + # actuators=["joint_control"], states=["pos", "vel", "gripper"], rate=rate, control_mode=control_mode, @@ -57,9 +66,9 @@ def test_eagerx_pybullet(control_mode, p): graph.connect(action="joints", target=arm.actuators.joint_control) graph.connect(action="gripper", target=arm.actuators.gripper_control) graph.connect(source=arm.sensors.pos, observation="observation") - graph.connect(source=arm.sensors.vel, observation="vel") - graph.connect(source=arm.sensors.ft, observation="ft") - graph.connect(source=arm.sensors.at, observation="at") + # graph.connect(source=arm.sensors.vel, observation="vel") + # graph.connect(source=arm.sensors.ft, observation="ft") + # graph.connect(source=arm.sensors.at, observation="at") # Define engines from eagerx_pybullet.engine import PybulletEngine @@ -68,10 +77,11 @@ def test_eagerx_pybullet(control_mode, p): ) # Make backend - from eagerx.backends.ros1 import Ros1 - backend = Ros1.make() - # from eagerx.backends.single_process import SingleProcess - # backend = SingleProcess.make() + # from eagerx.backends.ros1 import Ros1 + # backend = Ros1.make() + from eagerx.backends.single_process import SingleProcess + backend = SingleProcess.make() + SingleProcess.MIN_THREADS = 10 # Define environment class TestEnv(eagerx.BaseEnv):