Skip to content

Commit 2296798

Browse files
authored
Merge pull request #105 from jhu-cisst/rc-1.3.1
merge rc 1.3.1
2 parents 32234ab + 75ec740 commit 2296798

File tree

9 files changed

+98
-15
lines changed

9 files changed

+98
-15
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
Change log
22
==========
33

4+
1.3.1 (2025-01-17)
5+
==================
6+
7+
* API changes:
8+
* cisstRobot robManipulator: `LoadRobot` parses file name to identify .rob or .json format
9+
* Deprecated features:
10+
* None
11+
* New features
12+
* None
13+
* Bug fixes:
14+
* Missing includes for Ubuntu 24.04
15+
* cisstCommon cmnPath: better handling absolute paths on Windows (#102)
16+
* cisstMultiTask mtsManagerLocal: use PATH instead of LD_LIBRARY_PATH for dynamic loading on Windows
17+
* cisstParameterTypes prmOperatingState: allow to enable in fault state
418

519
1.3.0 (2024-08-30)
620
==================

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## -*- Mode: CMAKE; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
22

33
#
4-
# (C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
4+
# (C) Copyright 2005-2025 Johns Hopkins University (JHU), All Rights Reserved.
55
#
66
# --- begin cisst license - do not edit ---
77
#
@@ -16,7 +16,7 @@
1616
cmake_minimum_required (VERSION 3.10)
1717

1818
# cisst (Computer Integrated Surgical Systems and Technology)
19-
project (cisst VERSION 1.3.0)
19+
project (cisst VERSION 1.3.1)
2020

2121
# cisst compiler settings
2222
include (cmake/cisstSettings.cmake)

cisstCommon/code/cmnPath.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Author(s): Anton Deguet
66
Created on: 2005-04-18
77
8-
(C) Copyright 2005-2023 Johns Hopkins University (JHU), All Rights Reserved.
8+
(C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
99
1010
--- begin cisst license - do not edit ---
1111
@@ -139,9 +139,24 @@ std::string cmnPath::FindWithSubdirectory(const std::string & filename,
139139
std::string fullName("");
140140
const_iterator iter = Path.begin();
141141
const const_iterator end = Path.end();
142+
if (filename.empty()) {
143+
CMN_LOG_CLASS_RUN_WARNING << "FindWithSubdirectory called with empty filename" << std::endl;
144+
return filename;
145+
}
146+
bool isAbsolute = false;
147+
#if (CISST_OS == CISST_WINDOWS)
148+
size_t offset = 0;
149+
// First, check for drive letter (e.g., "C:")
150+
if ((filename.size() > 2) && (filename[1] == ':'))
151+
offset = 2;
152+
if ((filename[offset] == '/') || (filename[offset] == '\\'))
153+
isAbsolute = true;
154+
#else
155+
if (filename[0] == '/')
156+
isAbsolute = true;
157+
#endif
142158
// first check if this file exists as absolute path
143-
if ((filename.size() > 0)
144-
&& (filename[0] == '/')
159+
if (isAbsolute
145160
&& (access(filename.c_str(), mode) == 0)) {
146161
CMN_LOG_CLASS_RUN_VERBOSE << "Found \"" << filename << "\", it seems to be a valid absolute file name" << std::endl;
147162
return filename;

cisstMultiTask/code/mtsManagerLocal.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Author(s): Min Yang Jung
66
Created on: 2009-12-07
77
8-
(C) Copyright 2009-2020 Johns Hopkins University (JHU), All Rights Reserved.
8+
(C) Copyright 2009-2024 Johns Hopkins University (JHU), All Rights Reserved.
99
1010
--- begin cisst license - do not edit ---
1111
@@ -20,6 +20,7 @@ no warranty. The complete license can be found in license.txt and
2020

2121
#include <cisstCommon/cmnThrow.h>
2222
#include <cisstCommon/cmnPath.h>
23+
#include <cisstCommon/cmnPortability.h>
2324
#include <cisstOSAbstraction/osaSleep.h>
2425
#include <cisstOSAbstraction/osaGetTime.h>
2526
#include <cisstOSAbstraction/osaSocket.h>
@@ -905,15 +906,19 @@ mtsComponent * mtsManagerLocal::CreateComponentDynamicallyJSON(const std::string
905906
{
906907
// -1- try to dynamically load the library if specified
907908
if (!sharedLibrary.empty()) {
908-
// create load and path based on LD_LIBRARY_PATH
909+
// create load and path based on LD_LIBRARY_PATH (or PATH on Windows)
909910
osaDynamicLoader loader;
910911
std::string fullPath;
911912
// check if the file already exists, i.e. use provided a full path
912913
if (cmnPath::Exists(sharedLibrary)) {
913914
fullPath = sharedLibrary;
914915
} else {
915916
cmnPath path;
917+
#if (CISST_OS == CISST_WINDOWS)
918+
path.AddFromEnvironment("PATH");
919+
#else
916920
path.AddFromEnvironment("LD_LIBRARY_PATH");
921+
#endif
917922
fullPath = path.Find(cmnPath::SharedLibrary(sharedLibrary));
918923
if (fullPath.empty()) {
919924
fullPath = sharedLibrary;

cisstOSAbstraction/osaThread.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ no warranty. The complete license can be found in license.txt and
3939
#define SCHED_FIFO 0 /*! No Scheduling Policy available in Windows */
4040
#endif
4141

42-
#if (CISST_OS == CISST_DARWIN) // SCHED_FIFO is not defined otherwise
42+
// SCHED_FIFO is not defined otherwise
43+
#if (CISST_OS == CISST_LINUX) || (CISST_OS == CISST_DARWIN)
4344
#include <pthread.h>
4445
#endif
4546

cisstParameterTypes/code/prmOperatingState.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ bool prmOperatingState::ValidCommand(const prmOperatingState::CommandType & comm
8080
break;
8181
case FAULT:
8282
switch (command) {
83+
case enable:
84+
newOperatingState = ENABLED;
85+
return true;
8386
case disable:
8487
newOperatingState = DISABLED;
8588
return true;

cisstRobot/code/robManipulator.cpp

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,23 +185,62 @@ void robManipulator::DeleteTools()
185185
tools.clear();
186186
}
187187

188-
robManipulator::Errno robManipulator::LoadRobot( const std::string& filename ){
189-
190-
if( filename.empty() ){
188+
robManipulator::Errno robManipulator::LoadRobot(const std::string & filename)
189+
{
190+
if (filename.empty()) {
191191
mLastError = "robManipulator::LoadRobot: no configuration file";
192192
CMN_LOG_RUN_ERROR << mLastError << std::endl;
193193
return robManipulator::EFAILURE;
194194
}
195195

196196
std::ifstream ifs;
197-
ifs.open( filename.data() );
198-
if(!ifs){
197+
ifs.open(filename.data());
198+
if (!ifs) {
199199
mLastError = "robManipulator::LoadRobot: couldn't open configuration file "
200200
+ filename;
201201
CMN_LOG_RUN_ERROR << mLastError << std::endl;
202202
return robManipulator::EFAILURE;
203203
}
204204

205+
// find extension, search for json
206+
size_t dot = filename.find_last_of(".");
207+
std::string extension = "";
208+
if (dot != std::string::npos) {
209+
extension = filename.substr(dot, filename.size() - dot);
210+
}
211+
212+
if (extension != ".json") {
213+
return LoadRobot(ifs);
214+
}
215+
216+
// otherwise json
217+
#if CISST_HAS_JSON
218+
Json::Reader jsonReader;
219+
Json::Value jsonConfig;
220+
if (!jsonReader.parse(ifs, jsonConfig)) {
221+
mLastError = "robManipulator::LoadRobot: syntax error while parsing json file "
222+
+ filename + "\n" + jsonReader.getFormattedErrorMessages();
223+
CMN_LOG_RUN_ERROR << mLastError << std::endl;
224+
return robManipulator::EFAILURE;
225+
} else {
226+
// dVRK files have a DH field
227+
Json::Value jsonDH = jsonConfig["DH"];
228+
if (jsonDH.isNull()) {
229+
return LoadRobot(jsonConfig);
230+
} else {
231+
return LoadRobot(jsonDH);
232+
}
233+
}
234+
#else
235+
mLastError = "robManipulator::LoadRobot: cisst was compiled without JSON support, can't load "
236+
+ filename;
237+
CMN_LOG_RUN_ERROR << mLastError << std::endl;
238+
return robManipulator::EFAILURE;
239+
#endif
240+
}
241+
242+
robManipulator::Errno robManipulator::LoadRobot(std::istream & ifs)
243+
{
205244
size_t N; // the number of links
206245
{
207246
std::string line;

cisstRobot/robManipulator.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ class CISST_EXPORT robManipulator{
6969

7070

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

7480
#if CISST_HAS_JSON
7581
//! Load the kinematics and the dynamtics of the robot from a JSON file

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<package>
22
<name>cisst</name>
3-
<version>1.3.0</version>
3+
<version>1.3.1</version>
44
<description>
55
This package provides the cisst libraries
66
</description>

0 commit comments

Comments
 (0)