simulation_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Mohamad Ayman.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * The name of Mohamad Ayman may not be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *********************************************************************/
33 
34 /* Author: Mohamad Ayman */
35 
36 #pragma once
37 
38 // Qt
39 class QLabel;
40 class QTextEdit;
41 class QPushButton;
42 
43 // SA
44 #ifndef Q_MOC_RUN
46 #endif
47 
48 #include "setup_screen_widget.h" // a base class for screens in the setup assistant
49 
50 namespace moveit_setup_assistant
51 {
52 // ******************************************************************************************
53 // ******************************************************************************************
54 // Class for showing changes needed to help user bring his robot into gazebo simulation
55 // ******************************************************************************************
56 // ******************************************************************************************
58 {
59  Q_OBJECT
60 
61 public:
62  // ******************************************************************************************
63  // Public Functions
64  // ******************************************************************************************
65 
66  SimulationWidget(QWidget* parent, const MoveItConfigDataPtr& config_data);
67  void focusGiven() override;
68  bool focusLost() override;
69 
70 private:
72  std::string generateGazeboCompatibleURDF() const;
73 
74 private Q_SLOTS:
75  // ******************************************************************************************
76  // Slot Event Functions
77  // ******************************************************************************************
78 
80  void setDirty(bool dirty = true);
82  void overwriteURDF();
84  void openURDF();
86  void copyURDF();
87 
88 private:
89  // ******************************************************************************************
90  // Qt Components
91  // ******************************************************************************************
92 
93  QTextEdit* simulation_text_;
95  QPushButton* btn_overwrite_;
96  QPushButton* btn_open_;
97  QLabel* copy_urdf_;
98 
100  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
101 };
102 
103 } // namespace moveit_setup_assistant
moveit_setup_assistant::SimulationWidget::copy_urdf_
QLabel * copy_urdf_
Definition: simulation_widget.h:97
moveit_setup_assistant::SimulationWidget::focusGiven
void focusGiven() override
function called when widget is activated, allows to update/initialize GUI
Definition: simulation_widget.cpp:177
moveit_setup_assistant::SimulationWidget::overwriteURDF
void overwriteURDF()
Overwrite original URDF with content of document.
Definition: simulation_widget.cpp:237
moveit_setup_assistant::SimulationWidget::no_changes_label_
QLabel * no_changes_label_
Definition: simulation_widget.h:94
moveit_setup_assistant::SimulationWidget
Definition: simulation_widget.h:57
moveit_setup_assistant::SimulationWidget::setDirty
void setDirty(bool dirty=true)
Mark document as changed.
Definition: simulation_widget.cpp:168
moveit_config_data.h
moveit_setup_assistant::SimulationWidget::btn_open_
QPushButton * btn_open_
Definition: simulation_widget.h:96
moveit_setup_assistant::SimulationWidget::SimulationWidget
SimulationWidget(QWidget *parent, const MoveItConfigDataPtr &config_data)
Definition: simulation_widget.cpp:92
moveit_setup_assistant::SimulationWidget::openURDF
void openURDF()
Open original URDF with system editor.
Definition: simulation_widget.cpp:252
moveit_setup_assistant::SimulationWidget::copyURDF
void copyURDF()
Copy the content of the URDF document to the clipboard.
Definition: simulation_widget.cpp:265
SetupScreenWidget
Definition: setup_screen_widget.h:44
moveit_setup_assistant::SimulationWidget::config_data_
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
Definition: simulation_widget.h:100
moveit_setup_assistant
Definition: compute_default_collisions.h:46
moveit_setup_assistant::SimulationWidget::simulation_text_
QTextEdit * simulation_text_
Definition: simulation_widget.h:93
setup_screen_widget.h
moveit_setup_assistant::SimulationWidget::focusLost
bool focusLost() override
function called when widget lost focus, allows to accept/reject changes and to reject switching (retu...
Definition: simulation_widget.cpp:209
moveit_setup_assistant::SimulationWidget::btn_overwrite_
QPushButton * btn_overwrite_
Definition: simulation_widget.h:95
moveit_setup_assistant::SimulationWidget::generateGazeboCompatibleURDF
std::string generateGazeboCompatibleURDF() const
Generate Gazebo-compatible URDF, starting from original URDF.
Definition: simulation_widget.cpp:272


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04