Skip to content

Commit

Permalink
Merge branch 'master' into feature/blending
Browse files Browse the repository at this point in the history
  • Loading branch information
Svastits authored May 3, 2024
2 parents 8830774 + e33b7c0 commit 8e7571c
Show file tree
Hide file tree
Showing 45 changed files with 2,162 additions and 2,149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <vector>

#include "controller_interface/controller_interface.hpp"
#include "kuka_driver_interfaces/srv/set_int.hpp"
#include "kuka_driver_interfaces/msg/fri_configuration.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "rclcpp/duration.hpp"
#include "rclcpp/time.hpp"
Expand Down Expand Up @@ -53,9 +53,9 @@ class FRIConfigurationController : public controller_interface::ControllerInterf
FRI_CONFIGURATION_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_init() override;

private:
rclcpp::Service<kuka_driver_interfaces::srv::SetInt>::SharedPtr receive_multiplier_service_;
rclcpp::Subscription<kuka_driver_interfaces::msg::FriConfiguration>::SharedPtr fri_config_sub_;
int receive_multiplier_ = 1;
bool resend_multiplier_ = false;
int send_period_ms_ = 10;
};
} // namespace kuka_controllers
#endif // FRI_CONFIGURATION_CONTROLLER__FRI_CONFIGURATION_CONTROLLER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@ namespace kuka_controllers
{
controller_interface::CallbackReturn FRIConfigurationController::on_init()
{
auto callback = [this](
kuka_driver_interfaces::srv::SetInt::Request::SharedPtr request,
kuka_driver_interfaces::srv::SetInt::Response::SharedPtr response)
auto callback = [this](const kuka_driver_interfaces::msg::FriConfiguration::SharedPtr msg)
{
resend_multiplier_ = true;
receive_multiplier_ = request->data;
response->success = true;
receive_multiplier_ = msg->receive_multiplier;
send_period_ms_ = msg->send_period_ms;
};
receive_multiplier_service_ = get_node()->create_service<kuka_driver_interfaces::srv::SetInt>(
"~/set_receive_multiplier", callback);
// TODO(Svastits): create service to get multiplier changes (or perpaps
// parameter??)
// and set resend_multiplier_ to true in the callback
fri_config_sub_ = get_node()->create_subscription<kuka_driver_interfaces::msg::FriConfiguration>(
"~/set_fri_config", rclcpp::SystemDefaultsQoS(), callback);
return controller_interface::CallbackReturn::SUCCESS;
}

Expand All @@ -43,6 +37,8 @@ FRIConfigurationController::command_interface_configuration() const
config.type = controller_interface::interface_configuration_type::INDIVIDUAL;
config.names.emplace_back(
std::string(hardware_interface::CONFIG_PREFIX) + "/" + hardware_interface::RECEIVE_MULTIPLIER);
config.names.emplace_back(
std::string(hardware_interface::CONFIG_PREFIX) + "/" + hardware_interface::SEND_PERIOD);
return config;
}

Expand Down Expand Up @@ -75,14 +71,9 @@ controller_interface::return_type FRIConfigurationController::update(
const rclcpp::Time &, const rclcpp::Duration &)
{
// TODO(Svastits): disable changes if HWIF is active
if (resend_multiplier_)
{
RCLCPP_INFO(
get_node()->get_logger(), "Changing receive multiplier of hardware interface to %i",
receive_multiplier_);
command_interfaces_[0].set_value(receive_multiplier_);
resend_multiplier_ = false;
}
command_interfaces_[0].set_value(receive_multiplier_);
command_interfaces_[1].set_value(send_period_ms_);

return controller_interface::return_type::OK;
}

Expand Down
4 changes: 2 additions & 2 deletions doc/wiki/1_iiQKA_EAC.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Both launch files support the following arguments:
- `robot_model`: defines which LBR iisy robot to use. Available options: `lbr_iisy3_r760` (default), `lbr_iisy11_r1300`, `lbr_iisy15_r930`
- `use_fake_hardware`: if true, the `KukaMockHardwareInterface` will be used instead of the `KukaEACHardwareInterface`. This enables trying out the driver without actual hardware.
- `namespace`: adds a namespace to all nodes and controllers of the driver, and modifies the `prefix` argument of the robot description macro to `namespace_`
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame in meters (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame in radians (default: [0, 0, 0])
- `roundtrip_time`: The roundtrip time (in microseconds) to be enforced by the [KUKA mock hardware interface](https://github.com/kroshu/kuka_robot_descriptions?tab=readme-ov-file#custom-mock-hardware), (defaults to 2500 us, only used if `use_fake_hardware` is true)
- `qos_config`: the location of the QoS configuration file (defaults to `kuka_iiqka_eac_driver/config/qos_config.yaml`)
- `controller_config`: the location of the `ros2_control` configuration file (defaults to `kuka_iiqka_eac_driver/config/ros2_controller_config.yaml`)
Expand Down
5 changes: 2 additions & 3 deletions doc/wiki/2_KSS_RSI.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ Method 2:
#### Startup configuration

The following configuration files are available in the `config` directory of the package:
- `driver_config.yaml`: contains the IP address of the client machine
- `ros2_controller_config.yaml`: contains the controller types for every controller name. Should be only modified if a different controller is to be used.
- configuration files for specific controllers, for further information, see the documentation of the given controller

Expand Down Expand Up @@ -114,8 +113,8 @@ Both launch files support the following arguments:
- `robot_model` and `robot_family`: defines which robot to use. The available options for the valid model and family combinations can be found in the [readme](https://github.com/kroshu/kuka_robot_descriptions?tab=readme-ov-file#what-data-is-verified) of the `kuka_robot_descriptions` repository.
- `use_fake_hardware`: if true, the `KukaMockHardwareInterface` will be used instead of the `KukaRSIHardwareInterface`. This enables trying out the driver without actual hardware.
- `namespace`: adds a namespace to all nodes and controllers of the driver, and modifies the `prefix` argument of the robot description macro to `namespace_`
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame in meters (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame in radians (default: [0, 0, 0])
- `roundtrip_time`: The roundtrip time (in microseconds) to be enforced by the [KUKA mock hardware interface](https://github.com/kroshu/kuka_robot_descriptions?tab=readme-ov-file#custom-mock-hardware), (defaults to 4000 us, only used if `use_fake_hardware` is true)
- `controller_config`: the location of the `ros2_control` configuration file (defaults to `kuka_kss_rsi_driver/config/ros2_controller_config.yaml`)
- `jtc_config`: the location of the configuration file for the `joint_trajectory_controller` (defaults to `kuka_kss_rsi_driver/config/joint_trajectory_controller_config.yaml`)
Expand Down
36 changes: 19 additions & 17 deletions doc/wiki/3_Sunrise_FRI.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#### Controller side

- Modify the `_remoteIP` variable of the [FRIConfigurationParams.java](https://github.com/kroshu/kuka_drivers/blob/master/kuka_sunrise_fri_driver/robot_application/ROS2_Control/src/ros2/serialization/FRIConfigurationParams.java) file to the IP address of the client machine
- Upload the robot application under `robot_application/src` to the controller using Sunrise Workbench

### Configuration
Expand All @@ -28,8 +27,8 @@ The IP address of robot controller must be provided as a launch argument. For fu
The parameters in the driver configuration file can be also changed during runtime using the parameter interface of the `robot_manager` node:
- `send_period_ms` (integer): this parameter defines the send rate in milliseconds (with which the controller sends robot state updates). It must be between 1 and 10 for control and can be only changed in `inactive` and `configuring` states.
- `receive_multiplier` (integer): this parameter defines the answer rate factor (the client should sends commands in every `receive_multiplier`*`send_period_ms` milliseconds). It must be at least 1 and can be only changed in `inactive` and `configuring` states.
- `control_mode`, `command_mode` (strings): control mode related parameters, which will be combined to support the defined enums. They cannot be changed in active state.
- `joint_damping`, `joint_stiffness` (double vectors): these parameters change the stiffness and damping attributes of joint impedance control mode. They will be removed after changing to using the `joint_group_impedance_controller` to adapt to conventions.
- `control_mode`: The enum value of the control mode should be given, which updates the `ControlMode` and `ClientCommandMode` parameters of FRI. It cannot be changed in active state.
- `joint_damping`, `joint_stiffness` (double vectors): these parameters change the stiffness and damping attributes of joint impedance control mode. The updated values are sent to the hardware interface using the `joint_group_impedance_controller` to adapt to conventions, but it is not possible to change them in active state due to the constraints of FRI. (Therefore the `joint_group_impedance_controller` is deactivated at driver activation.)
- `position_controller_name`: The name of the controller (string) that controls the `position` interface of the robot. It can't be changed in active state.
- `torque_controller_name`: The name of the controller (string) that controls the `effort` interface of the robot. It can't be changed in active state.

Expand All @@ -39,14 +38,17 @@ The parameters in the driver configuration file can be also changed during runti

1. On the controller, start the uploaded robot application (ROS2_Control).
2. To start the driver, two launch file are available, with and without `rviz`. To launch (without `rviz`), run
```
ros2 launch kuka_sunrise_fri_driver startup.launch.py controller_ip:=0.0.0.0
```
- This starts the 3 core components of every driver (described in the [Non-real-time interface](https://github.com/kroshu/kuka_drivers/wiki#non-real-time-interface) section of the project overview) and the following controllers:
- `joint_state_broadcaster` (no configuration file, all state interfaces are published)
- `joint_trajectory_controller` ([configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_sunrise_fri_driver/config/joint_trajectory_controller_config.yaml))
- [`fri_configuration_controller`](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#fri_configuration_controller) (no configuration file)
- [`fri_state_broadcaster`](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#fri_state_broadcaster) (no configuration file)
```
ros2 launch kuka_sunrise_fri_driver startup.launch.py controller_ip:=0.0.0.0 client_ip:=0.0.0.0
```
This starts the 3 core components of every driver (described in the [Non-real-time interface](https://github.com/kroshu/kuka_drivers/wiki#non-real-time-interface) section of the project overview) and the following controllers:
- `joint_state_broadcaster` (no configuration file, all state interfaces are published)
- `joint_trajectory_controller` ([configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_sunrise_fri_driver/config/joint_trajectory_controller_config.yaml))
- [`fri_configuration_controller`](https://github.com/kroshu/kuka_controllers?tab=readme-ov-file#fri_configuration_controller) (no configuration file)
- [`fri_state_broadcaster`](https://github.com/kroshu/kuka_controllers?tab=readme-ov-file#fri_state_broadcaster) (no configuration file)
- `joint_group_impedance_controller` ([configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_sunrise_fri_driver/config/joint_impedance_controller_config.yaml))
- `effort_controller` (of type `JointGroupEffortController`, [configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_sunrise_fri_driver/config/effort_controller_config.yaml))
- [`control_mode_handler`](https://github.com/kroshu/kuka_controllers?tab=readme-ov-file#control_mode_handler) (no configuration file)

3. After successful startup, the `robot_manager` node has to be activated to start the cyclic communication with the robot controller (before this only a collapsed robot is visible in `rviz`):
```
Expand All @@ -60,14 +62,18 @@ On successful activation the brakes of the robot will be released and external c
Both launch files support the following argument:
- `controller_ip`: IP address of the robot controller
- `client_ip`: IP address of the client PC
- `client_port`: port of the client machine (default: 30200)
- `robot_model`: defines which LBR iiwa robot to use. Available options: `lbr_iiwa14_r820` (default)
- `use_fake_hardware`: if true, the `KukaMockHardwareInterface` will be used instead of the `KukaFRIHardwareInterface`. This enables trying out the driver without actual hardware.
- `namespace`: adds a namespace to all nodes and controllers of the driver, and modifies the `prefix` argument of the robot description macro to `namespace_`
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame (default: [0, 0, 0])
- `x`, `y`, `z`: define the position of `base_link` relative to the `world` frame in meters (default: [0, 0, 0])
- `roll`, `pitch`, `yaw`: define the orientation of `base_link` relative to the `world` frame in radians (default: [0, 0, 0])
- `roundtrip_time`: The roundtrip time (in microseconds) to be enforced by the [KUKA mock hardware interface](https://github.com/kroshu/kuka_robot_descriptions?tab=readme-ov-file#custom-mock-hardware), (defaults to 5000 us, only used if `use_fake_hardware` is true)
- `controller_config`: the location of the `ros2_control` configuration file (defaults to `kuka_sunrise_fri_driver/config/ros2_controller_config.yaml`)
- `jtc_config`: the location of the configuration file for the `joint_trajectory_controller` (defaults to `kuka_sunrise_fri_driver/config/joint_trajectory_controller_config.yaml`)
- `jic_config`: the location of the configuration file for the `joint_impedance_controller` (defaults to `kuka_sunrise_fri_driver/config/joint_impedance_controller_config.yaml`)
- `ec_config`: the location of the configuration file for the `effort_controller` (defaults to `kuka_sunrise_fri_driver/config/effort_controller_config.yaml`)
The `startup_with_rviz.launch.py` additionally contains one argument:
Expand All @@ -83,9 +89,5 @@ BEWARE, that this is a non-realtime process including lifecycle management, so t
### Known issues and limitations
- Not all hardware-related communication is implemented in the hardware interface, therefore the mock hardware option is not working properly
- The control mode handling for the driver is not the one defined in the `kuka_drivers_core` package
- enum definition and controller switching logic is not used
- joint impedance control is not implemented properly using command interfaces
- I/O control was not tested
- Cartesian modes are not yet supported
2 changes: 1 addition & 1 deletion doc/wiki/4_Controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ __Required parameters__: None

#### `fri_configuration_controller`

The `receive_multiplier` parameter of FRI defines the answer rate factor (ratio of receiving states and sending commands). This is a parameter of the hardware interface, which can be modified in connected state, when control is not active. To support changing this parameter after startup, the `FRIConfigurationController` implements a service named `~/set_receive_multiplier`. Sending a request containing the desired integer value of the `receive_multiplier` updates the parameter of the hardware interface.
The `SendPeriodMilliSec` parameter of FRI defines the period with which the controller sends state updates, while the `ReceiveMultiplier` defines the answer rate factor (ratio of receiving states and sending commands). These are parameters of the hardware interface, which can be modified in connected state, when control is not active. To support changing these parameters after startup, the `FRIConfigurationController` advertises the topic `~/set_fri_config`. Sending a message containing the desired integer values of `send_period_ms` and `receive_multiplier` updates the parameters of the hardware interface.

__Required parameters__: None
4 changes: 2 additions & 2 deletions doc/wiki/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The startup procedure for any system in ROS can be defined using a launch file,
The last issue should be certainly prevented from happening, therefore it was decided to extend the default startup procedure with a [lifecycle interface](https://design.ros2.org/articles/node_lifecycle.html), that synchronizes all components of the driver. The hardware interfaces and controllers already have a lifecycle interface, but by default they are loaded and activated at startup. This configuration was modified to only load the hardware interfaces and controllers, configuration and activation is handled by a custom a lifecycle node, called `robot_manager`. The 3 states of the `robot_manager` node have the following meaning:

- `unconfigured`: all necessary components are started, but no connection is needed to the robot
- `configured`: The driver has configured the parameters necessary to start external control. Connection to the robot might be needed. (All of the parameters have default values in the driver, which are set on the robot controller during configuration.) A few [configuration controllers](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#configuration-controllers) might be active, that handle the runtime parameters of the hardware interface.
- `configured`: The driver has valid parameters configured, external control can be initiated. It is possible to change most parameters (with the exception of IP addresses and robot model) in this state without having to clean up the `robot_manager` node. Connection to the robot might be needed. (All of the parameters have default values in the driver, which are set on the robot controller during configuration.) A few [configuration controllers](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#configuration-controllers) might be active, that handle the runtime parameters of the hardware interface.
- `active`: external control is running with cyclic real-time communication, controllers are active

To achieve these synchronized states, the state transitions of the system do the following steps (implemented by the launch file and the `robot_manager` node):
Expand All @@ -61,7 +61,7 @@ The control mode specifications are also part of the common API. They are define

- joint position control: the driver streams cyclic position updates for every joint.
- Needed command interface(s): `position`
- joint impedance control: the driver streams cyclic position updates for every joint and additionally stiffness [Nm/rad] and normalized damping [-] attributes, which define how the joint reacts to external effects (around the setpoint position). The effect of gravity is compensated internally.
- joint impedance control: the driver streams cyclic position updates for every joint and additionally stiffness [Nm/rad] and normalized damping [-] attributes, which define how the joint reacts to external effects (around the setpoint position). The effect of gravity is compensated internally. (FRI does not allow changing the impedance attributes in runtime, therefore the initial damping and stiffness values are valid for the whole motion.)
- Needed command interface(s): `position`, `stiffness`, `damping`
- joint velocity control: the driver streams cyclic velocity updates for every joint.
- Needed command interface(s): `velocity`
Expand Down
4 changes: 1 addition & 3 deletions kuka_driver_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
"srv/SetInt.srv"
"srv/GetInt.srv"
"srv/SetDouble.srv"
"msg/FriConfiguration.msg"
"msg/FRIState.msg"
)

Expand Down
3 changes: 3 additions & 0 deletions kuka_driver_interfaces/msg/FriConfiguration.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Message with the modifiable values of FRI configuration
int32 receive_multiplier
int32 send_period_ms
3 changes: 0 additions & 3 deletions kuka_driver_interfaces/srv/GetInt.srv

This file was deleted.

5 changes: 0 additions & 5 deletions kuka_driver_interfaces/srv/SetDouble.srv

This file was deleted.

Loading

0 comments on commit 8e7571c

Please sign in to comment.