Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Humble #281

Merged
merged 51 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5914b8c
Update rolling.yml
hellantos Jun 20, 2023
ae140f8
Merge pull request #152 from ros-industrial/fix-bdist-dep-in-lely-core
hellantos Jun 21, 2023
66dd7e5
Merge pull request #142 from ros-industrial/iron-test-fixes-controllers
hellantos Jun 21, 2023
fbfb99e
Merge pull request #145 from ros-industrial/consistent-output-of-hex-…
hellantos Jun 21, 2023
7b14e0d
Merge pull request #151 from ros-industrial/upgrade-launch-tests
ipa-vsp Jun 21, 2023
a9971d4
Update Changelogs
Jun 21, 2023
b08e972
0.2.1
Jun 21, 2023
d9aaae1
Fix build warnings
ipa-vsp Jun 21, 2023
e35c93d
Update status badge.
ipa-vsp Jun 21, 2023
317f5ac
Force patch application
hellantos Jun 21, 2023
7ccf92f
Update rolling.yml
hellantos Jun 21, 2023
a965d0e
Update rolling.yml
hellantos Jun 21, 2023
63b7c44
Update rolling.yml
hellantos Jun 21, 2023
5aa3a40
Reset hard before patch applicaiton
Jun 21, 2023
01ada78
Add buildfarm dev job status
ipa-vsp Jul 12, 2023
d2e3c67
Update Changelogs
Jun 21, 2023
8fc9a6a
0.2.2
Jun 21, 2023
fad98aa
Solve buildfarm issues (#155)
hellantos Jun 22, 2023
6590cef
Create prerelease-rolling.yml
hellantos Jun 22, 2023
5a4e099
Update package.xml
hellantos Jun 22, 2023
fedcb2f
Readable CI naming
Jun 22, 2023
2b94115
Remove ccache for prerelease testing
Jun 22, 2023
a447448
Remove cchache action
Jun 22, 2023
bef4f81
Fix buildfarm issue with lely_core_libraries (#158)
hellantos Jun 22, 2023
818f0d0
Update Changelogs
Jun 22, 2023
67c3cd1
Update Changelogs
Jun 22, 2023
781b7e4
Update Changelogs
Jun 22, 2023
44d5bea
Update Changelogs
Jun 22, 2023
8384b31
0.2.3
Jun 22, 2023
c220d23
Clean up lely build folder after install for rpm build
Jun 22, 2023
a93c262
Add empy dependency for dcfgen
Jun 22, 2023
5f4f842
Update changelog
Jun 22, 2023
cb0cfa3
0.2.4
Jun 22, 2023
565266c
Directly install lely (#160)
hellantos Jun 23, 2023
fdcc5ee
Update changelogs
Jun 23, 2023
5ed5498
0.2.5
Jun 23, 2023
7401161
Update README.md (#159)
hellantos Jun 23, 2023
30edd0d
Move install from external project to cmake main
Jun 24, 2023
43dfb14
Run prerelease on tag push
Jun 24, 2023
2bbc388
Update changelogs
Jun 24, 2023
064d2bf
0.2.6
Jun 24, 2023
09f8cb9
Merge branch 'yos627-patch-1'
Jun 26, 2023
15e0d40
Fix python versions (#164)
hellantos Jun 27, 2023
b0302da
Fix maintainer naming (#163)
hellantos Jun 27, 2023
66cbf0f
Add missing license headers and activate ament_copyright (#165)
hellantos Jun 27, 2023
cf8b617
[ros2controllers] Correct Proxy controller after changes and update t…
destogl Jun 29, 2023
f62dda4
Update ros2_control docs. (#149)
destogl Jun 30, 2023
cff9e86
Update changelog
Jun 30, 2023
7dbe3d5
0.2.7
Jun 30, 2023
320940b
synch humble
ipa-vsp Apr 22, 2024
4773337
Merge remote-tracking branch 'industrial/humble' into humble
ipa-vsp Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ros:galactic-ros-core-focal
FROM ros:rolling-ros-core


RUN apt-get update \
Expand All @@ -14,7 +14,7 @@ WORKDIR /home/can_ws/src
COPY . ros2_canopen

WORKDIR /home/can_ws/
RUN . /opt/ros/galactic/setup.sh \
RUN . /opt/ros/rolling/setup.sh \
&& rosdep init && rosdep update \
&& rosdep install --from-paths src --ignore-src -r -y \
&& colcon build \
Expand Down
1 change: 1 addition & 0 deletions canopen/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<version>0.2.7</version>
<description>Meta-package aggregating the ros2_canopen packages and documentation</description>
<maintainer email="[email protected]">Christoph Hellmann Santos</maintainer>
<maintainer email="[email protected]">Vishnuprasad Prachandabhanu</maintainer>
<license>Apache-2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
4 changes: 2 additions & 2 deletions canopen/sphinx/quickstart/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Service Interface

.. code-block:: bash
ros2 launch canopen_tests ci402_setup.launch.py
ros2 launch canopen_tests cia402_setup.launch.py
Managed Service Interface
-------------------------

.. code-block:: bash
ros2 launch canopen_tests ci402_lifecycle_setup.launch.py
ros2 launch canopen_tests cia402_lifecycle_setup.launch.py
ROS2 Control
------------
Expand Down
2 changes: 2 additions & 0 deletions canopen/sphinx/user-guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ but come from the lely core library. Below you find a list of possible configura
reset_all_nodes; Specifies whether all slaves shall be reset in case of an error event on a mandatory slave (default: false, see bit 4 in object 1F80).
stop_all_nodes; Specifies whether all slaves shall be stopped in case of an error event on a mandatory slave (default: false, see bit 6 in object 1F80).
boot_time; The timeout for booting mandatory slaves in ms (default: 0, see object 1F89).
boot_timeout; The timeout for booting all slaves in ms (default: 2000ms).

Device Section
--------------
Expand Down Expand Up @@ -151,6 +152,7 @@ device.
software_version; The expected software version (default: 0x00000000, see object 1F55).
configuration_file; The name of the file containing the configuration (default: "<dcf_path>/<name>.bin" (where <name> is the section name), see object 1F22).
restore_configuration; The sub-index of object 1011 to be used when restoring the configuration (default: 0x00).
sdo_timeout_ms; The timeout to use for SDO reads/writes to this device. (default: 20ms)
sdo; Additional SDO requests to be sent during configuration (see below).


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can use ``ros2 pkg create`` command to create your package.

.. code-block:: console
$ ros2 pkg create --dependencies ros2_canopen lely_core_libraries --build-type ament_cmake {package_name}
$ ros2 pkg create --dependencies canopen lely_core_libraries --build-type ament_cmake {package_name}
$ cd {package_name}
$ rm -rf src
$ rm -rf include
Expand Down
11 changes: 6 additions & 5 deletions canopen/sphinx/user-guide/how-to-create-a-robot-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ leveragin ros2_control.

.. code-block:: console

$ ros2 pkg create --dependencies ros2_canopen lely_core_libraries --build-type ament_cmake {package_name}
$ ros2 pkg create --dependencies canopen lely_core_libraries --build-type ament_cmake {package_name}
$ cd {package_name}
$ rm -rf src
$ rm -rf include
Expand Down Expand Up @@ -81,10 +81,10 @@ leveragin ros2_control.
- {index: 0x607A, sub_index: 0} # target position

nodes:
- joint_1:
node_id: 2
- joint_2:
node_id: 3
joint_1:
node_id: 2
joint_2:
node_id: 3

5. Copy the ``cia402_slave.eds`` file from the ``canopen_tests/config/robot_control`` package to the ``config/robot_control`` folder.

Expand Down Expand Up @@ -130,6 +130,7 @@ leveragin ros2_control.
[
FindPackageShare("canopen_tests"),
"urdf",
"robot_controller",
"robot_controller.urdf.xacro",
]
),
Expand Down
1 change: 1 addition & 0 deletions canopen_402_driver/src/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
#include "canopen_402_driver/command.hpp"
#include <stdexcept>
using namespace ros2_canopen;

const Command402::TransitionTable Command402::transitions_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ class LelyDriverBridge : public canopen::FiberDriver
uint8_t nodeid;
std::string name_;

std::chrono::milliseconds sdo_timeout;

std::function<void()> on_sync_function_;

// void set_sync_function(std::function<void()> on_sync_function)
Expand Down Expand Up @@ -396,11 +398,12 @@ class LelyDriverBridge : public canopen::FiberDriver
* @param [in] id NodeId to connect to
* @param [in] eds EDS file
* @param [in] bin BIN file (concise dcf)
* @param [in] timeout Timeout in milliseconds for SDO reads/writes
*
*/
LelyDriverBridge(
ev_exec_t * exec, canopen::AsyncMaster & master, uint8_t id, std::string name, std::string eds,
std::string bin)
std::string bin, std::chrono::milliseconds timeout = 20ms)
: FiberDriver(exec, master, id),
rpdo_queue(new SafeQueue<COData>()),
emcy_queue(new SafeQueue<COEmcy>())
Expand All @@ -417,6 +420,7 @@ class LelyDriverBridge : public canopen::FiberDriver
dictionary_->readDCF(a, b, bin.c_str());
}
pdo_map_ = dictionary_->createPDOMapping();
sdo_timeout = timeout;
}

/**
Expand Down Expand Up @@ -476,7 +480,7 @@ class LelyDriverBridge : public canopen::FiberDriver
this->running = false;
this->sdo_cond.notify_one();
},
20ms);
this->sdo_timeout);
return prom->get_future();
}

Expand Down Expand Up @@ -568,7 +572,7 @@ class LelyDriverBridge : public canopen::FiberDriver
this->running = false;
this->sdo_cond.notify_one();
},
20ms);
this->sdo_timeout);
return prom->get_future();
}

Expand Down Expand Up @@ -736,7 +740,7 @@ class LelyDriverBridge : public canopen::FiberDriver
this->running = false;
this->sdo_cond.notify_one();
},
20ms);
this->sdo_timeout);
}

template <typename T>
Expand All @@ -763,7 +767,7 @@ class LelyDriverBridge : public canopen::FiberDriver
this->running = false;
this->sdo_cond.notify_one();
},
20ms);
this->sdo_timeout);
}

template <typename T>
Expand All @@ -782,7 +786,7 @@ class LelyDriverBridge : public canopen::FiberDriver
}
if (!is_tpdo)
{
if (sync_sdo_read_typed<T>(index, subindex, value, std::chrono::milliseconds(20)))
if (sync_sdo_read_typed<T>(index, subindex, value, this->sdo_timeout))
{
return value;
}
Expand Down Expand Up @@ -839,7 +843,7 @@ class LelyDriverBridge : public canopen::FiberDriver
}
else
{
sync_sdo_write_typed(index, subindex, value, std::chrono::milliseconds(20));
sync_sdo_write_typed(index, subindex, value, this->sdo_timeout);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class NodeCanopenBaseDriver : public NodeCanopenDriver<NODETYPE>
std::mutex driver_mutex_;
std::shared_ptr<ros2_canopen::LelyDriverBridge> lely_driver_;
uint32_t period_ms_;
int sdo_timeout_ms_;
bool polling_;

// nmt state callback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,25 @@ void NodeCanopenBaseDriver<NODETYPE>::init(bool called_from_base)
template <>
void NodeCanopenBaseDriver<rclcpp_lifecycle::LifecycleNode>::configure(bool called_from_base)
{
try
{
this->non_transmit_timeout_ =
std::chrono::milliseconds(this->config_["non_transmit_timeout"].as<int>());
}
catch (...)
{
}
RCLCPP_INFO_STREAM(
this->node_->get_logger(),
"Non transmit timeout" << static_cast<int>(this->non_transmit_timeout_.count()) << "ms");

try
{
polling_ = this->config_["polling"].as<bool>();
}
catch (...)
{
RCLCPP_ERROR(this->node_->get_logger(), "Could not polling from config, setting to true.");
RCLCPP_WARN(this->node_->get_logger(), "Could not polling from config, setting to true.");
polling_ = true;
}
if (polling_)
Expand All @@ -52,7 +64,7 @@ void NodeCanopenBaseDriver<rclcpp_lifecycle::LifecycleNode>::configure(bool call
}
catch (...)
{
RCLCPP_ERROR(this->node_->get_logger(), "Could not read period from config, setting to 10ms");
RCLCPP_WARN(this->node_->get_logger(), "Could not read period from config, setting to 10ms");
period_ms_ = 10;
}
}
Expand All @@ -64,7 +76,7 @@ void NodeCanopenBaseDriver<rclcpp_lifecycle::LifecycleNode>::configure(bool call
}
catch (...)
{
RCLCPP_ERROR(
RCLCPP_WARN(
this->node_->get_logger(),
"Could not read enable diagnostics from config, setting to false.");
diagnostic_enabled_ = false;
Expand All @@ -86,17 +98,39 @@ void NodeCanopenBaseDriver<rclcpp_lifecycle::LifecycleNode>::configure(bool call
diagnostic_updater_ = std::make_shared<diagnostic_updater::Updater>(this->node_);
diagnostic_updater_->setHardwareID(std::to_string(this->node_id_));
}

std::optional<int> sdo_timeout_ms;
try
{
sdo_timeout_ms = std::optional(this->config_["sdo_timeout_ms"].as<int>());
}
catch (...)
{
}
sdo_timeout_ms_ = sdo_timeout_ms.value_or(20);
}
template <>
void NodeCanopenBaseDriver<rclcpp::Node>::configure(bool called_from_base)
{
try
{
this->non_transmit_timeout_ =
std::chrono::milliseconds(this->config_["non_transmit_timeout"].as<int>());
}
catch (...)
{
}
RCLCPP_INFO_STREAM(
this->node_->get_logger(),
"Non transmit timeout" << static_cast<int>(this->non_transmit_timeout_.count()) << "ms");

try
{
polling_ = this->config_["polling"].as<bool>();
}
catch (...)
{
RCLCPP_ERROR(this->node_->get_logger(), "Could not polling from config, setting to true.");
RCLCPP_WARN(this->node_->get_logger(), "Could not polling from config, setting to true.");
polling_ = true;
}
if (polling_)
Expand All @@ -107,7 +141,7 @@ void NodeCanopenBaseDriver<rclcpp::Node>::configure(bool called_from_base)
}
catch (...)
{
RCLCPP_ERROR(this->node_->get_logger(), "Could not read period from config, setting to 10ms");
RCLCPP_WARN(this->node_->get_logger(), "Could not read period from config, setting to 10ms");
period_ms_ = 10;
}
}
Expand All @@ -119,7 +153,7 @@ void NodeCanopenBaseDriver<rclcpp::Node>::configure(bool called_from_base)
}
catch (...)
{
RCLCPP_ERROR(
RCLCPP_WARN(
this->node_->get_logger(),
"Could not read enable diagnostics from config, setting to false.");
diagnostic_enabled_ = false;
Expand All @@ -132,7 +166,7 @@ void NodeCanopenBaseDriver<rclcpp::Node>::configure(bool called_from_base)
}
catch (...)
{
RCLCPP_ERROR(
RCLCPP_WARN(
this->node_->get_logger(),
"Could not read diagnostics period from config, setting to 1000ms");
diagnostic_period_ms_ = 1000;
Expand All @@ -141,6 +175,16 @@ void NodeCanopenBaseDriver<rclcpp::Node>::configure(bool called_from_base)
diagnostic_updater_ = std::make_shared<diagnostic_updater::Updater>(this->node_);
diagnostic_updater_->setHardwareID(std::to_string(this->node_id_));
}

std::optional<int> sdo_timeout_ms;
try
{
sdo_timeout_ms = std::optional(this->config_["sdo_timeout_ms"].as<int>());
}
catch (...)
{
}
sdo_timeout_ms_ = sdo_timeout_ms.value_or(20);
}

template <class NODETYPE>
Expand Down Expand Up @@ -211,7 +255,7 @@ void NodeCanopenBaseDriver<NODETYPE>::add_to_master()
std::scoped_lock<std::mutex> lock(this->driver_mutex_);
this->lely_driver_ = std::make_shared<ros2_canopen::LelyDriverBridge>(
*(this->exec_), *(this->master_), this->node_id_, this->node_->get_name(), this->eds_,
this->bin_);
this->bin_, std::chrono::milliseconds(this->sdo_timeout_ms_));
this->driver_ = std::static_pointer_cast<lely::canopen::BasicDriver>(this->lely_driver_);
prom->set_value(lely_driver_);
});
Expand Down
1 change: 1 addition & 0 deletions canopen_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ ament_target_dependencies(device_container
target_link_libraries(device_container
node_canopen_master
node_canopen_driver
yaml-cpp
)

add_executable(device_container_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class NodeCanopenMaster : public NodeCanopenMasterInterface
std::string master_dcf_;
std::string master_bin_;
std::string can_interface_name_;
uint32_t timeout_;

std::thread spinner_;

Expand Down Expand Up @@ -166,7 +167,23 @@ class NodeCanopenMaster : public NodeCanopenMasterInterface
this->configured_.store(true);
}

virtual void configure(bool called_from_base) {}
virtual void configure(bool called_from_base)
{
std::optional<int> timeout;
try
{
timeout = this->config_["boot_timeout"].as<int>();
}
catch (...)
{
RCLCPP_WARN(
this->node_->get_logger(),
"No timeout parameter found in config file. Using default value of 100ms.");
}
this->timeout_ = timeout.value_or(2000);
RCLCPP_INFO_STREAM(
this->node_->get_logger(), "Master boot timeout set to " << this->timeout_ << "ms.");
}

/**
* @brief Activate the driver
Expand Down
Loading
Loading