Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B#171 handfinder ns #172

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions sr_utilities/test/test_hand_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void ASSERT_MAP_HAS_VALUE(const map<string, string> &map, const string &value)

TEST(SrHandFinder, hand_absent_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
Expand All @@ -77,18 +77,18 @@ TEST(SrHandFinder, hand_absent_test)

TEST(SrHandFinder, one_hand_no_robot_description_finder_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
{
ros::param::del("robot_description");
}

ros::param::set("hand/mapping/1", "right");
ros::param::set("hand/joint_prefix/1", "rh_");
ros::param::set("/hand/mapping/1", "right");
ros::param::set("/hand/joint_prefix/1", "rh_");

string ethercat_path = ros::package::getPath("sr_ethercat_hand_config");
const string joint_names[] =
Expand Down Expand Up @@ -166,18 +166,18 @@ TEST(SrHandFinder, one_hand_no_robot_description_finder_test)

TEST(SrHandFinder, one_hand_no_mapping_no_robot_description_finder_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
{
ros::param::del("robot_description");
}

ros::param::set("hand/mapping/1", "");
ros::param::set("hand/joint_prefix/1", "rh_");
ros::param::set("/hand/mapping/1", "");
ros::param::set("/hand/joint_prefix/1", "rh_");

string ethercat_path = ros::package::getPath("sr_ethercat_hand_config");
const string joint_names[] =
Expand Down Expand Up @@ -254,18 +254,18 @@ TEST(SrHandFinder, one_hand_no_mapping_no_robot_description_finder_test)

TEST(SrHandFinder, one_hand_no_prefix_no_robot_description_finder_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
{
ros::param::del("robot_description");
}

ros::param::set("hand/mapping/1", "rh");
ros::param::set("hand/joint_prefix/1", "");
ros::param::set("/hand/mapping/1", "rh");
ros::param::set("/hand/joint_prefix/1", "");

string ethercat_path = ros::package::getPath("sr_ethercat_hand_config");
const string joint_names[] =
Expand Down Expand Up @@ -342,18 +342,18 @@ TEST(SrHandFinder, one_hand_no_prefix_no_robot_description_finder_test)

TEST(SrHandFinder, one_hand_no_mapping_no_prefix_no_robot_description_finder_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
{
ros::param::del("robot_description");
}

ros::param::set("hand/mapping/1", "");
ros::param::set("hand/joint_prefix/1", "");
ros::param::set("/hand/mapping/1", "");
ros::param::set("/hand/joint_prefix/1", "");

string ethercat_path = ros::package::getPath("sr_ethercat_hand_config");
const string joint_names[] =
Expand Down Expand Up @@ -430,9 +430,9 @@ TEST(SrHandFinder, one_hand_no_mapping_no_prefix_no_robot_description_finder_tes

TEST(SrHandFinder, one_hand_robot_description_exists_finger_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
Expand All @@ -441,11 +441,11 @@ TEST(SrHandFinder, one_hand_robot_description_exists_finger_test)
}

string right_hand_description;
ros::param::get("right_hand_description", right_hand_description);
ros::param::get("/right_hand_description", right_hand_description);
ros::param::set("robot_description", right_hand_description);

ros::param::set("hand/mapping/1", "right");
ros::param::set("hand/joint_prefix/1", "rh_");
ros::param::set("/hand/mapping/1", "right");
ros::param::set("/hand/joint_prefix/1", "rh_");
string ethercat_path = ros::package::getPath("sr_ethercat_hand_config");
const string joint_names[] =
{
Expand Down Expand Up @@ -519,23 +519,23 @@ TEST(SrHandFinder, one_hand_robot_description_exists_finger_test)

TEST(SrHandFinder, two_hand_robot_description_exists_finder_test)
{
if (ros::param::has("hand"))
if (ros::param::has("/hand"))
{
ros::param::del("hand");
ros::param::del("/hand");
}

if (ros::param::has("robot_description"))
{
ros::param::del("robot_description");
}

ros::param::set("hand/mapping/1", "right");
ros::param::set("hand/joint_prefix/1", "rh_");
ros::param::set("hand/mapping/2", "left");
ros::param::set("hand/joint_prefix/2", "lh_");
ros::param::set("/hand/mapping/1", "right");
ros::param::set("/hand/joint_prefix/1", "rh_");
ros::param::set("/hand/mapping/2", "left");
ros::param::set("/hand/joint_prefix/2", "lh_");

string two_hands_description;
ros::param::get("two_hands_description", two_hands_description);
ros::param::get("/two_hands_description", two_hands_description);
ros::param::set("robot_description", two_hands_description);

const string joint_names[] =
Expand Down
108 changes: 54 additions & 54 deletions sr_utilities/test/test_hand_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class TestHandFinder(unittest.TestCase):
ethercat_path = rospack.get_path('sr_ethercat_hand_config')

def test_no_hand_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")
Expand All @@ -57,14 +57,14 @@ def test_no_hand_no_robot_description_finder(self):
"correct tuning without a hands")

def test_one_hand_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "right")
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "right")

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -102,14 +102,14 @@ def test_one_hand_no_robot_description_finder(self):
"incorrect controller config file")

def test_one_hand_no_mapping_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "")
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "")

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -148,14 +148,14 @@ def test_one_hand_no_mapping_no_robot_description_finder(self):
"incorrect controller config file")

def test_one_hand_no_prefix_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "")
rospy.set_param("hand/mapping/1", "rh")
rospy.set_param("/hand/joint_prefix/1", "")
rospy.set_param("/hand/mapping/1", "rh")

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -193,14 +193,14 @@ def test_one_hand_no_prefix_no_robot_description_finder(self):
"incorrect controller config file")

def test_one_hand_no_prefix_no_mapping_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "")
rospy.set_param("hand/mapping/1", "")
rospy.set_param("/hand/joint_prefix/1", "")
rospy.set_param("/hand/mapping/1", "")

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -238,16 +238,16 @@ def test_one_hand_no_prefix_no_mapping_no_robot_description_finder(self):
"incorrect controller config file")

def test_two_hand_no_robot_description_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "right")
rospy.set_param("hand/joint_prefix/2", "lh_")
rospy.set_param("hand/mapping/2", "left")
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "right")
rospy.set_param("/hand/joint_prefix/2", "lh_")
rospy.set_param("/hand/mapping/2", "left")

hand_finder = HandFinder(1.0)

Expand Down Expand Up @@ -312,13 +312,13 @@ def test_two_hand_no_robot_description_finder(self):
"incorrect controller config file")

def test_no_hand_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("robot_description", rospy.get_param("two_hands_description"))
rospy.set_param("robot_description", rospy.get_param("/two_hands_description"))

hand_finder = HandFinder(1.0)

Expand All @@ -333,15 +333,15 @@ def test_no_hand_robot_description_exists_finder(self):
"correct tuning without a hands")

def test_one_hand_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "right")
rospy.set_param("robot_description", rospy.get_param("right_hand_description"))
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "right")
rospy.set_param("robot_description", rospy.get_param("/right_hand_description"))

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -381,15 +381,15 @@ def test_one_hand_robot_description_exists_finder(self):
"incorrect controller config file")

def test_one_hand_no_mapping_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "")
rospy.set_param("robot_description", rospy.get_param("right_hand_description"))
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "")
rospy.set_param("robot_description", rospy.get_param("/right_hand_description"))

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -428,15 +428,15 @@ def test_one_hand_no_mapping_robot_description_exists_finder(self):
"incorrect controller config file")

def test_one_hand_no_prefix_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "")
rospy.set_param("hand/mapping/1", "rh")
rospy.set_param("robot_description", rospy.get_param("right_hand_description_no_prefix"))
rospy.set_param("/hand/joint_prefix/1", "")
rospy.set_param("/hand/mapping/1", "rh")
rospy.set_param("robot_description", rospy.get_param("/right_hand_description_no_prefix"))

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -475,15 +475,15 @@ def test_one_hand_no_prefix_robot_description_exists_finder(self):
"incorrect controller config file")

def test_one_hand_no_prefix_no_ns_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "")
rospy.set_param("hand/mapping/1", "")
rospy.set_param("robot_description", rospy.get_param("right_hand_description_no_prefix"))
rospy.set_param("/hand/joint_prefix/1", "")
rospy.set_param("/hand/mapping/1", "")
rospy.set_param("robot_description", rospy.get_param("/right_hand_description_no_prefix"))

hand_finder = HandFinder(1.0)
# hand params
Expand Down Expand Up @@ -522,17 +522,17 @@ def test_one_hand_no_prefix_no_ns_robot_description_exists_finder(self):
"incorrect controller config file")

def test_two_hand_robot_description_exists_finder(self):
if rospy.has_param("hand"):
rospy.delete_param("hand")
if rospy.has_param("/hand"):
rospy.delete_param("/hand")

if rospy.has_param("robot_description"):
rospy.delete_param("robot_description")

rospy.set_param("hand/joint_prefix/1", "rh_")
rospy.set_param("hand/mapping/1", "right")
rospy.set_param("hand/joint_prefix/2", "lh_")
rospy.set_param("hand/mapping/2", "left")
rospy.set_param("robot_description", rospy.get_param("two_hands_description"))
rospy.set_param("/hand/joint_prefix/1", "rh_")
rospy.set_param("/hand/mapping/1", "right")
rospy.set_param("/hand/joint_prefix/2", "lh_")
rospy.set_param("/hand/mapping/2", "left")
rospy.set_param("robot_description", rospy.get_param("/two_hands_description"))

hand_finder = HandFinder(1.0)
# hand params
Expand Down
Loading