Skip to content

Commit

Permalink
Merge pull request #105 from jhu-cisst/rc-1.3.1
Browse files Browse the repository at this point in the history
merge rc 1.3.1
  • Loading branch information
adeguet1 authored Jan 17, 2025
2 parents 32234ab + 75ec740 commit 2296798
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 15 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Change log
==========

1.3.1 (2025-01-17)
==================

* API changes:
* cisstRobot robManipulator: `LoadRobot` parses file name to identify .rob or .json format
* Deprecated features:
* None
* New features
* None
* Bug fixes:
* Missing includes for Ubuntu 24.04
* cisstCommon cmnPath: better handling absolute paths on Windows (#102)
* cisstMultiTask mtsManagerLocal: use PATH instead of LD_LIBRARY_PATH for dynamic loading on Windows
* cisstParameterTypes prmOperatingState: allow to enable in fault state

1.3.0 (2024-08-30)
==================
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## -*- Mode: CMAKE; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-

#
# (C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
# (C) Copyright 2005-2025 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
Expand All @@ -16,7 +16,7 @@
cmake_minimum_required (VERSION 3.10)

# cisst (Computer Integrated Surgical Systems and Technology)
project (cisst VERSION 1.3.0)
project (cisst VERSION 1.3.1)

# cisst compiler settings
include (cmake/cisstSettings.cmake)
Expand Down
21 changes: 18 additions & 3 deletions cisstCommon/code/cmnPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author(s): Anton Deguet
Created on: 2005-04-18
(C) Copyright 2005-2023 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 Down Expand Up @@ -139,9 +139,24 @@ std::string cmnPath::FindWithSubdirectory(const std::string & filename,
std::string fullName("");
const_iterator iter = Path.begin();
const const_iterator end = Path.end();
if (filename.empty()) {
CMN_LOG_CLASS_RUN_WARNING << "FindWithSubdirectory called with empty filename" << std::endl;
return filename;
}
bool isAbsolute = false;
#if (CISST_OS == CISST_WINDOWS)
size_t offset = 0;
// First, check for drive letter (e.g., "C:")
if ((filename.size() > 2) && (filename[1] == ':'))
offset = 2;
if ((filename[offset] == '/') || (filename[offset] == '\\'))
isAbsolute = true;
#else
if (filename[0] == '/')
isAbsolute = true;
#endif
// first check if this file exists as absolute path
if ((filename.size() > 0)
&& (filename[0] == '/')
if (isAbsolute
&& (access(filename.c_str(), mode) == 0)) {
CMN_LOG_CLASS_RUN_VERBOSE << "Found \"" << filename << "\", it seems to be a valid absolute file name" << std::endl;
return filename;
Expand Down
9 changes: 7 additions & 2 deletions cisstMultiTask/code/mtsManagerLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author(s): Min Yang Jung
Created on: 2009-12-07
(C) Copyright 2009-2020 Johns Hopkins University (JHU), All Rights Reserved.
(C) Copyright 2009-2024 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
Expand All @@ -20,6 +20,7 @@ no warranty. The complete license can be found in license.txt and

#include <cisstCommon/cmnThrow.h>
#include <cisstCommon/cmnPath.h>
#include <cisstCommon/cmnPortability.h>
#include <cisstOSAbstraction/osaSleep.h>
#include <cisstOSAbstraction/osaGetTime.h>
#include <cisstOSAbstraction/osaSocket.h>
Expand Down Expand Up @@ -905,15 +906,19 @@ mtsComponent * mtsManagerLocal::CreateComponentDynamicallyJSON(const std::string
{
// -1- try to dynamically load the library if specified
if (!sharedLibrary.empty()) {
// create load and path based on LD_LIBRARY_PATH
// create load and path based on LD_LIBRARY_PATH (or PATH on Windows)
osaDynamicLoader loader;
std::string fullPath;
// check if the file already exists, i.e. use provided a full path
if (cmnPath::Exists(sharedLibrary)) {
fullPath = sharedLibrary;
} else {
cmnPath path;
#if (CISST_OS == CISST_WINDOWS)
path.AddFromEnvironment("PATH");
#else
path.AddFromEnvironment("LD_LIBRARY_PATH");
#endif
fullPath = path.Find(cmnPath::SharedLibrary(sharedLibrary));
if (fullPath.empty()) {
fullPath = sharedLibrary;
Expand Down
3 changes: 2 additions & 1 deletion cisstOSAbstraction/osaThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ no warranty. The complete license can be found in license.txt and
#define SCHED_FIFO 0 /*! No Scheduling Policy available in Windows */
#endif

#if (CISST_OS == CISST_DARWIN) // SCHED_FIFO is not defined otherwise
// SCHED_FIFO is not defined otherwise
#if (CISST_OS == CISST_LINUX) || (CISST_OS == CISST_DARWIN)
#include <pthread.h>
#endif

Expand Down
3 changes: 3 additions & 0 deletions cisstParameterTypes/code/prmOperatingState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ bool prmOperatingState::ValidCommand(const prmOperatingState::CommandType & comm
break;
case FAULT:
switch (command) {
case enable:
newOperatingState = ENABLED;
return true;
case disable:
newOperatingState = DISABLED;
return true;
Expand Down
49 changes: 44 additions & 5 deletions cisstRobot/code/robManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,62 @@ void robManipulator::DeleteTools()
tools.clear();
}

robManipulator::Errno robManipulator::LoadRobot( const std::string& filename ){

if( filename.empty() ){
robManipulator::Errno robManipulator::LoadRobot(const std::string & filename)
{
if (filename.empty()) {
mLastError = "robManipulator::LoadRobot: no configuration file";
CMN_LOG_RUN_ERROR << mLastError << std::endl;
return robManipulator::EFAILURE;
}

std::ifstream ifs;
ifs.open( filename.data() );
if(!ifs){
ifs.open(filename.data());
if (!ifs) {
mLastError = "robManipulator::LoadRobot: couldn't open configuration file "
+ filename;
CMN_LOG_RUN_ERROR << mLastError << std::endl;
return robManipulator::EFAILURE;
}

// find extension, search for json
size_t dot = filename.find_last_of(".");
std::string extension = "";
if (dot != std::string::npos) {
extension = filename.substr(dot, filename.size() - dot);
}

if (extension != ".json") {
return LoadRobot(ifs);
}

// otherwise json
#if CISST_HAS_JSON
Json::Reader jsonReader;
Json::Value jsonConfig;
if (!jsonReader.parse(ifs, jsonConfig)) {
mLastError = "robManipulator::LoadRobot: syntax error while parsing json file "
+ filename + "\n" + jsonReader.getFormattedErrorMessages();
CMN_LOG_RUN_ERROR << mLastError << std::endl;
return robManipulator::EFAILURE;
} else {
// dVRK files have a DH field
Json::Value jsonDH = jsonConfig["DH"];
if (jsonDH.isNull()) {
return LoadRobot(jsonConfig);
} else {
return LoadRobot(jsonDH);
}
}
#else
mLastError = "robManipulator::LoadRobot: cisst was compiled without JSON support, can't load "
+ filename;
CMN_LOG_RUN_ERROR << mLastError << std::endl;
return robManipulator::EFAILURE;
#endif
}

robManipulator::Errno robManipulator::LoadRobot(std::istream & ifs)
{
size_t N; // the number of links
{
std::string line;
Expand Down
8 changes: 7 additions & 1 deletion cisstRobot/robManipulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class CISST_EXPORT robManipulator{


//! Load the kinematics and the dynamics of the robot
virtual robManipulator::Errno LoadRobot( const std::string& linkfile );
/** If the file name ends with .json it will open the file
and then call the overloaded method LoadRobot for Json::Value.
Otherwise, assumes it's the .rob format and calls the overloaded
method LoadRobot for istream. */
virtual robManipulator::Errno LoadRobot(const std::string & linkfile);

virtual robManipulator::Errno LoadRobot(std::istream & ifs);

#if CISST_HAS_JSON
//! Load the kinematics and the dynamtics of the robot from a JSON file
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<package>
<name>cisst</name>
<version>1.3.0</version>
<version>1.3.1</version>
<description>
This package provides the cisst libraries
</description>
Expand Down

0 comments on commit 2296798

Please sign in to comment.