-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
manipulation_station_hardware_interface.h
95 lines (83 loc) · 2.91 KB
/
manipulation_station_hardware_interface.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "drake/lcm/drake_lcm.h"
#include "drake/lcm/drake_lcm_interface.h"
#include "drake/multibody/plant/multibody_plant.h"
#include "drake/systems/framework/diagram.h"
#include "drake/systems/lcm/lcm_subscriber_system.h"
namespace drake {
namespace examples {
namespace manipulation_station {
/// A System that connects via message-passing to the hardware manipulation
/// station.
///
/// Note: Users must call Connect() after initialization.
///
/// @{
///
/// @system
/// name: ManipulationStationHardwareInterface
/// input_ports:
/// - iiwa_position
/// - iiwa_feedforward_torque
/// - wsg_position
/// - wsg_force_limit (optional)
/// output_ports:
/// - iiwa_position_commanded
/// - iiwa_position_measured
/// - iiwa_velocity_estimated
/// - iiwa_torque_commanded
/// - iiwa_torque_measured
/// - iiwa_torque_external
/// - wsg_state_measured
/// - wsg_force_measured
/// - camera_[NAME]_rgb_image
/// - camera_[NAME]_depth_image
/// - ...
/// - camera_[NAME]_rgb_image
/// - camera_[NAME]_depth_image
/// @endsystem
///
/// @ingroup manipulation_station_systems
/// @}
///
class ManipulationStationHardwareInterface : public systems::Diagram<double> {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(ManipulationStationHardwareInterface)
/// Subscribes to an incoming camera message on the channel
/// DRAKE_RGBD_CAMERA_IMAGES_<camera_id>
/// where @p camera_name contains the names/unique ids, typically serial
/// numbers, and declares the output ports camera_%s_rgb_image and
/// camera_%s_depth_image, where %s is the camera name.
ManipulationStationHardwareInterface(
std::vector<std::string> camera_names = {});
/// Starts a thread to receive network messages, and blocks execution until
/// the first messages have been received.
void Connect(bool wait_for_cameras = true);
/// For parity with ManipulationStation, we maintain a MultibodyPlant of
/// the IIWA arm, with the lumped-mass equivalent spatial inertia of the
/// Schunk WSG gripper.
// TODO(russt): Actually add the equivalent mass of the WSG.
const multibody::MultibodyPlant<double>& get_controller_plant() const {
return *owned_controller_plant_;
}
const std::vector<std::string>& get_camera_names() const {
return camera_names_;
}
/// Gets the number of joints in the IIWA (only -- does not include the
/// gripper).
int num_iiwa_joints() const;
private:
std::unique_ptr<multibody::MultibodyPlant<double>> owned_controller_plant_;
std::unique_ptr<lcm::DrakeLcm> owned_lcm_;
systems::lcm::LcmSubscriberSystem* wsg_status_subscriber_;
systems::lcm::LcmSubscriberSystem* iiwa_status_subscriber_;
std::vector<systems::lcm::LcmSubscriberSystem*> camera_subscribers_;
const std::vector<std::string> camera_names_;
multibody::ModelInstanceIndex iiwa_model_instance_{};
};
} // namespace manipulation_station
} // namespace examples
} // namespace drake