Skip to content

Commit

Permalink
fix pre-commit
Browse files Browse the repository at this point in the history
Co-authored-by: Dr. Denis <denis@stoglrobotics.de>
  • Loading branch information
muritane and destogl committed Jun 9, 2023
1 parent aebb914 commit efe5597
Show file tree
Hide file tree
Showing 36 changed files with 1,027 additions and 972 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: false
ReflowComments: true
IncludeBlocks: Preserve
10 changes: 8 additions & 2 deletions .github/workflows/ci-ros-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
linter: [cppcheck, copyright, lint_cmake]
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@v0.2
- uses: ros-tooling/setup-ros@0.6.2
- uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: rolling
Expand All @@ -29,6 +29,9 @@ jobs:
kuka_kr5_support
kuka_kr3_support
kuka_experimental
kuka_rsi_hw_interface
kuka_rsi_simulator
kuka_eki_hw_interface


ament_lint_100:
Expand All @@ -40,7 +43,7 @@ jobs:
linter: [cpplint]
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@v0.2
- uses: ros-tooling/setup-ros@0.6.2
- uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: rolling
Expand All @@ -58,3 +61,6 @@ jobs:
kuka_kr5_support
kuka_kr3_support
kuka_experimental
kuka_rsi_hw_interface
kuka_rsi_simulator
kuka_eki_hw_interface
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ repos:

# Python hooks
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.4.0
hooks:
- id: pyupgrade
args: [--py36-plus]

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
args: ["--line-length=99"]
Expand All @@ -56,7 +56,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501"]
args: ["--ignore=E501,W503"]

# CPP hooks
- repo: local
Expand Down Expand Up @@ -137,7 +137,7 @@ repos:
# Spellcheck in comments and docs
# skipping of *.svg files is not working...
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
args: ['--write-changes', '--ignore-words-list=linz']
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Software License Agreement (3-Clause BSD License)
//
// Copyright (c) 2018, 3M
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

// Author: Brett Hemes (3M) <brhemes@mmm.com>

#ifndef KUKA_EKI_HW_INTERFACE__KUKA_EKI_HW_INTERFACE_HPP_
#define KUKA_EKI_HW_INTERFACE__KUKA_EKI_HW_INTERFACE_HPP_

#include <controller_manager/controller_manager.h>
#include <hardware_interface/joint_command_interface.h>
#include <hardware_interface/joint_state_interface.h>
#include <hardware_interface/robot_hw.h>
#include <ros/ros.h>

#include <string>
#include <vector>

#include <boost/asio.hpp>

namespace kuka_eki_hw_interface
{

class KukaEkiHardwareInterface : public hardware_interface::RobotHW
{
private:
ros::NodeHandle nh_;

const unsigned int n_dof_ = 6;
std::vector<std::string> joint_names_;
std::vector<double> joint_position_;
std::vector<double> joint_velocity_;
std::vector<double> joint_effort_;
std::vector<double> joint_position_command_;

// EKI
std::string eki_server_address_;
std::string eki_server_port_;
int eki_cmd_buff_len_;
int eki_max_cmd_buff_len_ =
5; // by default, limit command buffer to 5 (size of advance run in KRL)

// Timing
ros::Duration control_period_;
ros::Duration elapsed_time_;
double loop_hz_;

// Interfaces
hardware_interface::JointStateInterface joint_state_interface_;
hardware_interface::PositionJointInterface position_joint_interface_;

// EKI socket read/write
int eki_read_state_timeout_ = 5; // [s]; settable by parameter (default = 5)
boost::asio::io_service ios_;
boost::asio::deadline_timer deadline_;
boost::asio::ip::udp::endpoint eki_server_endpoint_;
boost::asio::ip::udp::socket eki_server_socket_;
void eki_check_read_state_deadline();
static void eki_handle_receive(
const boost::system::error_code & ec, size_t length, boost::system::error_code * out_ec,
size_t * out_length);
bool eki_read_state(
std::vector<double> & joint_position, std::vector<double> & joint_velocity,
std::vector<double> & joint_effort, int & cmd_buff_len);
bool eki_write_command(const std::vector<double> & joint_position);

public:
KukaEkiHardwareInterface();
~KukaEkiHardwareInterface();

void init();
void start();
void read(const ros::Time & time, const ros::Duration & period);
void write(const ros::Time & time, const ros::Duration & period);
};

} // namespace kuka_eki_hw_interface

#endif // KUKA_EKI_HW_INTERFACE__KUKA_EKI_HW_INTERFACE_HPP_
3 changes: 1 addition & 2 deletions kuka_eki_hw_interface/krl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The files included in the `kuka_eki_hw_interface/krl` folder provide the KRL int
Note that the `eki/robot_address` and `eki/robot_port` parameters of the `kuka_eki_hw_interface` must correspond to the `IP`and `PORT` set in this XML file.

##### Copy files to controller
The files `kuka_eki_hw_interface.dat` and `kuke_eki_hw_interface.src` should not be edited. All files are now ready to be copied to the Kuka controller. Using WorkVisual or a USB drive (with appropriate privleges):
The files `kuka_eki_hw_interface.dat` and `kuke_eki_hw_interface.src` should not be edited. All files are now ready to be copied to the Kuka controller. Using WorkVisual or a USB drive (with appropriate privileges):

1. Copy `kuka_eki_hw_interface.dat` and `kuka_eki_hw_interface.src` files to `KRC:\R1\Program`.
2. Copy `EkiHwInterface.xml` to `C:\KRC\ROBOTER\Config\User\Common\EthernetKRL\`.
Expand Down Expand Up @@ -90,4 +90,3 @@ $ rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller
Choose **controller manager ns** and **controller** and you should be able to move each robot joint.

* Note that T1-mode limits the robot movement velocity and is intended for testing purposes.

2 changes: 1 addition & 1 deletion kuka_eki_hw_interface/krl/kuka_eki_hw_interface.dat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
&ACCESS RVO
defdat kuka_eki_hw_interface
ext bas(bas_command :in,real :in )
enddat
enddat
4 changes: 2 additions & 2 deletions kuka_eki_hw_interface/krl/kuka_eki_hw_interface.src
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def kuka_eki_hw_interface()
eki_hw_iface_init()

; BCO (Block COincidence) run to current position
; (requied for below loop continue before first incoming command)
; (required for below loop continue before first incoming command)
joint_pos_tgt = $axis_act_meas
ptp joint_pos_tgt

Expand Down Expand Up @@ -157,7 +157,7 @@ endfct


; eki_hw_iface_get
; Tries to read most recent elemnt from buffer. q left unchanged if empty.
; Tries to read most recent element from buffer. q left unchanged if empty.
; Returns number of elements read.
deffct int eki_hw_iface_get(joint_pos_cmd :out)
decl eki_status eki_ret
Expand Down
Loading

0 comments on commit efe5597

Please sign in to comment.