Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ output pins with `std_msgs` publishers and subscribers, respectively.

[machinekit]: http://machinekit.io
[ros2_control]: https://github.com/ros-controls/ros2_control

[ros2_control_demos]:https://github.com/ros-controls/ros2_control_demos
## The `hal_hw_interface` real-time component

The `hal_control_node` HAL component runs a
Expand Down Expand Up @@ -64,11 +64,12 @@ start netting pins before the HAL components are loaded and ready.
- A real-time kernel, either RT_PREEMPT or Xenomai
- Required by Machinekit for low-latency control
- See the `linux-image-rt-*` packages available in Debian Stretch.
- [`ros_control_boilerplate`][ros_control_boilerplate]
- [`ros2_control`][ros2_control]
- Required by the `hal_hw_interface`
- This may be installed in package form
- Optional: The `ros2_control_demos` repo
- Optional: The [`ros2_control_demos`][ros2_control_demos] repo
- Required to run the `hal_rrbot_control` demo
- This may also be installed in package form
- Follow the notes in that project's README to install

-----
Expand All @@ -84,7 +85,7 @@ Run the simulated hardware interface:
ros2 launch hal_rrbot_control rrbot.launch.py
# Debugging: append `hal_debug_output:=1 hal_debug_level:=5`
# Trajectory controller: append
# `robot_controller:=position_trajectory_controller`
# `robot_controller:=joint_trajectory_position_controller`

Run `halscope` to visualize HAL joint commands and feedback; in the
GUI, set the "Run Mode" to "Roll" for continuous updating:
Expand All @@ -95,28 +96,28 @@ The simulated trajectories are launched directly from the
`ros2_control_demo_bringup` package:

ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py
# Or for robot_controller:=position_trajectory_controller:
ros2 launch ros2_control_demo_bringup test_joint_trajectory_controller.launch.py
# Or for robot_controller:=joint_trajectory_position_controller:
ros2 launch ros2_control_demo_bringup test_joint_trajectory_position_controller.launch.py

Load and switch to the trajectory controller at run time:

# Load and configure the trajectory controller
ros2 service call \
/controller_manager/load_and_configure_controller \
controller_manager_msgs/srv/LoadConfigureController \
'{name: "position_trajectory_controller"}'
'{name: "joint_trajectory_position_controller"}'

# Switch to the trajectory controller
ros2 service call \
/controller_manager/switch_controller \
controller_manager_msgs/srv/SwitchController \
'{start_controllers: ["position_trajectory_controller"],
'{start_controllers: ["joint_trajectory_position_controller"],
stop_controllers: ["forward_position_controller"],
strictness: 1, start_asap: true,
timeout: {sec: 0, nanosec: 10000000}
}'

# Verify the switch: 'position_trajectory_controller' state='active'
# Verify the switch: 'joint_trajectory_position_controller' state='active'
ros2 service call \
/controller_manager/list_controllers \
controller_manager_msgs/srv/ListControllers
Expand Down
4 changes: 2 additions & 2 deletions hal_hw_interface/cmake/FindHAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ set(MACHINEKIT_RIP_PATH

# HAL_INCLUDE_PATH: Find HAL include directory
find_path(
HAL_INCLUDE_PATH hal.h
PATH_SUFFIXES machinekit
HAL_INCLUDE_PATH hal/hal.h
PATH_SUFFIXES machinekit/hal
PATHS ${MACHINEKIT_RIP_PATH}/include
)

Expand Down
4 changes: 2 additions & 2 deletions hal_hw_interface/hal_hw_interface/hal_mgr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import subprocess
from machinekit import config
#from machinekit import config
from .ros_hal_component import RosHalComponent

# ROS
Expand Down Expand Up @@ -52,7 +52,7 @@ def start_realtime(self):
env = dict(
DEBUG=d_lev,
SYSLOG_TO_STDERR=d_out,
MACHINEKIT_INI=config.Config().MACHINEKIT_INI,
MACHINEKIT_INI="/etc/machinekit/hal/machinekit.ini",
FASTRTPS_DEFAULT_PROFILES_FILE=fastrtps_profiles,
**os.environ,
)
Expand Down
2 changes: 1 addition & 1 deletion hal_hw_interface/hal_hw_interface/hal_pin_attrs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import hal
import machinekit.hal.pyhal as hal


class HalPinAttrBase(int):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from launch_ros.actions import Node

from machinekit import rtapi
from machinekit.hal.cyruntime import rtapi
from .hal_ready import HalReady


Expand Down
3 changes: 2 additions & 1 deletion hal_hw_interface/hal_hw_interface/launch/hal_rt_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackagePrefix

from machinekit import rtapi, hal
from machinekit.hal.cyruntime import rtapi
import machinekit.hal.cyhal as hal
from .hal_ordered_action import HalOrderedNode, HalThreadedReadyAction


Expand Down
2 changes: 1 addition & 1 deletion hal_hw_interface/hal_hw_interface/launch/hal_user_node.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from machinekit import hal
import machinekit.hal.cyhal as hal
from launch import logging
from .hal_ordered_action import HalOrderedNode, HalAsyncReadyAction

Expand Down
4 changes: 2 additions & 2 deletions hal_hw_interface/hal_hw_interface/loadrt_local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import rclpy
import os
from machinekit import rtapi, hal

from machinekit.hal.cyruntime import rtapi
import machinekit.hal.pyhal as hal

def loadrt_local(modname):
"""
Expand Down
2 changes: 1 addition & 1 deletion hal_hw_interface/hal_hw_interface/ros_hal_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import abc
import hal
import machinekit.hal.pyhal as hal
import rclpy
from .hal_obj_base import HalObjBase
from .exception import HalHWInterfaceException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import hal
import machinekit.hal.pyhal as hal

from hal_hw_interface.hal_pin_attrs import HalPinDir, HalPinType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define HAL_HW_INTERFACE__HAL_ROS_LOGGING_HPP_

// HAL
#include <hal.h>
#include <hal/hal.h>

// ROS
#include <rclcpp/logging.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#endif

// HAL
#include <hal.h>
#include <hal/hal.h>

#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion hal_hw_interface/src/hal_control_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdlib.h>
#include <pthread.h> // pthread_setname_np()
#include <unistd.h> // sleep()
#include <hal.h> // HAL public API decls
#include <hal/hal.h> // HAL public API decls
#include <rclcpp/rclcpp.hpp>
#include <controller_manager/controller_manager.hpp>
#include <controller_manager_msgs/srv/switch_controller.hpp>
Expand Down
4 changes: 2 additions & 2 deletions hal_hw_interface/src/hal_system_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
// Disable warnings that need to be fixed in external headers
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <hal.h> // HAL public API decls
#include <hal_priv.h> // halpr_find_comp_by_name
#include <hal/hal.h> // HAL public API decls
#include <hal/hal_priv.h> // halpr_find_comp_by_name
#pragma GCC diagnostic pop

#include <hal_hw_interface/hal_system_interface.hpp>
Expand Down