Gazebo Sim

API Reference

9.3.0
Visualization.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18#ifndef GZ_SIM_SYSTEMS_OPTICAL_TACTILE_PLUGIN_VISUALIZATION_HH_
19#define GZ_SIM_SYSTEMS_OPTICAL_TACTILE_PLUGIN_VISUALIZATION_HH_
20
21#include <memory>
22#include <string>
23
24#include <gz/sim/config.hh>
25#include <gz/sim/System.hh>
26#include <gz/msgs/marker.pb.h>
27#include <gz/transport/Node.hh>
28
30
31namespace gz
32{
33namespace sim
34{
35// Inline bracket to help doxygen filtering.
36inline namespace GZ_SIM_VERSION_NAMESPACE {
37namespace systems
38{
39namespace optical_tactile_sensor
40{
41 // This class handles the configuration and process of visualizing the
42 // different elements needed for the Optical Tactile Sensor plugin.
43 // Terminology:
44 // "Contacts" refers to data from the contact sensor based on physics.
45 // "Normal forces" refers to post-processed data from the depth camera based
46 // purely on imagery.
47 // These two sets of data are currently disjoint and visualized separately.
49 {
57 std::string &_modelName,
58 gz::math::Vector3d &_sensorSize,
59 double &_forceLength,
60 float &_cameraUpdateRate,
61 gz::math::Pose3f &_depthCameraOffset);
62
66 private: void InitializeSensorMarkerMsg(
67 gz::msgs::Marker &_sensorMarkerMsg);
68
74 gz::math::Pose3f const &_sensorPose);
75
79 private: void InitializeContactsMarkerMsg(
80 gz::msgs::Marker &_contactsMarkerMsg);
81
87 gz::msgs::Contact const &_contact,
88 gz::msgs::Marker &_contactsMarkerMsg);
89
93 components::ContactSensorData const *_contacts);
94
100 private: void InitializeNormalForcesMarkerMsgs(
101 gz::msgs::Marker &_positionMarkerMsg,
102 gz::msgs::Marker &_forceMarkerMsg);
103
117 gz::msgs::Marker &_positionMarkerMsg,
118 gz::msgs::Marker &_forceMarkerMsg,
119 gz::math::Vector3f &_position,
120 gz::math::Vector3f &_normalForce,
121 gz::math::Pose3f &_sensorWorldPose);
122
130 gz::msgs::Marker &_positionMarkerMsg,
131 gz::msgs::Marker &_forceMarkerMsg);
132
135
137 private: gz::transport::Node node;
138
140 private: std::string modelName;
141
143 private: gz::math::Vector3d sensorSize;
144
146 private: double forceLength;
147
149 private: float cameraUpdateRate;
150
152 private: gz::math::Pose3f depthCameraOffset;
153
155 private: bool normalForcesMsgsAreInitialized{false};
156 };
157} // namespace optical_tactile_sensor
158} // namespace systems
159} // namespace GZ_SIM_VERSION_NAMESPACE
160} // namespace sim
161} // namespace gz
162
163#endif