File size: 2,028 Bytes
88237d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

if [ "$1" == "-h" -o "$2" == "-h" ]
then
 echo -e "\n\n      BUILD_DESC.SH\n"
 echo -e "   INSTRUCTIONS FOR USE\n   --------------------\n"
 echo -e "'build_desc.sh' can be called with up to two (2) arguments.\nThe first argument is the side of the hand, left or right, and\nthe second argument determines the use of a robot tree diagram.\n\n"
 echo -e "Examples:\n"
 echo -e "   $ bash build_desc.sh RIGHT 1\n   Builds the right hand URDF from its xacro file and shows the robot tree diagram when finished.\n"
 echo -e "   $ bash build_desc.sh left\n   Builds the left hand URDF from its xacro file and DOES NOT show the tree diagram.\n\n\n"
 echo -e "Possible variations of the 1st argument are:\n RIGHT, Right, right, R, r, LEFT, Left, left, L and l.\n"
 echo -e "For the 2nd argument, '1' produces the tree graph.\nLeft blank or passed any other value, the graph will not be created."
 echo -e "\n\n"
 exit 0
fi
	

if [ "$1" == "right" -o "$1" == "Right" -o "$1" == "RIGHT" -o "$1" == "R" -o "$1" == "r" ]
then
	HAND="RIGHT"
	hand="right"
elif [ "$1" == "left" -o "$1" == "Left" -o "$1" == "LEFT" -o "$1" == "L" -o "$1" == "l" ]
then
	HAND="LEFT"
	hand="left"
else
 echo -e "\n\nWrong or incorrect amount of arguments.\nUse 'bash build_desc.sh -h' for instructions.\n\n"
 echo -e "If you see an error like\n'[: 7: right: unexpected operator',\nuse 'bash build_desc.sh' instead of 'sh build_desc.sh'.\n\n"
 exit 0
fi


echo -e "\n\nBuilding the [[$HAND]] Allegro Hand URDF...\n"


rosrun xacro xacro.py allegro_hand_description_$hand.xacro -o allegro_hand_description_$hand.urdf

rosrun urdf check_urdf allegro_hand_description_$hand.urdf 

echo -e "\n"





if [ "$2" == "1" ] 
then
	rosrun urdf_parser urdf_to_graphiz allegro_hand_description_$hand.urdf 
	rm *.gv
	echo -e "Removed file allegro_hand_$hand.gv\n"
	echo -e "Opening graph pdf...\n\n"
	gnome-open allegro_hand_$hand.pdf
else
	echo -e "NOTE:\nTo open a graph of the hand upon URDF compilation,\nenter "1" as the second arg when calling 'bash build.sh'\n\n"
fi