Skip to content

Commit

Permalink
Feature cmn joint type (#100)
Browse files Browse the repository at this point in the history
* moved prmJointType to cmnJointType, removed prmTransformations, updated cisstRobot to use cmnJointType

* Fixed circular checks that prevented use of $<TARGET_FILE:cisstDataGenerator> in cisstCommon
  • Loading branch information
adeguet1 authored Apr 26, 2024
1 parent 9893545 commit 4f1a7f2
Show file tree
Hide file tree
Showing 34 changed files with 359 additions and 1,916 deletions.
10 changes: 6 additions & 4 deletions cisstCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#
#
# (C) Copyright 2005-2012 Johns Hopkins University (JHU), All Rights
# Reserved.
# (C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand All @@ -14,8 +12,12 @@
# All cisstCommon libraries
project (cisstCommonLibs)

# cisstDataGenerator must be compiled first
if (NOT CMAKE_CROSSCOMPILING)
add_subdirectory (applications/cisstDataGenerator)
endif()

add_subdirectory (code)
add_subdirectory (applications)

cisst_offer_python (cisstCommon)
cisst_offer_tests_python (cisstCommon)
Expand Down
9 changes: 1 addition & 8 deletions cisstCommon/applications/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#
#
# (C) Copyright 2005-2011 Johns Hopkins University (JHU), All Rights
# Reserved.
# (C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand All @@ -13,8 +11,3 @@

# All cisstCommon applications
project (cisstCommonApplications)

# data generator should always be compiled so we don't use cisst_offer_application
if (NOT CMAKE_CROSSCOMPILING)
add_subdirectory (cisstDataGenerator)
endif (NOT CMAKE_CROSSCOMPILING)
4 changes: 3 additions & 1 deletion cisstCommon/applications/cisstDataGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- Mode: CMAKE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ex: set filetype=cmake softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab:
#
# (C) Copyright 2010-2015 Johns Hopkins University (JHU), All Rights Reserved.
# (C) Copyright 2010-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand Down Expand Up @@ -81,3 +81,5 @@ add_dependencies (cisstDataGenerator cisstRevision)
install (TARGETS cisstDataGenerator
COMPONENT cisstCommon
RUNTIME DESTINATION bin)


67 changes: 67 additions & 0 deletions cisstCommon/cmnJointType.cdg
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab:

inline-header {

#include <cisstCommon/cmnUnits.h>

// Always include last
#include <cisstCommon/cmnExport.h>
}

enum {
name cmnJointType;
attribute CISST_EXPORT;
prefix CMN_JOINT_;

enum-value {
name UNDEFINED;
description undefined;
}
enum-value {
name PRISMATIC;
description prismatic joint;
}
enum-value {
name REVOLUTE;
description revolute joint;
}
enum-value {
name UNIVERSAL;
description universal joint;
}
enum-value {
name BALL_SOCKET;
description ball and socket;
}
enum-value {
name INACTIVE;
description inactive;
}
}


inline-header {

template <template<class> class _vector_type>
void cmnJointTypeToFactor(const _vector_type<cmnJointType> & types,
const double prismaticFactor,
const double revoluteFactor,
_vector_type<double> & factors)
{
// set unitFactor;
for (size_t i = 0; i < types.size(); i++) {
switch (types.at(i)) {
case CMN_JOINT_PRISMATIC:
factors.at(i) = prismaticFactor;
break;
case CMN_JOINT_REVOLUTE:
factors.at(i) = revoluteFactor;
break;
default:
factors.at(i) = 1.0;
break;
}
}
}
} // inline-header
20 changes: 17 additions & 3 deletions cisstCommon/code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# (C) Copyright 2003-2020 Johns Hopkins University (JHU), All Rights Reserved.
# (C) Copyright 2003-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand All @@ -11,6 +11,13 @@

project (cisstCommon)

# create data type using the data generator
cisst_data_generator (cisstCommon
"${cisst_BINARY_DIR}/include" # where to save the file
"cisstCommon/" # sub directory for include
../cmnJointType.cdg
)

# all source files
set (SOURCE_FILES
cmnClassRegister.cpp
Expand Down Expand Up @@ -104,9 +111,16 @@ cisst_add_library (
LIBRARY cisstCommon
FOLDER cisstCommon
SOURCE_FILES ${SOURCE_FILES}
HEADER_FILES ${HEADER_FILES})
HEADER_FILES ${HEADER_FILES}
ADDITIONAL_SOURCE_FILES ${cisstCommon_CISST_DG_SRCS}
ADDITIONAL_HEADER_FILES_RELATIVE ${cisstCommon_CISST_DG_HDRS}
)

add_dependencies (cisstCommon cisstRevision cisstBuildType)
add_dependencies (cisstCommon cisstRevision cisstBuildType cisstDataGenerator)

install (
FILES ${cisstCommon_CISST_DG_HDRS_FULLPATH}
DESTINATION "include/cisstCommon")

if (CISST_HAS_JSON)
if (NOT JSON_USE_SYSTEM_VERSION)
Expand Down
162 changes: 78 additions & 84 deletions cisstParameterTypes/cisstParameterTypes.i
Original file line number Diff line number Diff line change
@@ -1,84 +1,78 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */

/*
Author(s): Anton Deguet
Created on: 2009-01-26
(C) Copyright 2006-2024 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
This software is provided "as is" under an open source license, with
no warranty. The complete license can be found in license.txt and
http://www.cisst.org/cisst/license.txt.
--- end cisst license ---
*/


%module cisstParameterTypesPython


%include "std_string.i"
%include "std_vector.i"
%include "std_map.i"
%include "std_pair.i"
%include "std_streambuf.i"
%include "std_iostream.i"

%include "swigrun.i"

%import "cisstConfig.h"

%import "cisstCommon/cisstCommon.i"
%import "cisstVector/cisstVector.i"
%import "cisstMultiTask/cisstMultiTask.i"

%init %{
import_array() // numpy initialization
%}

%header %{
#include <cisstParameterTypes/prmPython.h>
%}

// Generate parameter documentation for IRE
%feature("autodoc", "1");

#define CISST_EXPORT
#define CISST_DEPRECATED

// Import file with macros and typedefs
%import "cisstMultiTask/mtsMacros.h"

// Wrap base type
%include "cisstParameterTypes/prmMotionBase.h"

// Wrap all others
%include "cisstParameterTypes/prmEventButton.h"

%include "cisstParameterTypes/prmPositionCartesianGet.h"
%include "cisstParameterTypes/prmPositionCartesianSet.h"
%include "cisstParameterTypes/prmVelocityCartesianGet.h"
%include "cisstParameterTypes/prmVelocityCartesianSet.h"
%include "cisstParameterTypes/prmForceCartesianGet.h"
%include "cisstParameterTypes/prmForceCartesianSet.h"

%include "cisstParameterTypes/prmPositionJointGet.h"
%include "cisstParameterTypes/prmPositionJointSet.h"
%include "cisstParameterTypes/prmVelocityJointGet.h"
%include "cisstParameterTypes/prmVelocityJointSet.h"

%include "cisstParameterTypes/prmTransformationBase.h"
%include "cisstParameterTypes/prmTransformationManager.h"
%include "cisstParameterTypes/prmTransformationDynamic.h"
%include "cisstParameterTypes/prmTransformationFixed.h"

%include "cisstParameterTypes/prmRobotState.h"

%include "cisstParameterTypes/prmStateJoint.h"
%include "cisstParameterTypes/prmConfigurationJoint.h"
%include "cisstParameterTypes/prmOperatingState.h"
%include "cisstParameterTypes/prmActuatorState.h"
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */

/*
Author(s): Anton Deguet
Created on: 2009-01-26
(C) Copyright 2006-2024 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
This software is provided "as is" under an open source license, with
no warranty. The complete license can be found in license.txt and
http://www.cisst.org/cisst/license.txt.
--- end cisst license ---
*/


%module cisstParameterTypesPython


%include "std_string.i"
%include "std_vector.i"
%include "std_map.i"
%include "std_pair.i"
%include "std_streambuf.i"
%include "std_iostream.i"

%include "swigrun.i"

%import "cisstConfig.h"

%import "cisstCommon/cisstCommon.i"
%import "cisstVector/cisstVector.i"
%import "cisstMultiTask/cisstMultiTask.i"

%init %{
import_array() // numpy initialization
%}

%header %{
#include <cisstParameterTypes/prmPython.h>
%}

// Generate parameter documentation for IRE
%feature("autodoc", "1");

#define CISST_EXPORT
#define CISST_DEPRECATED

// Import file with macros and typedefs
%import "cisstMultiTask/mtsMacros.h"

// Wrap base type
%include "cisstParameterTypes/prmMotionBase.h"

// Wrap all others
%include "cisstParameterTypes/prmEventButton.h"

%include "cisstParameterTypes/prmPositionCartesianGet.h"
%include "cisstParameterTypes/prmPositionCartesianSet.h"
%include "cisstParameterTypes/prmVelocityCartesianGet.h"
%include "cisstParameterTypes/prmVelocityCartesianSet.h"
%include "cisstParameterTypes/prmForceCartesianGet.h"
%include "cisstParameterTypes/prmForceCartesianSet.h"

%include "cisstParameterTypes/prmPositionJointGet.h"
%include "cisstParameterTypes/prmPositionJointSet.h"
%include "cisstParameterTypes/prmVelocityJointGet.h"
%include "cisstParameterTypes/prmVelocityJointSet.h"

%include "cisstParameterTypes/prmRobotState.h"

%include "cisstParameterTypes/prmStateJoint.h"
%include "cisstParameterTypes/prmConfigurationJoint.h"
%include "cisstParameterTypes/prmOperatingState.h"
%include "cisstParameterTypes/prmActuatorState.h"
13 changes: 1 addition & 12 deletions cisstParameterTypes/code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# (C) Copyright 2003-2023 Johns Hopkins University (JHU), All Rights Reserved.
# (C) Copyright 2003-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand Down Expand Up @@ -34,7 +34,6 @@ cisst_data_generator (cisstParameterTypes
../prmForwardKinematicsResponse.cdg
../prmInverseKinematicsRequest.cdg
../prmInverseKinematicsResponse.cdg
../prmJointType.cdg
)

# to compile cisst generated code, need to find header file
Expand All @@ -53,11 +52,6 @@ set (SOURCE_FILES
prmForceCartesianGet.cpp
prmForceCartesianSet.cpp

prmTransformationBase.cpp
prmTransformationFixed.cpp
prmTransformationDynamic.cpp
prmTransformationManager.cpp

prmActuatorState.cpp
prmRobotState.cpp
prmActuatorParameters.cpp
Expand All @@ -82,11 +76,6 @@ set (HEADER_FILES
prmForceCartesianGet.h
prmForceCartesianSet.h

prmTransformationBase.h
prmTransformationFixed.h
prmTransformationDynamic.h
prmTransformationManager.h

prmMaskedVector.h
prmActuatorState.h
prmRobotState.h
Expand Down
Loading

0 comments on commit 4f1a7f2

Please sign in to comment.