Skip to content

Commit

Permalink
Merge pull request #150 from k-okada/ga
Browse files Browse the repository at this point in the history
Support Noetic
  • Loading branch information
k-okada committed Apr 12, 2022
2 parents 7ac1422 + 699ed90 commit be6fbe0
Show file tree
Hide file tree
Showing 22 changed files with 303 additions and 189 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
on:
push:
branches:
- master
- ga
pull_request:

jobs:
check_python2:
runs-on: ubuntu-latest
name: check_python2

container: ubuntu:20.04

steps:
- name: Chcekout
uses: actions/checkout@v2
- name: Check Python2
run: |
apt update -q && apt install -y -q python2
python2 -m compileall .
check_python3:
runs-on: ubuntu-latest
name: check_python3

container: ubuntu:20.04

steps:
- name: Install latest git to download .git directory in actions/checkout@v2, git diff requries .git directory ( use sudo for ros-ubuntu )
run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git
- name: Chcekout
uses: actions/checkout@v2
- name: Check Python3
run: |
apt update -q && apt install -y -q python3 git 2to3
bash -c "ret=0; trap 'ret=1' ERR; python3 -m compileall .; 2to3 -w -f except -f execfile -f has_key -f raw_input -f zip .; find . -type f -exec grep -Iq . {} \; -a -not -regex '.*/node_scripts/[^/]*py' -exec 2to3 -w -f import {} \; ; git diff --exit-code . > /dev/null; echo Exitting with \$ret; exit \$ret"
ros:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
# - ROS_DISTRO: indigo
# ROS_DISTRO_NAME: indigo
# OS_NAME: ubuntu
# OS_CODE_NAME: trusty
# ARCH: amd64
# INDEX_URL: https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/6a93d17/index.yaml
# - ROS_DISTRO: kinetic
# ROS_DISTRO_NAME: kinetic
# OS_NAME: ubuntu
# OS_CODE_NAME: xenial
# ARCH: amd64
# INDEX_URL: https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/6a93d17/index.yaml
- ROS_DISTRO: melodic
ROS_DISTRO_NAME: melodic
OS_NAME: ubuntu
OS_CODE_NAME: bionic
ARCH: amd64
INDEX_URL: https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml
experimental: false
- ROS_DISTRO: noetic
ROS_DISTRO_NAME: noetic
OS_NAME: ubuntu
OS_CODE_NAME: focal
ARCH: amd64
INDEX_URL: https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml
experimental: true

steps:
- name: Chcekout
uses: actions/checkout@v2

- name: Start X server
run: |
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections # set non interactive tzdata https://stackoverflow.com/questions/8671308/non-interactive-method-for-dpkg-reconfigure-tzdata
sudo apt-get -y -qq install mesa-utils x11-xserver-utils xserver-xorg-video-dummy wget
export DISPLAY=:0
wget https://raw.githubusercontent.com/jsk-ros-pkg/jsk_travis/master/dummy.xorg.conf -O /tmp/dummy.xorg.conf
sudo Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile /tmp/xorg.log -config /tmp/dummy.xorg.conf $DISPLAY &
sleep 3 # wait x server up
export QT_X11_NO_MITSHM=1 # http://wiki.ros.org/docker/Tutorials/GUI
xhost +local:root
- name: Test
run: |
export ROS_DISTRO_NAME=${{ matrix.ROS_DISTRO_NAME }}
export OS_NAME=${{ matrix.OS_NAME }}
export OS_CODE_NAME=${{ matrix.OS_CODE_NAME }}
export ARCH=${{ matrix.ARCH }}
export INDEX_URL=${{ matrix.INDEX_URL }}
export JOB_PATH=/tmp/devel_job
export ABORT_ON_TEST_FAILURE=1
export DISPLAY=:0
export QT_X11_NO_MITSHM=1 # http://wiki.ros.org/docker/Tutorials/GUI
set -x
# either install the latest released version of ros_buildfarm
# pip install ros_buildfarm
# or checkout a specific branch
git clone -b master https://github.com/k-okada/ros_buildfarm /tmp/ros_buildfarm
pip install /tmp/ros_buildfarm
# checkout catkin for catkin_test_results script
git clone https://github.com/ros/catkin /tmp/catkin
# run devel job for a ROS repository with the same name as this repo
export REPOSITORY_NAME=$(basename $PWD)
# use the code already checked out by Travis
mkdir -p $JOB_PATH/ws/src
cp -R ../ $JOB_PATH/ws/src/
# generate the script to run a pre-release job for that target and repo
generate_prerelease_script.py $INDEX_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH --output-dir $JOB_PATH
# run the actual job which involves Docker
mkdir -p ~/.ccache
cd $JOB_PATH; sh ./prerelease.sh -y
# get summary of test results
/tmp/catkin/bin/catkin_test_results $JOB_PATH/ws/test_results --all --verbose
8 changes: 0 additions & 8 deletions pr2_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ if(CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED COMPONENTS rostest roslaunch)
roslaunch_add_file_check(launch/pr2_empty_world.launch)

set(ENV{ROSDEP_SOURCE_PATH} /tmp/)
execute_process(COMMAND rosdep resolve rostest RESULT_VARIABLE rosdep_result)
if(rosdep_result)
message(STATUS "rosdep is not initialized, run rosdep init and update, please wait for a moment...")
execute_process(COMMAND rosdep init)
execute_process(COMMAND rosdep update)
endif()

add_rostest(test/collisions/test_slide.launch)

add_rostest(test/mechanism_controllers/test_base.launch)
Expand Down
1 change: 1 addition & 0 deletions pr2_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<run_depend>pr2_mechanism_controllers</run_depend>
<run_depend>pr2_head_action</run_depend>
<run_depend>joint_trajectory_action</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>pr2_gripper_action</run_depend>
<run_depend>single_joint_position_action</run_depend>
<run_depend>stereo_image_proc</run_depend>
Expand Down
22 changes: 11 additions & 11 deletions pr2_gazebo/scripts/pr2_fingertip_pressure_contact_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def store_contacts(self, whichtip, bumperstate):
self.lock.release()

if DEBUG:
print whichtip, "positions:\n", pplistlist(self.contact_positions[whichtip])
print whichtip, "normals:\n", pplistlist(self.contact_normals[whichtip])
print(whichtip, "positions:\n", pplistlist(self.contact_positions[whichtip]))
print(whichtip, "normals:\n", pplistlist(self.contact_normals[whichtip]))



Expand Down Expand Up @@ -254,17 +254,17 @@ def publish(self):
nearest_array_element = arrayelem

if DEBUG:
print "tip:", tip
print "dists:", pplist(dists)
print "anglediffs:", pplist(anglediffs)
print "weighteddists:", pplist(weighteddists)
print("tip:", tip)
print("dists:", pplist(dists))
print("anglediffs:", pplist(anglediffs))
print("weighteddists:", pplist(weighteddists))

#update that sensor element's depth if this depth is greater
#(the maximum readings around 10000?)
if nearest_array_element != 'not found':
if DEBUG:
print "nearest_array_element:", nearest_array_element
print "nearest_array_weighted_dist: %0.3f"%nearest_array_weighted_dist
print("nearest_array_element:", nearest_array_element)
print("nearest_array_weighted_dist: %0.3f"%nearest_array_weighted_dist)
newreading = self.contact_depths[tip][contactnum] * \
self.sensor_array_info[tip].force_per_unit[nearest_array_element] * 5000.
if newreading > 10000:
Expand All @@ -280,8 +280,8 @@ def publish(self):
self.lock.release()

if DEBUG:
print "left tip readings:", pplist(finger_tip_readings['l'])
print "right tip readings:", pplist(finger_tip_readings['r'])
print("left tip readings:", pplist(finger_tip_readings['l']))
print("right tip readings:", pplist(finger_tip_readings['r']))

#fill in the message and publish it
ps = PressureState()
Expand All @@ -303,7 +303,7 @@ def publish(self):
s1 = contactArraySimulator('r')
s2 = contactArraySimulator('l')

print "done initializing, starting to publish"
print("done initializing, starting to publish")

while not rospy.is_shutdown():
rospy.sleep(0.01)
Expand Down
4 changes: 2 additions & 2 deletions pr2_gazebo/scripts/pr2_simulate_torso_spring.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
duration = rospy.Duration.from_sec(-1)
try:
resp1 = apply_joint_effort(joint_name, effort, start_time, duration)
except rospy.ServiceException, e:
print "Service did not process request: %s"%str(e)
except rospy.ServiceException as e:
print("Service did not process request: %s"%str(e))


8 changes: 4 additions & 4 deletions pr2_gazebo/test/collisions/slide.world
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@
<static>true</static>
<link name="endbin_body">
<collision name="endbin_body_collision">
<pose> -6.0 0.0 2.6 -1.5708 0.0 1.5708</pose>
<pose> -6.0 0.0 1.6 -1.5708 0.0 1.5708</pose>
<geometry>
<mesh>
<scale>4 2 4</scale>
<scale>5 2 5</scale>
<uri>model://Media/models/slide_endbin.stl</uri>
</mesh>
</geometry>
Expand All @@ -158,10 +158,10 @@
</surface>
</collision>
<visual name="endbin_body_visual">
<pose> -6.0 0.0 2.6 -1.5708 0.0 1.5708</pose>
<pose> -6.0 0.0 1.6 -1.5708 0.0 1.5708</pose>
<geometry>
<mesh>
<scale>4 2 4</scale>
<scale>5 2 5</scale>
<uri>model://Media/models/slide_endbin.stl</uri>
</mesh>
</geometry>
Expand Down
2 changes: 1 addition & 1 deletion pr2_gazebo/test/collisions/test_slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def positionInput(self, p3d):


def test_slide(self):
print "LINK\n"
print("LINK\n")
rospy.Subscriber("/base_pose_ground_truth", Odometry, self.positionInput)
rospy.init_node(NAME, anonymous=True)
timeout_t = time.time() + TEST_DURATION
Expand Down
6 changes: 3 additions & 3 deletions pr2_gazebo/test/mechanism_controllers/my_hztest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ def Input(self, msg):

if not self.started:
self.start_time = rospy.get_rostime().to_sec()
print " got first message at: ",self.start_time, " sec"
print(" got first message at: ",self.start_time, " sec")
self.started = True

if self.count >= MIN_MSGS:
self.end_time = rospy.get_rostime().to_sec()
print " passed minimum ",self.count," messages at ",self.count / (self.end_time - self.start_time), " Hz"
print(" passed minimum ",self.count," messages at ",self.count / (self.end_time - self.start_time), " Hz")
self.success = True
#else:
#print " got ",self.count," messages at ",self.count / (rospy.get_rostime().to_sec() - self.start_time), " Hz"

def test_hz(self):
print "LNK\n"
print("LNK\n")
#rospy.Subscriber("/tf", tfMessage, self.Input)
rospy.Subscriber("/mechanism_state", MechanismState, self.Input)
rospy.init_node(NAME, anonymous=True)
Expand Down
42 changes: 21 additions & 21 deletions pr2_gazebo/test/mechanism_controllers/test_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ def __init__(self, *args):


def printP3D(self, p3d):
print "pose ground truth received"
print "P3D pose translan: " + "x: " + str(p3d.pose.pose.position.x)
print " " + "y: " + str(p3d.pose.pose.position.y)
print " " + "z: " + str(p3d.pose.pose.position.z)
print "P3D pose rotation: " + "x: " + str(p3d.pose.pose.orientation.x)
print " " + "y: " + str(p3d.pose.pose.orientation.y)
print " " + "z: " + str(p3d.pose.pose.orientation.z)
print " " + "w: " + str(p3d.pose.pose.orientation.w)
print "P3D rate translan: " + "x: " + str(p3d.twist.twist.linear.x)
print " " + "y: " + str(p3d.twist.twist.linear.y)
print " " + "z: " + str(p3d.twist.twist.linear.z)
print "P3D rate rotation: " + "x: " + str(p3d.twist.twist.angular.x)
print " " + "y: " + str(p3d.twist.twist.angular.y)
print " " + "z: " + str(p3d.twist.twist.angular.z)
print("pose ground truth received")
print("P3D pose translan: " + "x: " + str(p3d.pose.pose.position.x))
print(" " + "y: " + str(p3d.pose.pose.position.y))
print(" " + "z: " + str(p3d.pose.pose.position.z))
print("P3D pose rotation: " + "x: " + str(p3d.pose.pose.orientation.x))
print(" " + "y: " + str(p3d.pose.pose.orientation.y))
print(" " + "z: " + str(p3d.pose.pose.orientation.z))
print(" " + "w: " + str(p3d.pose.pose.orientation.w))
print("P3D rate translan: " + "x: " + str(p3d.twist.twist.linear.x))
print(" " + "y: " + str(p3d.twist.twist.linear.y))
print(" " + "z: " + str(p3d.twist.twist.linear.z))
print("P3D rate rotation: " + "x: " + str(p3d.twist.twist.angular.x))
print(" " + "y: " + str(p3d.twist.twist.angular.y))
print(" " + "z: " + str(p3d.twist.twist.angular.z))

def fngrP3dInput(self, p3d):
i = 0
Expand All @@ -130,13 +130,13 @@ def fngrP3dInput(self, p3d):
abs( rot_euler[1] ) + \
abs( rot_euler[2] )

print " fngr Error pos: " + str(pos_error) + " rot: " + str(rot_error)
print(" fngr Error pos: " + str(pos_error) + " rot: " + str(rot_error))

#self.printP3D(p3d) #for getting new valid data

# has to reach target vw and maintain target vw for a duration of TARGET_DURATION seconds
if self.reached_target_fngr:
print " fngr duration: " + str(time.time() - self.duration_start_fngr)
print(" fngr duration: " + str(time.time() - self.duration_start_fngr))
if rot_error < ROT_TARGET_TOL and pos_error < POS_TARGET_TOL:
if time.time() - self.duration_start_fngr > TARGET_DURATION:
self.fngr_success = True
Expand All @@ -146,7 +146,7 @@ def fngrP3dInput(self, p3d):
self.reached_target_fngr = False
else:
if rot_error < ROT_TARGET_TOL and pos_error < POS_TARGET_TOL:
print 'success finger'
print('success finger')
self.reached_target_fngr = True
self.duration_start_fngr = time.time()

Expand Down Expand Up @@ -175,13 +175,13 @@ def palmP3dInput(self, p3d):
abs( rot_euler[1] ) + \
abs( rot_euler[2] )

print " palm Error pos: " + str(pos_error) + " rot: " + str(rot_error)
print(" palm Error pos: " + str(pos_error) + " rot: " + str(rot_error))

#self.printP3D(p3d) #for getting new valid data

# has to reach target vw and maintain target vw for a duration of TARGET_DURATION seconds
if self.reached_target_palm: # tracking started
print " palm duration: " + str(time.time() - self.duration_start_palm)
print(" palm duration: " + str(time.time() - self.duration_start_palm))
if rot_error < ROT_TARGET_TOL and pos_error < POS_TARGET_TOL:
if time.time() - self.duration_start_palm > TARGET_DURATION:
self.palm_success = True
Expand All @@ -191,12 +191,12 @@ def palmP3dInput(self, p3d):
self.reached_target_palm = False
else:
if rot_error < ROT_TARGET_TOL and pos_error < POS_TARGET_TOL:
print 'success palm'
print('success palm')
self.reached_target_palm = True
self.duration_start_palm = time.time()

def test_arm(self):
print "LNK\n"
print("LNK\n")
pub_gripper = rospy.Publisher("/l_gripper_position_controller/command", Float64)
rospy.Subscriber("/l_gripper_palm_pose_ground_truth", Odometry, self.palmP3dInput)
rospy.Subscriber("/l_gripper_l_finger_pose_ground_truth", Odometry, self.fngrP3dInput)
Expand Down
Loading

0 comments on commit be6fbe0

Please sign in to comment.