Robowflex  v0.1
Making MoveIt Easy
resources_visualization.cpp
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
7 
8 using namespace robowflex;
9 
10 /** \file
11  * A helper script to visualize all the robots available in robowflex_resources, see
12  * https://github.com/KavrakiLab/robowflex_resources. You should run RViz and have a PlanningScene
13  * visualization display enabled set to look at /robowflex/robot_description. Enable/Disable the PlanningScene
14  * display after running the script with a robot to see it displayed.
15  *
16  * Currently, the robots available are the Fetch, UR5, Panda, Baxter, and YuMi. See output for details.
17  */
18 
19 // Fetch robot
20 const std::string FETCH[4] = {
21  "package://robowflex_resources/fetch/robots/fetch.urdf", // urdf
22  "package://robowflex_resources/fetch/config/fetch.srdf", // srdf
23  "package://robowflex_resources/fetch/config/joint_limits.yaml", // joint limits
24  "package://robowflex_resources/fetch/config/kinematics.yaml" // kinematics
25 };
26 
27 // UR5 with Robotiq 85 Gripper on a table
28 const std::string UR5[4] = {
29  "package://robowflex_resources/ur/robots/ur5_robotiq_robot_limited.urdf.xacro", // urdf
30  "package://robowflex_resources/ur/config/ur5/ur5_robotiq85_table.srdf.xacro", // srdf
31  "package://robowflex_resources/ur/config/ur5/joint_limits.yaml", // joint limits
32  "package://robowflex_resources/ur/config/ur5/kinematics.yaml" // kinematics
33 };
34 
35 // Franka Emika Panda robot with hand
36 const std::string PANDA[4] = {
37  "package://robowflex_resources/panda/urdf/panda.urdf", // urdf
38  "package://robowflex_resources/panda/config/panda.srdf", // srdf
39  "package://robowflex_resources/panda/config/joint_limits.yaml", // joint limits
40  "package://robowflex_resources/panda/config/kinematics.yaml" // kinematics
41 };
42 
43 // Rethink Robotics Baxter
44 const std::string BAXTER[4] = {
45  "package://robowflex_resources/baxter/urdf/baxter.urdf.xacro", // urdf
46  "package://robowflex_resources/baxter/config/baxter.srdf", // srdf
47  "package://robowflex_resources/baxter/config/joint_limits.yaml", // joint limits
48  "package://robowflex_resources/baxter/config/kinematics.yaml" // kinematics
49 };
50 
51 // ABB YuMi (IRB 14000)
52 const std::string YUMI[4] = {
53  "package://robowflex_resources/yumi/urdf/yumi.urdf", // urdf
54  "package://robowflex_resources/yumi/config/yumi.srdf", // srdf
55  "package://robowflex_resources/yumi/config/joint_limits.yaml", // joint limits
56  "package://robowflex_resources/yumi/config/kinematics.yaml" // kinematics
57 };
58 
59 // KUKA Robot with mounted Shadowhand Gripper
60 const std::string SHADOWHAND[4] = {
61  "package://robowflex_resources/shadowhand/urdf/shadowhand.urdf", // urdf
62  "package://robowflex_resources/shadowhand/config/shadowhand.srdf", // srdf
63  "package://robowflex_resources/shadowhand/config/joint_limits.yaml", // joint limits
64  "package://robowflex_resources/shadowhand/config/kinematics.yaml" // kinematics
65 };
66 
67 int main(int argc, char **argv)
68 {
69  // Startup ROS
70  ROS ros(argc, argv);
71 
72  if (argc != 2)
73  RBX_FATAL("Specify robot to load as an argument "
74  "(e.g., `rosrun robowflex_library resources_visualization <robot>`). "
75  "Can be {baxter, ur5, panda, fetch, yumi, shadowhand}.");
76 
77  const auto name = std::string(argv[1]);
78 
79  // Create an empty robot.
80  const auto &robot = std::make_shared<Robot>(name);
81 
82  // Initialize robot from argument.
83  if (name == "fetch")
84  robot->initialize(FETCH[0], FETCH[1], FETCH[2], FETCH[3]);
85  else if (name == "ur5")
86  robot->initialize(UR5[0], UR5[1], UR5[2], UR5[3]);
87  else if (name == "panda")
88  robot->initialize(PANDA[0], PANDA[1], PANDA[2], PANDA[3]);
89  else if (name == "baxter")
90  robot->initialize(BAXTER[0], BAXTER[1], BAXTER[2], BAXTER[3]);
91  else if (name == "yumi")
92  robot->initialize(YUMI[0], YUMI[1], YUMI[2], YUMI[3]);
93  else if (name == "shadowhand")
94  robot->initialize(SHADOWHAND[0], SHADOWHAND[1], SHADOWHAND[2], SHADOWHAND[3]);
95  else
96  RBX_FATAL("Unknown robot. Can be {baxter, ur5, panda, fetch, yumi, shadowhand}.");
97 
98  // Create an RViz visualization helper. Publishes all topics and parameter under `/robowflex` by default.
99  IO::RVIZHelper rviz(robot);
100 
101  RBX_INFO("Press enter to exit.");
102  std::cin.ignore();
103 
104  return 0;
105 }
RVIZ visualization helper. See Live Visualization with RViz for more information.
Definition: visualization.h:38
RAII-pattern for starting up ROS.
Definition: util.h:52
#define RBX_INFO(fmt,...)
Output a info logging message.
Definition: log.h:118
#define RBX_FATAL(fmt,...)
Output a fatal logging message.
Definition: log.h:94
Functions for loading and animating robots in Blender.
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
int main(int argc, char **argv)
const std::string BAXTER[4]
const std::string FETCH[4]
const std::string SHADOWHAND[4]
const std::string UR5[4]
const std::string YUMI[4]
const std::string PANDA[4]