Skip to content

Commit

Permalink
Merge branch 'release/1.4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbusy committed Dec 30, 2022
2 parents afbb935 + 6706f0e commit 75c3669
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "qiBullet"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.4.5
PROJECT_NUMBER = 1.4.6

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion qibullet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
from qibullet.ros_wrapper import PepperRosWrapper

name = 'qibullet'
__version__ = "1.4.5"
__version__ = "1.4.6"
5 changes: 3 additions & 2 deletions qibullet/nao_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ def setAngles(self, joint_names, joint_values, percentage_speed):
containing the name of the joints to be controlled
joint_values - List of values (or value if only one joint)
corresponding to the angles in radians to be applied
percentage_speed - Percentage (or percentages) of the max speed to
be used for the movement
percentage_speed - Percentages of the max speed to be used for
each joint, has to be strictly superior to 0 and inferior or equal
to 1
"""
try:
if type(joint_names) is str:
Expand Down
5 changes: 3 additions & 2 deletions qibullet/pepper_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ def setAngles(self, joint_names, joint_values, percentage_speed):
containing the name of the joints to be controlled
joint_values - List of values (or value if only one joint)
corresponding to the angles in radians to be applied
percentage_speed - Percentage (or percentages) of the max speed to
be used for the movement
percentage_speed - Percentages of the max speed to be used for
each joint, has to be strictly superior to 0 and inferior or equal
to 1
"""
try:
if type(joint_names) is str:
Expand Down
11 changes: 10 additions & 1 deletion qibullet/robot_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from qibullet.camera import *
from qibullet.link import Link
from qibullet.joint import Joint
from qibullet.tools import isNan

IS_VERSION_PYTHON_3 = sys.version_info[0] >= 3

Expand Down Expand Up @@ -124,7 +125,11 @@ def getLink(self, link_name):
def setAngles(self, joint_names, joint_values, percentage_speeds):
"""
Set angles on the robot's joints. Tests have to be performed by the
child class to guarantee the validity of the input parameters.
child class to guarantee the validity of the input parameters. If one
of the specified joint values or percentage speed is a NaN, a pybullet
error will be raised. Aditionally, if the joint_names, joint_values or
percentage_speeds don't have the same size, a pybullet error will be
raised
Parameters:
joint_names - List of string containing the name of the joints
Expand All @@ -150,6 +155,10 @@ def setAngles(self, joint_names, joint_values, percentage_speeds):
joint_names,
joint_values,
percentage_speeds):

if isNan(joint_value):
raise pybullet.error(
"Joint value specified for " + joint_name + " is a NaN")

joint_speed =\
self.joint_dict[joint_name].getMaxVelocity() *\
Expand Down
5 changes: 3 additions & 2 deletions qibullet/romeo_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ def setAngles(self, joint_names, joint_values, percentage_speed):
containing the name of the joints to be controlled
joint_values - List of values (or value if only one joint)
corresponding to the angles in radians to be applied
percentage_speed - Percentage (or percentages) of the max speed to
be used for the movement
percentage_speed - Percentages of the max speed to be used for
each joint, has to be strictly superior to 0 and inferior or equal
to 1
"""
try:
if type(joint_names) is str:
Expand Down
13 changes: 13 additions & 0 deletions qibullet/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ def computeVelocity(acc, vel_min, vel_max, dist_traveled, dist_remained):
return vel_computed


def isNan(number):
"""
Check if a number is a NaN.
Args:
number (float, int): The number variable to be tested
Returns:
bool: True if the variable is a NaN, false otherwise
"""
return number != number


def _get_resources_root_folder(): # pragma: no cover
"""
Returns the path to the resources' root folder (.qibullet folder in the
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def run(self):

setuptools.setup(
name="qibullet",
version="1.4.5",
version="1.4.6",
author="Maxime Busy, Maxime Caniot",
author_email="",
description="Bullet-based simulation for SoftBank Robotics' robots",
Expand Down Expand Up @@ -127,6 +127,5 @@ def run(self):
"Operating System :: Microsoft",
'Topic :: Games/Entertainment :: Simulation',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Framework :: Robot Framework :: Tool'
]
)
5 changes: 5 additions & 0 deletions tests/joint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def test_set_angles(self):
with self.assertRaises(pybullet.error):
JointTest.robot.setAngles("HeadRoll", "wrong", 0.5)
JointTest.robot.setAngles(["HeadRoll", "HeadPitch"], 2, 0.5)
JointTest.robot.setAngles("HeadPitch", float("NaN"), 0.5)
JointTest.robot.setAngles(
["HeadRoll", "HeadPitch"],
[float("NaN"), 0.5],
0.5)

for i in range(iterations):
angles = list()
Expand Down

0 comments on commit 75c3669

Please sign in to comment.