file_path
stringlengths 21
224
| content
stringlengths 0
80.8M
|
---|---|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/carter_navigation/params/office/multi_robot_carter_navigation_params_1.yaml | amcl:
ros__parameters:
use_sim_time: True
alpha1: 0.2
alpha2: 0.2
alpha3: 0.2
alpha4: 0.2
alpha5: 0.2
base_frame_id: "base_link"
beam_skip_distance: 0.5
beam_skip_error_threshold: 0.9
beam_skip_threshold: 0.3
do_beamskip: false
global_frame_id: "map"
lambda_short: 0.1
laser_likelihood_max_dist: 2.0
laser_max_range: 100.0
laser_min_range: 0.4
laser_model_type: "likelihood_field"
max_beams: 60
max_particles: 2000
min_particles: 500
odom_frame_id: "odom"
pf_err: 0.05
pf_z: 0.99
recovery_alpha_fast: 0.0
recovery_alpha_slow: 0.0
resample_interval: 3
robot_model_type: "differential"
save_pose_rate: 0.5
sigma_hit: 0.2
tf_broadcast: true
transform_tolerance: 1.0
update_min_a: 0.2
update_min_d: 0.25
z_hit: 0.5
z_max: 0.05
z_rand: 0.5
z_short: 0.05
set_initial_pose: True
initial_pose: {x: -3.0, y: -6.0, z: 0.0, yaw: 3.14159}
amcl_map_client:
ros__parameters:
use_sim_time: True
amcl_rclcpp_node:
ros__parameters:
use_sim_time: True
bt_navigator:
ros__parameters:
use_sim_time: True
enable_groot_monitoring: False
global_frame: map
robot_base_frame: base_link
odom_topic: odom
default_bt_xml_filename: "navigate_w_replanning_and_recovery.xml"
plugin_lib_names:
- nav2_compute_path_to_pose_action_bt_node
- nav2_follow_path_action_bt_node
- nav2_back_up_action_bt_node
- nav2_spin_action_bt_node
- nav2_wait_action_bt_node
- nav2_clear_costmap_service_bt_node
- nav2_is_stuck_condition_bt_node
- nav2_goal_reached_condition_bt_node
- nav2_goal_updated_condition_bt_node
- nav2_initial_pose_received_condition_bt_node
- nav2_reinitialize_global_localization_service_bt_node
- nav2_rate_controller_bt_node
- nav2_distance_controller_bt_node
- nav2_speed_controller_bt_node
- nav2_recovery_node_bt_node
- nav2_pipeline_sequence_bt_node
- nav2_round_robin_node_bt_node
- nav2_transform_available_condition_bt_node
- nav2_time_expired_condition_bt_node
- nav2_distance_traveled_condition_bt_node
bt_navigator_rclcpp_node:
ros__parameters:
use_sim_time: True
enable_groot_monitoring: False
velocity_smoother:
ros__parameters:
smoothing_frequency: 20.0
scale_velocities: false
feedback: "OPEN_LOOP"
max_velocity: [1.8, 0.0, 1.2]
min_velocity: [-1.8, 0.0, -1.2]
# deadband_velocity: [0.0, 0.0, 0.0]
velocity_timeout: 1.0
# max_accel: [1.0, 0.0, 1.25]
# max_decel: [-1.0, 0.0, -1.25]
odom_topic: "odom"
odom_duration: 0.1
controller_server:
ros__parameters:
use_sim_time: True
controller_frequency: 20.0
min_x_velocity_threshold: 0.001
min_y_velocity_threshold: 0.5
min_theta_velocity_threshold: 0.001
controller_plugins: ["FollowPath"]
# DWB parameters
FollowPath:
plugin: "dwb_core::DWBLocalPlanner"
debug_trajectory_details: True
min_vel_x: 0.0
min_vel_y: 0.0
max_vel_x: 1.8
max_vel_y: 0.0
max_vel_theta: 1.2
min_speed_xy: 0.0
max_speed_xy: 1.0
min_speed_theta: 0.0
acc_lim_x: 2.5
acc_lim_y: 0.0
acc_lim_theta: 3.2
decel_lim_x: -2.5
decel_lim_y: 0.0
decel_lim_theta: -3.2
vx_samples: 20
vy_samples: 5
vtheta_samples: 20
sim_time: 1.7
linear_granularity: 0.05
angular_granularity: 0.025
transform_tolerance: 0.2
xy_goal_tolerance: 0.25
trans_stopped_velocity: 0.25
short_circuit_trajectory_evaluation: True
stateful: True
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
BaseObstacle.scale: 0.02
PathAlign.scale: 32.0
PathAlign.forward_point_distance: 0.1
GoalAlign.scale: 24.0
GoalAlign.forward_point_distance: 0.1
PathDist.scale: 32.0
GoalDist.scale: 24.0
RotateToGoal.scale: 32.0
RotateToGoal.slowing_factor: 5.0
RotateToGoal.lookahead_time: -1.0
controller_server_rclcpp_node:
ros__parameters:
use_sim_time: True
local_costmap:
local_costmap:
ros__parameters:
update_frequency: 5.0
publish_frequency: 2.0
footprint_padding: 0.25
global_frame: odom
robot_base_frame: base_link
use_sim_time: True
rolling_window: True
width: 10
height: 10
resolution: 0.05
transform_tolerance: 0.3
footprint: "[ [0.14, 0.25], [0.14, -0.25], [-0.607, -0.25], [-0.607, 0.25] ]"
plugins: ["hesai_voxel_layer", "front_rplidar_obstacle_layer", "back_rplidar_obstacle_layer", "inflation_layer"]
# plugins: ["hesai_voxel_layer", "inflation_layer"]
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
enabled: True
cost_scaling_factor: 0.3
inflation_radius: 1.0
hesai_voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: False
origin_z: 0.0
z_voxels: 16
z_resolution: 0.2
unknown_threshold: 15
observation_sources: pointcloud
pointcloud: # no frame set, uses frame from message
topic: /carter1/front_3d_lidar/point_cloud
max_obstacle_height: 2.0
min_obstacle_height: 0.1
obstacle_max_range: 10.0
obstacle_min_range: 0.0
raytrace_max_range: 10.0
raytrace_min_range: 0.0
clearing: True
marking: True
data_type: "PointCloud2"
front_rplidar_obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter1/front_2d_lidar/scan
max_obstacle_height: 2.0
raytrace_max_range: 25
clearing: True
marking: True
data_type: "LaserScan"
back_rplidar_obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter1/back_2d_lidar/scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
local_costmap_client:
ros__parameters:
use_sim_time: True
local_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
global_costmap:
global_costmap:
ros__parameters:
footprint_padding: 0.25
update_frequency: 1.0
publish_frequency: 1.0
global_frame: map
robot_base_frame: base_link
use_sim_time: True
footprint: "[ [0.14, 0.25], [0.14, -0.25], [-0.607, -0.25], [-0.607, 0.25] ]"
resolution: 0.05
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter1/scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 10.0
raytrace_min_range: 0.0
obstacle_max_range: 10.0
obstacle_min_range: 0.0
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 0.3
inflation_radius: 1.0
always_send_full_costmap: True
global_costmap_client:
ros__parameters:
use_sim_time: True
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
map_server:
ros__parameters:
use_sim_time: True
yaml_filename: "carter_hospital_navigation.yaml"
map_saver:
ros__parameters:
use_sim_time: True
save_map_timeout: 5000
free_thresh_default: 0.25
occupied_thresh_default: 0.65
map_subscribe_transient_local: True
planner_server:
ros__parameters:
expected_planner_frequency: 10.0
use_sim_time: True
planner_plugins: ["GridBased"]
GridBased:
plugin: "nav2_navfn_planner/NavfnPlanner"
tolerance: 0.5
use_astar: false
allow_unknown: true
planner_server_rclcpp_node:
ros__parameters:
use_sim_time: True
recoveries_server:
ros__parameters:
costmap_topic: local_costmap/costmap_raw
footprint_topic: local_costmap/published_footprint
cycle_frequency: 10.0
recovery_plugins: ["spin", "backup", "wait"]
spin:
plugin: "nav2_recoveries/Spin"
backup:
plugin: "nav2_recoveries/BackUp"
wait:
plugin: "nav2_recoveries/Wait"
global_frame: odom
robot_base_frame: base_link
transform_timeout: 0.2
use_sim_time: True
simulate_ahead_time: 2.0
max_rotational_vel: 1.0
min_rotational_vel: 0.4
rotational_acc_lim: 3.2
robot_state_publisher:
ros__parameters:
use_sim_time: True
waypoint_follower:
ros__parameters:
use_sim_time: True
loop_rate: 20
stop_on_failure: false
waypoint_task_executor_plugin: "wait_at_waypoint"
wait_at_waypoint:
plugin: "nav2_waypoint_follower::WaitAtWaypoint"
enabled: True
waypoint_pause_duration: 200
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/carter_navigation/params/office/multi_robot_carter_navigation_params_3.yaml | amcl:
ros__parameters:
use_sim_time: True
alpha1: 0.2
alpha2: 0.2
alpha3: 0.2
alpha4: 0.2
alpha5: 0.2
base_frame_id: "base_link"
beam_skip_distance: 0.5
beam_skip_error_threshold: 0.9
beam_skip_threshold: 0.3
do_beamskip: false
global_frame_id: "map"
lambda_short: 0.1
laser_likelihood_max_dist: 2.0
laser_max_range: 100.0
laser_min_range: 0.4
laser_model_type: "likelihood_field"
max_beams: 60
max_particles: 2000
min_particles: 500
odom_frame_id: "odom"
pf_err: 0.05
pf_z: 0.99
recovery_alpha_fast: 0.0
recovery_alpha_slow: 0.0
resample_interval: 3
robot_model_type: "differential"
save_pose_rate: 0.5
sigma_hit: 0.2
tf_broadcast: true
transform_tolerance: 1.0
update_min_a: 0.2
update_min_d: 0.25
z_hit: 0.5
z_max: 0.05
z_rand: 0.5
z_short: 0.05
set_initial_pose: True
initial_pose: {x: -2.0, y: 5.0, z: 0.0, yaw: 3.14159}
amcl_map_client:
ros__parameters:
use_sim_time: True
amcl_rclcpp_node:
ros__parameters:
use_sim_time: True
bt_navigator:
ros__parameters:
use_sim_time: True
enable_groot_monitoring: False
global_frame: map
robot_base_frame: base_link
odom_topic: odom
default_bt_xml_filename: "navigate_w_replanning_and_recovery.xml"
plugin_lib_names:
- nav2_compute_path_to_pose_action_bt_node
- nav2_follow_path_action_bt_node
- nav2_back_up_action_bt_node
- nav2_spin_action_bt_node
- nav2_wait_action_bt_node
- nav2_clear_costmap_service_bt_node
- nav2_is_stuck_condition_bt_node
- nav2_goal_reached_condition_bt_node
- nav2_goal_updated_condition_bt_node
- nav2_initial_pose_received_condition_bt_node
- nav2_reinitialize_global_localization_service_bt_node
- nav2_rate_controller_bt_node
- nav2_distance_controller_bt_node
- nav2_speed_controller_bt_node
- nav2_recovery_node_bt_node
- nav2_pipeline_sequence_bt_node
- nav2_round_robin_node_bt_node
- nav2_transform_available_condition_bt_node
- nav2_time_expired_condition_bt_node
- nav2_distance_traveled_condition_bt_node
bt_navigator_rclcpp_node:
ros__parameters:
use_sim_time: True
enable_groot_monitoring: False
velocity_smoother:
ros__parameters:
smoothing_frequency: 20.0
scale_velocities: false
feedback: "OPEN_LOOP"
max_velocity: [1.8, 0.0, 1.2]
min_velocity: [-1.8, 0.0, -1.2]
# deadband_velocity: [0.0, 0.0, 0.0]
velocity_timeout: 1.0
# max_accel: [1.0, 0.0, 1.25]
# max_decel: [-1.0, 0.0, -1.25]
odom_topic: "odom"
odom_duration: 0.1
controller_server:
ros__parameters:
use_sim_time: True
controller_frequency: 20.0
min_x_velocity_threshold: 0.001
min_y_velocity_threshold: 0.5
min_theta_velocity_threshold: 0.001
controller_plugins: ["FollowPath"]
# DWB parameters
FollowPath:
plugin: "dwb_core::DWBLocalPlanner"
debug_trajectory_details: True
min_vel_x: 0.0
min_vel_y: 0.0
max_vel_x: 1.8
max_vel_y: 0.0
max_vel_theta: 1.2
min_speed_xy: 0.0
max_speed_xy: 1.0
min_speed_theta: 0.0
acc_lim_x: 2.5
acc_lim_y: 0.0
acc_lim_theta: 3.2
decel_lim_x: -2.5
decel_lim_y: 0.0
decel_lim_theta: -3.2
vx_samples: 20
vy_samples: 5
vtheta_samples: 20
sim_time: 1.7
linear_granularity: 0.05
angular_granularity: 0.025
transform_tolerance: 0.2
xy_goal_tolerance: 0.25
trans_stopped_velocity: 0.25
short_circuit_trajectory_evaluation: True
stateful: True
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
BaseObstacle.scale: 0.02
PathAlign.scale: 32.0
PathAlign.forward_point_distance: 0.1
GoalAlign.scale: 24.0
GoalAlign.forward_point_distance: 0.1
PathDist.scale: 32.0
GoalDist.scale: 24.0
RotateToGoal.scale: 32.0
RotateToGoal.slowing_factor: 5.0
RotateToGoal.lookahead_time: -1.0
controller_server_rclcpp_node:
ros__parameters:
use_sim_time: True
local_costmap:
local_costmap:
ros__parameters:
update_frequency: 5.0
publish_frequency: 2.0
footprint_padding: 0.25
global_frame: odom
robot_base_frame: base_link
use_sim_time: True
rolling_window: True
width: 10
height: 10
resolution: 0.05
transform_tolerance: 0.3
footprint: "[ [0.14, 0.25], [0.14, -0.25], [-0.607, -0.25], [-0.607, 0.25] ]"
plugins: ["hesai_voxel_layer", "front_rplidar_obstacle_layer", "back_rplidar_obstacle_layer", "inflation_layer"]
# plugins: ["hesai_voxel_layer", "inflation_layer"]
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
enabled: True
cost_scaling_factor: 0.3
inflation_radius: 1.0
hesai_voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: False
origin_z: 0.0
z_voxels: 16
z_resolution: 0.2
unknown_threshold: 15
observation_sources: pointcloud
pointcloud: # no frame set, uses frame from message
topic: /carter3/front_3d_lidar/point_cloud
max_obstacle_height: 2.0
min_obstacle_height: 0.1
obstacle_max_range: 10.0
obstacle_min_range: 0.0
raytrace_max_range: 10.0
raytrace_min_range: 0.0
clearing: True
marking: True
data_type: "PointCloud2"
front_rplidar_obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter3/front_2d_lidar/scan
max_obstacle_height: 2.0
raytrace_max_range: 25
clearing: True
marking: True
data_type: "LaserScan"
back_rplidar_obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter3/back_2d_lidar/scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
local_costmap_client:
ros__parameters:
use_sim_time: True
local_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
global_costmap:
global_costmap:
ros__parameters:
footprint_padding: 0.25
update_frequency: 1.0
publish_frequency: 1.0
global_frame: map
robot_base_frame: base_link
use_sim_time: True
footprint: "[ [0.14, 0.25], [0.14, -0.25], [-0.607, -0.25], [-0.607, 0.25] ]"
resolution: 0.05
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /carter3/scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 10.0
raytrace_min_range: 0.0
obstacle_max_range: 10.0
obstacle_min_range: 0.0
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 0.3
inflation_radius: 1.0
always_send_full_costmap: True
global_costmap_client:
ros__parameters:
use_sim_time: True
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
map_server:
ros__parameters:
use_sim_time: True
yaml_filename: "carter_hospital_navigation.yaml"
map_saver:
ros__parameters:
use_sim_time: True
save_map_timeout: 5000
free_thresh_default: 0.25
occupied_thresh_default: 0.65
map_subscribe_transient_local: True
planner_server:
ros__parameters:
expected_planner_frequency: 10.0
use_sim_time: True
planner_plugins: ["GridBased"]
GridBased:
plugin: "nav2_navfn_planner/NavfnPlanner"
tolerance: 0.5
use_astar: false
allow_unknown: true
planner_server_rclcpp_node:
ros__parameters:
use_sim_time: True
recoveries_server:
ros__parameters:
costmap_topic: local_costmap/costmap_raw
footprint_topic: local_costmap/published_footprint
cycle_frequency: 10.0
recovery_plugins: ["spin", "backup", "wait"]
spin:
plugin: "nav2_recoveries/Spin"
backup:
plugin: "nav2_recoveries/BackUp"
wait:
plugin: "nav2_recoveries/Wait"
global_frame: odom
robot_base_frame: base_link
transform_timeout: 0.2
use_sim_time: True
simulate_ahead_time: 2.0
max_rotational_vel: 1.0
min_rotational_vel: 0.4
rotational_acc_lim: 3.2
robot_state_publisher:
ros__parameters:
use_sim_time: True
waypoint_follower:
ros__parameters:
use_sim_time: True
loop_rate: 20
stop_on_failure: false
waypoint_task_executor_plugin: "wait_at_waypoint"
wait_at_waypoint:
plugin: "nav2_waypoint_follower::WaitAtWaypoint"
enabled: True
waypoint_pause_duration: 200
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/setup.py | from setuptools import setup
from glob import glob
import os
package_name = "isaac_ros_navigation_goal"
setup(
name=package_name,
version="0.0.1",
packages=[package_name, package_name + "/goal_generators"],
data_files=[
("share/ament_index/resource_index/packages", ["resource/" + package_name]),
("share/" + package_name, ["package.xml"]),
(os.path.join("share", package_name, "launch"), glob("launch/*.launch.py")),
("share/" + package_name + "/assets", glob("assets/*")),
],
install_requires=["setuptools"],
zip_safe=True,
maintainer="isaac sim",
maintainer_email="[email protected]",
description="Package to set goals for navigation stack.",
license="NVIDIA Isaac ROS Software License",
tests_require=["pytest"],
entry_points={"console_scripts": ["SetNavigationGoal = isaac_ros_navigation_goal.set_goal:main"]},
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/CMakeLists.txt | cmake_minimum_required(VERSION 3.5)
project(isaac_ros_navigation_goal LANGUAGES PYTHON)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
message( STATUS "Architecture: ${ARCHITECTURE}" )
set(CUDA_MIN_VERSION "10.2")
# Find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclpy REQUIRED)
ament_auto_find_build_dependencies()
# Install Python modules
ament_python_install_package(${PROJECT_NAME})
# Install Python executables
install(PROGRAMS
isaac_ros_navigation_goal/set_goal.py
DESTINATION lib/${PROJECT_NAME}
)
ament_auto_package(INSTALL_TO_SHARE)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/package.xml | <?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>isaac_ros_navigation_goal</name>
<version>0.1.0</version>
<description>Package to set goals for navigation stack.</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<url type="Website">https://developer.nvidia.com/isaac-ros-gems/</url>
<build_depend>rclpy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>nav2_msgs</build_depend>
<build_depend>nav2_bringup</build_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/test/test_flake8.py | # Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_flake8.main import main_with_errors
import pytest
@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
assert rc == 0, "Found %d code style errors / warnings:\n" % len(errors) + "\n".join(errors)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/test/test_pep257.py | # Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_pep257.main import main
import pytest
@pytest.mark.linter
@pytest.mark.pep257
def test_pep257():
rc = main(argv=[".", "test"])
assert rc == 0, "Found code style errors / warnings"
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/launch/isaac_ros_navigation_goal.launch.py | # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
map_yaml_file = LaunchConfiguration(
"map_yaml_path",
default=os.path.join(
get_package_share_directory("isaac_ros_navigation_goal"), "assets", "carter_warehouse_navigation.yaml"
),
)
goal_text_file = LaunchConfiguration(
"goal_text_file_path",
default=os.path.join(get_package_share_directory("isaac_ros_navigation_goal"), "assets", "goals.txt"),
)
navigation_goal_node = Node(
name="set_navigation_goal",
package="isaac_ros_navigation_goal",
executable="SetNavigationGoal",
parameters=[
{
"map_yaml_path": map_yaml_file,
"iteration_count": 3,
"goal_generator_type": "RandomGoalGenerator",
"action_server_name": "navigate_to_pose",
"obstacle_search_distance_in_meters": 0.2,
"goal_text_file_path": goal_text_file,
"initial_pose": [-6.4, -1.04, 0.0, 0.0, 0.0, 0.99, 0.02],
}
],
output="screen",
)
return LaunchDescription([navigation_goal_node])
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/obstacle_map.py | import numpy as np
import yaml
import os
import math
from PIL import Image
class GridMap:
def __init__(self, yaml_file_path):
self.__get_meta_from_yaml(yaml_file_path)
self.__get_raw_map()
self.__add_max_range_to_meta()
# print(self.__map_meta)
def __get_meta_from_yaml(self, yaml_file_path):
"""
Reads map meta from the yaml file.
Parameters
----------
yaml_file_path: path of the yaml file.
"""
with open(yaml_file_path, "r") as f:
file_content = f.read()
self.__map_meta = yaml.safe_load(file_content)
self.__map_meta["image"] = os.path.join(os.path.dirname(yaml_file_path), self.__map_meta["image"])
def __get_raw_map(self):
"""
Reads the map image and generates the grid map.\n
Grid map is a 2D boolean matrix where True=>occupied space & False=>Free space.
"""
img = Image.open(self.__map_meta.get("image"))
img = np.array(img)
# Anything greater than free_thresh is considered as occupied
if self.__map_meta["negate"]:
res = np.where((img / 255)[:, :, 0] > self.__map_meta["free_thresh"])
else:
res = np.where(((255 - img) / 255)[:, :, 0] > self.__map_meta["free_thresh"])
self.__grid_map = np.zeros(shape=(img.shape[:2]), dtype=bool)
for i in range(res[0].shape[0]):
self.__grid_map[res[0][i], res[1][i]] = 1
def __add_max_range_to_meta(self):
"""
Calculates and adds the max value of pose in x & y direction to the meta.
"""
max_x = self.__grid_map.shape[1] * self.__map_meta["resolution"] + self.__map_meta["origin"][0]
max_y = self.__grid_map.shape[0] * self.__map_meta["resolution"] + self.__map_meta["origin"][1]
self.__map_meta["max_x"] = round(max_x, 2)
self.__map_meta["max_y"] = round(max_y, 2)
def __pad_obstacles(self, distance):
pass
def get_range(self):
"""
Returns the bounds of pose values in x & y direction.\n
Returns
-------
[List]:\n
Where list[0][0]: min value in x direction
list[0][1]: max value in x direction
list[1][0]: min value in y direction
list[1][1]: max value in y direction
"""
return [
[self.__map_meta["origin"][0], self.__map_meta["max_x"]],
[self.__map_meta["origin"][1], self.__map_meta["max_y"]],
]
def __transform_to_image_coordinates(self, point):
"""
Transforms a pose in meters to image pixel coordinates.
Parameters
----------
Point: A point as list. where list[0]=>pose.x and list[1]=pose.y
Returns
-------
[Tuple]: tuple[0]=>pixel value in x direction. i.e column index.
tuple[1]=> pixel vlaue in y direction. i.e row index.
"""
p_x, p_y = point
i_x = math.floor((p_x - self.__map_meta["origin"][0]) / self.__map_meta["resolution"])
i_y = math.floor((p_y - self.__map_meta["origin"][1]) / self.__map_meta["resolution"])
# because origin in yaml is at bottom left of image
i_y = self.__grid_map.shape[0] - i_y
return i_x, i_y
def __transform_distance_to_pixels(self, distance):
"""
Converts the distance in meters to number of pixels based on the resolution.
Parameters
----------
distance: value in meters
Returns
-------
[Integer]: number of pixel which represent the same distance.
"""
return math.ceil(distance / self.__map_meta["resolution"])
def __is_obstacle_in_distance(self, img_point, distance):
"""
Checks if any obstacle is in vicinity of the given image point.
Parameters
----------
img_point: pixel values of the point
distance: distnace in pixels in which there shouldn't be any obstacle.
Returns
-------
[Bool]: True if any obstacle found else False.
"""
# need to make sure that patch xmin & ymin are >=0,
# because of python's negative indexing capability
row_start_idx = 0 if img_point[1] - distance < 0 else img_point[1] - distance
col_start_idx = 0 if img_point[0] - distance < 0 else img_point[0] - distance
# image point acts as the center of the square, where each side of square is of size
# 2xdistance
patch = self.__grid_map[row_start_idx : img_point[1] + distance, col_start_idx : img_point[0] + distance]
obstacles = np.where(patch == True)
return len(obstacles[0]) > 0
def is_valid_pose(self, point, distance=0.2):
"""
Checks if a given pose is "distance" away from a obstacle.
Parameters
----------
point: pose in 2D space. where point[0]=pose.x and point[1]=pose.y
distance: distance in meters.
Returns
-------
[Bool]: True if pose is valid else False
"""
assert len(point) == 2
img_point = self.__transform_to_image_coordinates(point)
img_pixel_distance = self.__transform_distance_to_pixels(distance)
# Pose is not valid if there is obstacle in the vicinity
return not self.__is_obstacle_in_distance(img_point, img_pixel_distance)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/__init__.py | |
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/set_goal.py | import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node
from nav2_msgs.action import NavigateToPose
from .obstacle_map import GridMap
from .goal_generators import RandomGoalGenerator, GoalReader
import sys
from geometry_msgs.msg import PoseWithCovarianceStamped
import time
class SetNavigationGoal(Node):
def __init__(self):
super().__init__("set_navigation_goal")
self.declare_parameters(
namespace="",
parameters=[
("iteration_count", 1),
("goal_generator_type", "RandomGoalGenerator"),
("action_server_name", "navigate_to_pose"),
("obstacle_search_distance_in_meters", 0.2),
("frame_id", "map"),
("map_yaml_path", None),
("goal_text_file_path", None),
("initial_pose", None),
],
)
self.__goal_generator = self.__create_goal_generator()
action_server_name = self.get_parameter("action_server_name").value
self._action_client = ActionClient(self, NavigateToPose, action_server_name)
self.MAX_ITERATION_COUNT = self.get_parameter("iteration_count").value
assert self.MAX_ITERATION_COUNT > 0
self.curr_iteration_count = 1
self.__initial_goal_publisher = self.create_publisher(PoseWithCovarianceStamped, "/initialpose", 1)
self.__initial_pose = self.get_parameter("initial_pose").value
self.__is_initial_pose_sent = True if self.__initial_pose is None else False
def __send_initial_pose(self):
"""
Publishes the initial pose.
This function is only called once that too before sending any goal pose
to the mission server.
"""
goal = PoseWithCovarianceStamped()
goal.header.frame_id = self.get_parameter("frame_id").value
goal.header.stamp = self.get_clock().now().to_msg()
goal.pose.pose.position.x = self.__initial_pose[0]
goal.pose.pose.position.y = self.__initial_pose[1]
goal.pose.pose.position.z = self.__initial_pose[2]
goal.pose.pose.orientation.x = self.__initial_pose[3]
goal.pose.pose.orientation.y = self.__initial_pose[4]
goal.pose.pose.orientation.z = self.__initial_pose[5]
goal.pose.pose.orientation.w = self.__initial_pose[6]
self.__initial_goal_publisher.publish(goal)
def send_goal(self):
"""
Sends the goal to the action server.
"""
if not self.__is_initial_pose_sent:
self.get_logger().info("Sending initial pose")
self.__send_initial_pose()
self.__is_initial_pose_sent = True
# Assumption is that initial pose is set after publishing first time in this duration.
# Can be changed to more sophisticated way. e.g. /particlecloud topic has no msg until
# the initial pose is set.
time.sleep(10)
self.get_logger().info("Sending first goal")
self._action_client.wait_for_server()
goal_msg = self.__get_goal()
if goal_msg is None:
rclpy.shutdown()
sys.exit(1)
self._send_goal_future = self._action_client.send_goal_async(
goal_msg, feedback_callback=self.__feedback_callback
)
self._send_goal_future.add_done_callback(self.__goal_response_callback)
def __goal_response_callback(self, future):
"""
Callback function to check the response(goal accpted/rejected) from the server.\n
If the Goal is rejected it stops the execution for now.(We can change to resample the pose if rejected.)
"""
goal_handle = future.result()
if not goal_handle.accepted:
self.get_logger().info("Goal rejected :(")
rclpy.shutdown()
return
self.get_logger().info("Goal accepted :)")
self._get_result_future = goal_handle.get_result_async()
self._get_result_future.add_done_callback(self.__get_result_callback)
def __get_goal(self):
"""
Get the next goal from the goal generator.
Returns
-------
[NavigateToPose][goal] or None if the next goal couldn't be generated.
"""
goal_msg = NavigateToPose.Goal()
goal_msg.pose.header.frame_id = self.get_parameter("frame_id").value
goal_msg.pose.header.stamp = self.get_clock().now().to_msg()
pose = self.__goal_generator.generate_goal()
# couldn't sample a pose which is not close to obstacles. Rare but might happen in dense maps.
if pose is None:
self.get_logger().error(
"Could not generate next goal. Returning. Possible reasons for this error could be:"
)
self.get_logger().error(
"1. If you are using GoalReader then please make sure iteration count <= number of goals avaiable in file."
)
self.get_logger().error(
"2. If RandomGoalGenerator is being used then it was not able to sample a pose which is given distance away from the obstacles."
)
return
self.get_logger().info("Generated goal pose: {0}".format(pose))
goal_msg.pose.pose.position.x = pose[0]
goal_msg.pose.pose.position.y = pose[1]
goal_msg.pose.pose.orientation.x = pose[2]
goal_msg.pose.pose.orientation.y = pose[3]
goal_msg.pose.pose.orientation.z = pose[4]
goal_msg.pose.pose.orientation.w = pose[5]
return goal_msg
def __get_result_callback(self, future):
"""
Callback to check result.\n
It calls the send_goal() function in case current goal sent count < required goals count.
"""
# Nav2 is sending empty message for success as well as for failure.
result = future.result().result
self.get_logger().info("Result: {0}".format(result.result))
if self.curr_iteration_count < self.MAX_ITERATION_COUNT:
self.curr_iteration_count += 1
self.send_goal()
else:
rclpy.shutdown()
def __feedback_callback(self, feedback_msg):
"""
This is feeback callback. We can compare/compute/log while the robot is on its way to goal.
"""
# self.get_logger().info('FEEDBACK: {}\n'.format(feedback_msg))
pass
def __create_goal_generator(self):
"""
Creates the GoalGenerator object based on the specified ros param value.
"""
goal_generator_type = self.get_parameter("goal_generator_type").value
goal_generator = None
if goal_generator_type == "RandomGoalGenerator":
if self.get_parameter("map_yaml_path").value is None:
self.get_logger().info("Yaml file path is not given. Returning..")
sys.exit(1)
yaml_file_path = self.get_parameter("map_yaml_path").value
grid_map = GridMap(yaml_file_path)
obstacle_search_distance_in_meters = self.get_parameter("obstacle_search_distance_in_meters").value
assert obstacle_search_distance_in_meters > 0
goal_generator = RandomGoalGenerator(grid_map, obstacle_search_distance_in_meters)
elif goal_generator_type == "GoalReader":
if self.get_parameter("goal_text_file_path").value is None:
self.get_logger().info("Goal text file path is not given. Returning..")
sys.exit(1)
file_path = self.get_parameter("goal_text_file_path").value
goal_generator = GoalReader(file_path)
else:
self.get_logger().info("Invalid goal generator specified. Returning...")
sys.exit(1)
return goal_generator
def main():
rclpy.init()
set_goal = SetNavigationGoal()
result = set_goal.send_goal()
rclpy.spin(set_goal)
if __name__ == "__main__":
main()
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/goal_generators/goal_reader.py | from .goal_generator import GoalGenerator
class GoalReader(GoalGenerator):
def __init__(self, file_path):
self.__file_path = file_path
self.__generator = self.__get_goal()
def generate_goal(self, max_num_of_trials=1000):
try:
return next(self.__generator)
except StopIteration:
return
def __get_goal(self):
for row in open(self.__file_path, "r"):
yield list(map(float, row.strip().split(" ")))
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/goal_generators/random_goal_generator.py | import numpy as np
from .goal_generator import GoalGenerator
class RandomGoalGenerator(GoalGenerator):
"""
Random goal generator.
parameters
----------
grid_map: GridMap Object
distance: distance in meters to check vicinity for obstacles.
"""
def __init__(self, grid_map, distance):
self.__grid_map = grid_map
self.__distance = distance
def generate_goal(self, max_num_of_trials=1000):
"""
Generate the goal.
Parameters
----------
max_num_of_trials: maximum number of pose generations when generated pose keep is not a valid pose.
Returns
-------
[List][Pose]: Pose in format [pose.x,pose.y,orientaion.x,orientaion.y,orientaion.z,orientaion.w]
"""
range_ = self.__grid_map.get_range()
trial_count = 0
while trial_count < max_num_of_trials:
x = np.random.uniform(range_[0][0], range_[0][1])
y = np.random.uniform(range_[1][0], range_[1][1])
orient_x = np.random.uniform(0, 1)
orient_y = np.random.uniform(0, 1)
orient_z = np.random.uniform(0, 1)
orient_w = np.random.uniform(0, 1)
if self.__grid_map.is_valid_pose([x, y], self.__distance):
goal = [x, y, orient_x, orient_y, orient_z, orient_w]
return goal
trial_count += 1
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/goal_generators/__init__.py | from .random_goal_generator import RandomGoalGenerator
from .goal_reader import GoalReader
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/isaac_ros_navigation_goal/goal_generators/goal_generator.py | from abc import ABC, abstractmethod
class GoalGenerator(ABC):
"""
Parent class for the Goal generators
"""
def __init__(self):
pass
@abstractmethod
def generate_goal(self, max_num_of_trials=2000):
"""
Generate the goal.
Parameters
----------
max_num_of_trials: maximum number of pose generations when generated pose keep is not a valid pose.
Returns
-------
[List][Pose]: Pose in format [pose.x,pose.y,orientaion.x,orientaion.y,orientaion.z,orientaion.w]
"""
pass
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/assets/carter_warehouse_navigation.yaml | image: carter_warehouse_navigation.png
resolution: 0.05
origin: [-11.975, -17.975, 0.0000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/foxy_ws/src/navigation/isaac_ros_navigation_goal/assets/goals.txt | 1 2 0 0 1 0
2 3 0 0 1 1
3.4 4.5 0.5 0.5 0.5 0.5 |
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_ros_messages/CMakeLists.txt | cmake_minimum_required(VERSION 3.0.2)
project(isaac_ros_messages)
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
roscpp
rospy
std_msgs
message_generation
)
add_service_files(
FILES
IsaacPose.srv
)
generate_messages(
DEPENDENCIES
geometry_msgs
std_msgs
)
catkin_package(
CATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs message_runtime
)
include_directories(
${catkin_INCLUDE_DIRS}
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_ros_messages/package.xml | <?xml version="1.0"?>
<package format="2">
<name>isaac_ros_messages</name>
<version>0.1.0</version>
<description>The isaac_ros_messages package</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>geometry_msgs</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<export>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/CMakeLists.txt | # Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
cmake_minimum_required(VERSION 2.8.3)
# ------------------------------------------------------------------------------
# Project
# ------------------------------------------------------------------------------
project(cortex_control)
# ------------------------------------------------------------------------------
# CMake flags
# ------------------------------------------------------------------------------
# Create a json file with all the build commands useful for IDEs.
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# Needed to mix full library paths and library searching when linking.
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
# ------------------------------------------------------------------------------
# Compiler flags
# ------------------------------------------------------------------------------
add_definitions(-std=c++17 -fPIC -fopenmp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fPIC -fopenmp")
# ------------------------------------------------------------------------------
# Catkin
# ------------------------------------------------------------------------------
set(PKG_DEPENDS_LIST
std_msgs
roscpp
roslib
rosbag
robot_state_publisher
)
find_package(catkin REQUIRED COMPONENTS
${PKG_DEPENDS_LIST}
message_generation
)
add_message_files(
DIRECTORY
msg
FILES
JointPosVelAccCommand.msg
CortexCommandAck.msg
)
add_service_files(
DIRECTORY
srv
FILES
MsgService.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
${PKG_DEPENDS_LIST}
message_runtime
DEPENDS
)
# include source director
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${catkin_INCLUDE_DIRS}
)
find_package(Eigen3 3.3 REQUIRED CONFIG)
find_package(yaml-cpp REQUIRED CONFIG)
# ------------------------------------------------------------------------------
# Libraries
# ------------------------------------------------------------------------------
add_library(${PROJECT_NAME} SHARED
src/cortex/control/builders.cpp
src/cortex/control/joint_pos_vel_acc_command_publisher.cpp
src/cortex/control/command_stream_interpolator.cpp
src/cortex/control/rmpflow_commanded_joints_listener.cpp
src/cortex/math/interpolation/incremental_interpolator.cpp
src/cortex/math/interpolation/cubic_position_interpolator.cpp
src/cortex/math/interpolation/quartic_interpolator.cpp
src/cortex/math/interpolation/smoothing_incremental_interpolator.cpp
src/cortex/math/interpolation/quintic_interpolator.cpp
src/cortex/math/state.cpp
src/cortex/util/joint_state_listener.cpp
src/cortex/util/joint_state_publisher.cpp
src/cortex/util/ros_util.cpp
src/cortex/util/state_listener.cpp
src/cortex/util/stamped_state.cpp
src/cortex/util/string.cpp
)
add_dependencies(${PROJECT_NAME}
cortex_control_generate_messages_cpp
)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
yaml-cpp
)
# ------------------------------------------------------------------------------
# Executables
# ------------------------------------------------------------------------------
add_executable(sim_controller
src/cortex/control/command_stream_interpolator_main.cpp
)
target_link_libraries(sim_controller
${PROJECT_NAME} gflags
)
#-------------------------------------------------------------------------------
# Install specifications
#-------------------------------------------------------------------------------
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/package.xml | <package>
<name>cortex_control</name>
<version>1.0.0</version>
<description>NVIDIA Isaac Cortex Control ROS package.</description>
<author>Nathan Ratliff</author>
<maintainer email="[email protected]">Nathan Ratliff</maintainer>
<license>See LICENSE file.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>message_generation</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>roslib</build_depend>
<build_depend>rosbag</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>robot_state_publisher</build_depend>
<build_depend>yaml-cpp</build_depend>
<build_depend>libgflags-dev</build_depend>
<run_depend>message_runtime</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>roslib</run_depend>
<run_depend>rosbag</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>yaml-cpp</run_depend>
<run_depend>libgflags-dev</run_depend>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/state.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/state.h"
#include <Eigen/Core>
#include <ros/assert.h>
namespace cortex {
namespace math {
State::State(int n) : state(Eigen::VectorXd::Zero(2 * n)) {}
State::State(const Eigen::VectorXd &x, const Eigen::VectorXd &xd) : State(x.size()) {
ROS_ASSERT(x.size() == xd.size());
pos() = x;
vel() = xd;
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/state.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <Eigen/Core>
namespace cortex {
namespace math {
// Represents a vector s = (x, xd) \in \R^{2d} where d is the space dim.
class State {
public:
State() = delete;
explicit State(int n); // Initialize to the zero state (0,0)\in\R^n X \R^n.
State(const Eigen::VectorXd &x, const Eigen::VectorXd &xd);
Eigen::Ref<Eigen::VectorXd> pos() { return state.head(dim()); }
Eigen::Ref<Eigen::VectorXd> vel() { return state.tail(dim()); }
Eigen::Ref<Eigen::VectorXd> vector() { return state; }
Eigen::Ref<const Eigen::VectorXd> pos() const { return state.head(dim()); }
Eigen::Ref<const Eigen::VectorXd> vel() const { return state.tail(dim()); }
Eigen::Ref<const Eigen::VectorXd> vector() const { return state; }
int dim() const { return state.size() / 2; }
// Returns one integration step forward.
//
// Equations:
// x_next = x + dt xd
// xd_next = xd + dt xdd
State Step(double dt, const Eigen::VectorXd &xdd) {
return State(pos() + dt * vel(), vel() + dt * xdd);
}
private:
Eigen::VectorXd state;
};
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
// Pure virtual base class interface for an interpolator.
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/time_scaled_interpolator.h"
namespace cortex {
namespace math {
// Represents a generic interpolator interface giving an API of the form:
//
// 1. Add p = (q, qd, qdd) point at time t:
//
// interp.AddPt(t, p);
//
// 2. Evaluate at a given time t:
//
// auto p = interp.Eval(t);
// auto p = interp(t);
//
// Deriving classes need to implement the pure virtual functions
//
// AddPt() and Eval()
//
// Deriving classes might add additional restrictions, such as monotonicity of add
// times t (IncrementalInterpolator).
template <class vec_t>
class Interpolator {
public:
typedef vec_t VectorXx;
virtual bool AddPt(double t, const PosVelAcc<VectorXx>& p, std::string* error_str = nullptr) = 0;
virtual bool Eval(double t, PosVelAcc<VectorXx>& ret, std::string* error_str) const = 0;
// Asserting version.
PosVelAccXd Eval(double t) const {
std::string error_str;
PosVelAccXd p;
ROS_ASSERT_MSG(Eval(t, p, &error_str), "%s", error_str.c_str());
return p;
}
Eigen::VectorXd operator()(double t) const { return Eval(t).x; }
};
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/cubic_position_interpolator.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/interpolation/cubic_position_interpolator.h"
#include <fstream>
#include <string>
#include <vector>
#include <Eigen/Dense>
namespace cortex {
namespace math {
// Returns true iff t \in [0,1].
inline bool InZeroOne(double t) { return 0 <= t && t <= 1; }
// clang-format off
#define CUBIC_POSITION_INTERP_MATRIX \
0, 0, 0, 1, \
0, 0, 1, 0, \
0, 2, 0, 0, \
1, 1, 1, 1
// clang-format on
CubicPositionInterpolator1d::CubicPositionInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals)
: validate_interpolation_evals_(validate_interpolation_evals),
A_((Eigen::MatrixXd(4, 4) << CUBIC_POSITION_INTERP_MATRIX).finished()),
b_((Eigen::VectorXd(4) << p0.x, p0.xd, p0.xdd, p1.x).finished()),
coeffs_(A_.colPivHouseholderQr().solve(b_)) {}
bool CubicPositionInterpolator1d::Eval(double t, PosVelAcc1d& ret, std::string* error_str) const {
if (validate_interpolation_evals_ && !InZeroOne(t)) {
std::stringstream ss;
ss << "t not in [0,1] (t = " << t << "). ";
if (error_str) {
*error_str += ss.str();
}
return false;
}
auto a3 = coeffs_[0];
auto a2 = coeffs_[1];
auto a1 = coeffs_[2];
auto a0 = coeffs_[3];
std::vector<double> t_powers(4, 1);
for (size_t i = 1; i < t_powers.size(); ++i) {
t_powers[i] = t * t_powers[i - 1];
}
auto x = a3 * t_powers[3] + a2 * t_powers[2] + a1 * t_powers[1] + a0;
auto xd = 3. * a3 * t_powers[2] + 2. * a2 * t_powers[1] + a1;
auto xdd = 6. * a3 * t_powers[1] + 2. * a2;
ret = PosVelAcc1d(x, xd, xdd);
return true;
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/cubic_position_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/time_scaled_interpolator.h"
#include "cortex/math/interpolation/trajectories.h"
namespace cortex {
namespace math {
// One-dimensional cubic interpolating polynomial. Interpolates between (x0,
// xd0) and (x1, xd1).
class CubicPositionInterpolator1d {
public:
typedef double VectorXx;
CubicPositionInterpolator1d() {}
// Creates a cubic spline that interpolates between p0 and p1 at t = 0 and
// 1, respectively.
CubicPositionInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals = false);
// Evaluate the polynomial at t. If validate_interpolating_evals is set to
// true, enforces that the evaluations are only interpolating, i.e. t is in
// [0, 1]; fails if not. The interpolated value is returned in the ret return
// parameter. On failure, returns false and sets the error string if it's
// provided.
bool Eval(double t, PosVelAcc1d& ret, std::string* error_str = nullptr) const;
// This verion asserts on error.
PosVelAcc1d Eval(double t) const {
PosVelAcc1d ret;
std::string error_str;
ROS_ASSERT_MSG(Eval(t, ret, &error_str), "%s", error_str.c_str());
return ret;
}
double operator()(double t) const {
auto p = Eval(t);
return p.x;
}
// Accessor.
const Eigen::VectorXd& coeffs() const { return coeffs_; }
protected:
bool validate_interpolation_evals_;
const Eigen::MatrixXd A_;
const Eigen::VectorXd b_;
const Eigen::VectorXd coeffs_;
};
template <class vec_t>
MultiDimInterp<CubicPositionInterpolator1d, vec_t> CubicInterpolator(
const PosVelAcc<vec_t>& p0,
const PosVelAcc<vec_t>& p1,
bool validate_interpolation_evals = false) {
return MultiDimInterp<CubicPositionInterpolator1d, vec_t>(p0, p1, validate_interpolation_evals);
}
typedef MultiDimInterp<CubicPositionInterpolator1d, Eigen::VectorXd> CubicPositionInterpolatorXd;
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/smoothing_incremental_interpolator.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/interpolation/smoothing_incremental_interpolator.h"
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/quintic_interpolator.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/interpolation/quintic_interpolator.h"
#include <fstream>
#include <vector>
#include <Eigen/Dense>
namespace cortex {
namespace math {
// Returns true iff t \in [0,1].
inline bool InZeroOne(double t) { return 0 <= t && t <= 1; }
inline Eigen::Matrix<double, 6, 6> CubicInterpolationMatrix() {
return (Eigen::MatrixXd(6, 6) << 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 1, 0,
0, 0, 0, 2, 0, 0,
1, 1, 1, 1, 1, 1,
5, 4, 3, 2, 1, 0,
20, 12, 6, 2, 0, 0).finished();
}
QuinticInterpolator1d::QuinticInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals)
: validate_interpolation_evals_(validate_interpolation_evals),
A_(CubicInterpolationMatrix()),
b_((Eigen::VectorXd(6) << p0.x, p0.xd, p0.xdd, p1.x, p1.xd, p1.xdd).finished()),
coeffs_(A_.colPivHouseholderQr().solve(b_)) {}
bool QuinticInterpolator1d::Eval(double t, PosVelAcc1d& ret, std::string* error_str) const {
if (validate_interpolation_evals_ && !InZeroOne(t)) {
std::stringstream ss;
ss << "t not in [0,1] (t = " << t << "). ";
if (error_str) {
*error_str += ss.str();
}
return false;
}
auto a5 = coeffs_[0];
auto a4 = coeffs_[1];
auto a3 = coeffs_[2];
auto a2 = coeffs_[3];
auto a1 = coeffs_[4];
auto a0 = coeffs_[5];
std::vector<double> t_powers(6, 1);
for (size_t i = 1; i < t_powers.size(); ++i) {
t_powers[i] = t * t_powers[i - 1];
}
auto x = a5 * t_powers[5] + a4 * t_powers[4] + a3 * t_powers[3] + a2 * t_powers[2] +
a1 * t_powers[1] + a0;
auto xd = 5. * a5 * t_powers[4] + 4. * a4 * t_powers[3] + 3. * a3 * t_powers[2] +
2. * a2 * t_powers[1] + a1;
auto xdd = 20. * a5 * t_powers[3] + 12. * a4 * t_powers[2] + 6. * a3 * t_powers[1] + 2. * a2;
ret = PosVelAcc1d(x, xd, xdd);
return true;
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/incremental_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include "cortex/math/interpolation/interpolator.h"
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/quintic_interpolator.h"
// Note: an incremental interpolator is one that leverages monotonicity
// assumptions on the evaluation times to continually grow the interpolator head
// while removing stale segments from the tail.
namespace cortex {
namespace math {
// Enables the interpolation of a sequence of (x, xd, xdd) way-points using
// quintic polynomials for each region between points. Evaluations and adding
// of new way points can be interleaved, although evaluations are expected to
// be with monotonically increasing time. There's a notion of a "delay_buffer"
// which enables points to be received and added with wall-clock time
// simultaneous with wall-clock evaluations by evaluating at a fixed time
// interval in the past. The delay buffer is the number of intervals in the past
// to set that fixed time offset to.
//
// When interpolating between (x, xd, xdd) way points at a non unity dt
// (i.e. each way point is dt seconds apart), we need to scale the xd and
// xdd by dt and dt^2, respectively, when adding them and undo that scaling
// when evaluating. Intuition: if dt is small, it's moving fast from one
// point to the next. If we then interpolate pretending that it takes a
// full second to get from one to the next, it's moving and accelerating
// much much slower, so we need to scale by dt and dt^2.
//
// This can be more rigorously derived by looking how time dilation scalars
// propagate through the derivative expressions.
class IncrementalInterpolator : public Interpolator<Eigen::VectorXd> {
public:
explicit IncrementalInterpolator(bool prune_history = true,
bool validate_interpolation_evals = true);
// Add a new waypoint, the time should be the current cycle time. Evals will
// be offset into the past by delay_buffer number of intervals to that
// incoming points can be added with the same time stamp as active
// evaluations.
bool AddPt(double t, const PosVelAccXd& p,
std::string* error_str = nullptr) override;
// Evaluates the interpolator at the given time. It uses a delay buffer to
// offset the evaluations into the past so that points can be added at the
// same time as evaluations and evaluations can be made after the latest
// point safely as long as they're within the delay buffer (see description
// above).
//
// This delay buffer functionality can also be implemented manually simply by
// setting the delay_buffer to zero no construction and manually offsetting
// evaluation points into the past.
//
// It's assumed the eval points are monotonically increasing. Fails if not.
// the evaluation point is returned as ret. Returns true if successful and
// false otherwise.
bool Eval(double t, PosVelAccXd& ret,
std::string* error_str = nullptr) const override;
using Interpolator<Eigen::VectorXd>::Eval;
int num_intervals() const { return segment_interpolators_.size(); }
bool IsReady(double t) const;
protected:
mutable std::list<TimeScaledInterpolatorXd> segment_interpolators_;
bool is_first_;
double prev_add_t_;
PosVelAccXd prev_add_p_;
bool validate_interpolation_evals_;
bool prune_history_;
};
typedef IncrementalInterpolator SequentialQuinticInterpolator;
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/quintic_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/time_scaled_interpolator.h"
#include "cortex/math/interpolation/trajectories.h"
namespace cortex {
namespace math {
// One-dimensional quintic interpolating polynomial.
class QuinticInterpolator1d {
public:
typedef double VectorXx;
QuinticInterpolator1d() {}
// Creates a quintic spline that interpolates between p0 and p1 at t = 0 and
// 1, respectively.
QuinticInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals = false);
// Evaluate the polynomial at t. If validate_interpolating_evals is set to
// true, enforces that the evaluations are only interpolating, i.e. t is in
// [0, 1]; fails if not. The interpolated value is returned in the ret return
// parameter. On failure, returns false and sets the error string if it's
// provided.
bool Eval(double t, PosVelAcc1d& ret, std::string* error_str = nullptr) const;
// This verion asserts on error.
PosVelAcc1d Eval(double t) const {
PosVelAcc1d ret;
std::string error_str;
ROS_ASSERT_MSG(Eval(t, ret, &error_str), "%s", error_str.c_str());
return ret;
}
double operator()(double t) const {
auto p = Eval(t);
return p.x;
}
// Accessor.
const Eigen::VectorXd& coeffs() const { return coeffs_; }
protected:
bool validate_interpolation_evals_;
const Eigen::MatrixXd A_;
const Eigen::VectorXd b_;
const Eigen::VectorXd coeffs_;
};
template <class vec_t>
MultiDimInterp<QuinticInterpolator1d, vec_t> QuinticInterpolator(
const PosVelAcc<vec_t>& p0,
const PosVelAcc<vec_t>& p1,
bool validate_interpolation_evals = false) {
return MultiDimInterp<QuinticInterpolator1d, vec_t>(p0, p1, validate_interpolation_evals);
}
typedef MultiDimInterp<QuinticInterpolator1d, Eigen::VectorXd> QuinticInterpolatorXd;
typedef TimeScaledInterpolator<QuinticInterpolatorXd> TimeScaledInterpolatorXd;
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/incremental_interpolator.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/interpolation/incremental_interpolator.h"
#include <fstream>
#include <string>
#include "cortex/math/interpolation/quintic_interpolator.h"
namespace cortex {
namespace math {
IncrementalInterpolator::IncrementalInterpolator(bool prune_history,
bool validate_interpolation_evals)
: is_first_(true),
validate_interpolation_evals_(validate_interpolation_evals),
prune_history_(prune_history) {}
bool IncrementalInterpolator::AddPt(double t, const PosVelAccXd& p, std::string* error_str) {
if (is_first_) {
prev_add_t_ = t;
prev_add_p_ = p;
is_first_ = false;
return true;
}
if (t <= prev_add_t_) {
if (error_str) {
std::stringstream ss;
ss << "Add times nonmonotonic -- t = " << t << " vs prev t = " << prev_add_t_;
*error_str += ss.str();
}
return false;
}
segment_interpolators_.push_back(
TimeScaledInterpolatorXd(prev_add_t_, prev_add_p_, t, p, validate_interpolation_evals_));
prev_add_t_ = t;
prev_add_p_ = p;
return true;
}
bool IncrementalInterpolator::Eval(double t, PosVelAccXd& ret, std::string* error_str) const {
if (segment_interpolators_.size() == 0) {
if (error_str) {
*error_str += "No interpolators found.";
}
return false;
}
auto earliest_time = segment_interpolators_.front().t0();
auto latest_time = segment_interpolators_.back().t1();
if (validate_interpolation_evals_ && t < earliest_time) {
if (error_str) {
std::stringstream ss;
ss << "Nonmonotonic evals -- t = " << t
<< ", earliest time segment starts with t0 = " << earliest_time;
*error_str += ss.str();
}
return false;
}
if (validate_interpolation_evals_ && t > latest_time) {
if (error_str) {
std::stringstream ss;
ss << "Future eval (overflow) -- t = " << t
<< ", latest time segment ends with t1 = " << latest_time;
*error_str += ss.str();
}
return false;
}
// Find the first segment whose upper time bound is greater than the curren
// time. Since the segments are contiguous and monotonically increasing, we're
// guaranteed that t \in [t0, t1] of this segment.
TimeScaledInterpolatorXd* active_interpolator = nullptr;
for (auto it = segment_interpolators_.begin(); it != segment_interpolators_.end();) {
if (t <= it->t1()) {
active_interpolator = &(*it);
break;
} else {
if (prune_history_) {
it = segment_interpolators_.erase(it);
} else {
++it;
}
}
}
if (!active_interpolator && !validate_interpolation_evals_) {
active_interpolator = &segment_interpolators_.back();
}
if (active_interpolator) {
return active_interpolator->Eval(t, ret, error_str);
} else {
if (error_str) {
std::stringstream ss;
ss << "Eval time in the future -- t = " << t << " vs latest segment time = " << latest_time;
*error_str += ss.str();
}
return false;
}
}
bool IncrementalInterpolator::IsReady(double t) const {
return (segment_interpolators_.size() > 0) && (t >= segment_interpolators_.front().t0());
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/pos_vel_acc.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <vector>
#include <Eigen/Core>
#include <ros/assert.h>
namespace cortex {
namespace math {
struct PosVelAcc1d;
// Represents a triple of simultaneous position, velocity, and acceleration.
template <class vec_t>
struct PosVelAcc {
vec_t x;
vec_t xd;
vec_t xdd;
int dim() const { return x.size(); }
PosVelAcc<vec_t> Scale(double dt) const { return PosVelAcc<vec_t>(x, dt * xd, (dt * dt) * xdd); }
PosVelAcc<vec_t> Unscale(double dt) const {
return PosVelAcc<vec_t>(x, xd / dt, xdd / (dt * dt));
}
PosVelAcc() {}
// Initialize to all zeros with a particular dimensionality.
explicit PosVelAcc(int d) {
x = vec_t::Zero(d);
xd = vec_t::Zero(d);
xdd = vec_t::Zero(d);
}
// Initialize to specific (x, xd, xdd). Each vector much be the same
// dimension, otherwise assert.
PosVelAcc(const vec_t& x, const vec_t& xd, const vec_t& xdd);
// Join a collection of one-dimensional PosVelAcc1d's into a single object of
// this type. Aggregates the individual dimensions into vectors, x, xd, xdd.
static PosVelAcc Join(const std::vector<PosVelAcc1d>& dims);
};
// One dimensional variant of pos, vel, acc.
struct PosVelAcc1d {
double x;
double xd;
double xdd;
PosVelAcc1d() {}
PosVelAcc1d(double x, double xd, double xdd) : x(x), xd(xd), xdd(xdd) {}
// Slice a multi-dimensional pos, vel, acc into a one-dimensional variant
// containing only the specified dimension.
template <class vec_t>
static PosVelAcc1d Slice(const PosVelAcc<vec_t>& p, int dim) {
return PosVelAcc1d(p.x[dim], p.xd[dim], p.xdd[dim]);
}
};
//==============================================================================
// Template implementations
//==============================================================================
template <class vec_t>
PosVelAcc<vec_t>::PosVelAcc(const vec_t& x, const vec_t& xd, const vec_t& xdd)
: x(x), xd(xd), xdd(xdd) {
ROS_ASSERT(x.size() == xd.size());
ROS_ASSERT(x.size() == xdd.size());
}
template <class vec_t>
PosVelAcc<vec_t> PosVelAcc<vec_t>::Join(const std::vector<PosVelAcc1d>& dims) {
PosVelAcc<vec_t> p(dims.size());
for (size_t i = 0; i < dims.size(); ++i) {
p.x[i] = dims[i].x;
p.xd[i] = dims[i].xd;
p.xdd[i] = dims[i].xdd;
}
return p;
}
// Add specialization for VectorXd for convenience.
typedef PosVelAcc<Eigen::VectorXd> PosVelAccXd;
} // namespace math
} // namespace cortex
inline std::ostream& operator<<(std::ostream& os, const cortex::math::PosVelAcc1d& p) {
os << " x = " << p.x << ", xd = " << p.xd << ", xdd = " << p.xdd;
return os;
}
template <class vec_t>
std::ostream& operator<<(std::ostream& os, const cortex::math::PosVelAcc<vec_t>& p) {
os << "x = " << p.x.transpose() << "\n";
os << "xd = " << p.xd.transpose() << "\n";
os << "xdd = " << p.xdd.transpose() << "\n";
return os;
}
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/quartic_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/time_scaled_interpolator.h"
#include "cortex/math/interpolation/trajectories.h"
namespace cortex {
namespace math {
// One-dimensional quartic interpolating polynomial. Interpolates between
// (x0, xd0, xdd0) and (x1, xd1).
class QuarticInterpolator1d {
public:
typedef double VectorXx;
QuarticInterpolator1d() {}
// Creates a quintic spline that interpolates between p0 and p1 at t = 0 and
// 1, respectively.
QuarticInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals = false);
// Evaluate the polynomial at t. If validate_interpolating_evals is set to
// true, enforces that the evaluations are only interpolating, i.e. t is in
// [0, 1]; fails if not. The interpolated value is returned in the ret return
// parameter. On failure, returns false and sets the error string if it's
// provided.
bool Eval(double t, PosVelAcc1d& ret, std::string* error_str = nullptr) const;
// This verion asserts on error.
PosVelAcc1d Eval(double t) const {
PosVelAcc1d ret;
std::string error_str;
ROS_ASSERT_MSG(Eval(t, ret, &error_str), "%s", error_str.c_str());
return ret;
}
double operator()(double t) const {
auto p = Eval(t);
return p.x;
}
// Accessor.
const Eigen::VectorXd& coeffs() const { return coeffs_; }
protected:
bool validate_interpolation_evals_;
const Eigen::MatrixXd A_;
const Eigen::VectorXd b_;
const Eigen::VectorXd coeffs_;
};
template <class vec_t>
MultiDimInterp<QuarticInterpolator1d, vec_t> QuarticInterpolator(
const PosVelAcc<vec_t>& p0,
const PosVelAcc<vec_t>& p1,
bool validate_interpolation_evals = false) {
return MultiDimInterp<QuarticInterpolator1d, vec_t>(p0, p1, validate_interpolation_evals);
}
typedef MultiDimInterp<QuarticInterpolator1d, Eigen::VectorXd> QuarticInterpolatorXd;
// typedef TimeScaledInterpolator<QuarticInterpolatorXd>
// TimeScaledInterpolatorXd;
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/quartic_interpolator.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/math/interpolation/quartic_interpolator.h"
#include <fstream>
#include <string>
#include <vector>
#include <Eigen/Dense>
namespace cortex {
namespace math {
// Returns true iff t \in [0,1].
inline bool InZeroOne(double t) { return 0 <= t && t <= 1; }
// clang-format off
#define QUARTIC_INTERP_MATRIX \
0, 0, 0, 0, 1, \
0, 0, 0, 1, 0, \
0, 0, 2, 0, 0, \
1, 1, 1, 1, 1, \
4, 3, 2, 1, 0
// clang-format on
QuarticInterpolator1d::QuarticInterpolator1d(const PosVelAcc1d& p0,
const PosVelAcc1d& p1,
bool validate_interpolation_evals)
: validate_interpolation_evals_(validate_interpolation_evals),
A_((Eigen::MatrixXd(5, 5) << QUARTIC_INTERP_MATRIX).finished()),
b_((Eigen::VectorXd(5) << p0.x, p0.xd, p0.xdd, p1.x, p1.xd).finished()),
coeffs_(A_.colPivHouseholderQr().solve(b_)) {}
bool QuarticInterpolator1d::Eval(double t, PosVelAcc1d& ret, std::string* error_str) const {
if (validate_interpolation_evals_ && !InZeroOne(t)) {
std::stringstream ss;
ss << "t not in [0,1] (t = " << t << "). ";
if (error_str) {
*error_str += ss.str();
}
return false;
}
auto a4 = coeffs_[0];
auto a3 = coeffs_[1];
auto a2 = coeffs_[2];
auto a1 = coeffs_[3];
auto a0 = coeffs_[4];
std::vector<double> t_powers(5, 1);
for (size_t i = 1; i < t_powers.size(); ++i) {
t_powers[i] = t * t_powers[i - 1];
}
auto x = a4 * t_powers[4] + a3 * t_powers[3] + a2 * t_powers[2] + a1 * t_powers[1] + a0;
auto xd = 4. * a4 * t_powers[3] + 3. * a3 * t_powers[2] + 2. * a2 * t_powers[1] + a1;
auto xdd = 12. * a4 * t_powers[2] + 6. * a3 * t_powers[1] + 2. * a2;
ret = PosVelAcc1d(x, xd, xdd);
return true;
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/time_scaled_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/trajectories.h"
namespace cortex {
namespace math {
// Represents a quintic interpolator interpolating between two end points
// at specific times. If validate_interpolation_evals is true, valid evals
// are only those within the time range of the two end points.
template <class traj_t>
class TimeScaledInterpolator {
public:
typedef typename TimeScaledTraj<traj_t>::VectorXx VectorXx;
TimeScaledInterpolator() {}
TimeScaledInterpolator(double t0,
const PosVelAcc<VectorXx>& p0,
double t1,
const PosVelAcc<VectorXx>& p1,
bool validate_interpolation_evals = false)
: t0_(t0),
p0_(p0),
t1_(t1),
p1_(p1),
time_range_(t1 - t0),
scaled_traj_(
traj_t(p0.Scale(time_range_), p1.Scale(time_range_), validate_interpolation_evals),
time_range_),
validate_interpolation_evals_(validate_interpolation_evals) {}
bool Eval(double t, PosVelAcc<VectorXx>& ret, std::string* error_str = nullptr) const {
if (validate_interpolation_evals_ && !(t0_ <= t && t <= t1_)) {
if (error_str) {
std::stringstream ss;
ss << "t = " << t << " outside valid range [" << t0_ << ", " << t1_ << "]";
*error_str += ss.str();
}
return false;
}
return scaled_traj_.Eval((t - t0_) / time_range_, ret, error_str);
}
PosVelAcc<VectorXx> Eval(double t) const {
std::string error_str;
PosVelAcc<VectorXx> ret;
ROS_ASSERT_MSG(scaled_traj_.Eval((t - t0_) / time_range_, ret, &error_str), "%s",
error_str.c_str());
return ret;
}
// Performs a time shifted eval since the underlying trajectory starts at t0_
VectorXx operator()(double t) const { return Eval(t).x; }
double t0() const { return t0_; }
const PosVelAcc<VectorXx>& p0() const { return p0_; }
double t1() const { return t1_; }
const PosVelAcc<VectorXx>& p1() const { return p1_; }
protected:
double t0_;
PosVelAcc<VectorXx> p0_;
double t1_;
PosVelAcc<VectorXx> p1_;
double time_range_;
TimeScaledTraj<traj_t> scaled_traj_;
bool validate_interpolation_evals_;
};
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/trajectories.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <vector>
#include <Eigen/Core>
#include <ros/assert.h>
#include "cortex/math/interpolation/pos_vel_acc.h"
namespace cortex {
namespace math {
// Represents a multidimensional trajectory as a collection of 1D trajectories.
template <class traj1d_t, class vec_t>
class MultiDimTraj {
public:
typedef vec_t VectorXx;
MultiDimTraj() {}
explicit MultiDimTraj(const std::vector<traj1d_t>& trajectories) : trajectories_(trajectories) {}
bool Eval(double t, PosVelAcc<vec_t>& ret, std::string* error_str) const;
// This verion asserts on error.
PosVelAccXd Eval(double t) const {
PosVelAccXd ret;
std::string error_str;
ROS_ASSERT_MSG(Eval(t, ret, &error_str), "%s", error_str.c_str());
return ret;
}
int dim() const { return trajectories_.size(); }
protected:
std::vector<traj1d_t> trajectories_;
};
// Creates a vector of 1D interpolators for each dimension of the given
// PosVelAcc end-point objects. If validate_interpolation_evals is true, the
// resulting interpolators will validate that the query points are between 0
// and 1.
template <class interp1d_t, class vec_t>
std::vector<interp1d_t> MakeDimInterps(const PosVelAcc<vec_t>& p0,
const PosVelAcc<vec_t>& p1,
bool validate_interpolation_evals) {
ROS_ASSERT(p0.dim() == p1.dim());
std::vector<interp1d_t> trajectories;
for (int i = 0; i < p0.dim(); ++i) {
trajectories.push_back(interp1d_t(
PosVelAcc1d::Slice(p0, i), PosVelAcc1d::Slice(p1, i), validate_interpolation_evals));
}
return trajectories;
}
// Represents a multi-dimensional interpolator interpolating between a pair of
// PosVelAcc points.
template <class interp1d_t, class vec_t>
class MultiDimInterp : public MultiDimTraj<interp1d_t, vec_t> {
public:
typedef vec_t VectorXx;
MultiDimInterp() {}
MultiDimInterp(const PosVelAcc<vec_t>& p0,
const PosVelAcc<vec_t>& p1,
bool validate_interpolation_evals = false)
: MultiDimTraj<interp1d_t, vec_t>(
MakeDimInterps<interp1d_t, vec_t>(p0, p1, validate_interpolation_evals)) {}
protected:
};
// Represents a trajectory whose time is scaled by some scaling factor. The
// semantics of scaling is that if the original time interval were [0,1] the
// new time interval would be [0, scalar], i.e. the original trajectory on
// [0,1] would be stretched to fit across the entire interval [0, scalar].
template <class traj_t>
class TimeScaledTraj {
public:
typedef typename traj_t::VectorXx VectorXx;
TimeScaledTraj() {}
TimeScaledTraj(const traj_t& traj, double scalar) : traj_(traj), scalar_(scalar) {}
VectorXx operator()(double t) const { return Eval(t).x; }
PosVelAcc<typename traj_t::VectorXx> Eval(double t) const {
return traj_.Eval(t).Unscale(scalar_);
}
bool Eval(double t, PosVelAcc<VectorXx>& ret, std::string* error_str = nullptr) const {
PosVelAcc<VectorXx> scaled_ret;
if (!traj_.Eval(t, scaled_ret, error_str)) {
return false;
}
ret = scaled_ret.Unscale(scalar_);
return true;
}
double scalar() const { return scalar_; }
protected:
traj_t traj_;
double scalar_;
};
template <class traj_t>
TimeScaledTraj<traj_t> TimeScaleTraj(const traj_t& traj, double scalar) {
return TimeScaledTraj<traj_t>(traj, scalar);
}
// traj_t should have an evaluation operator:
//
// vec_t operator()(double t) const
//
// This function performs finite-differencing to find the velocity.
// traj_t should also have a type vec_t:
//
// typename traj_t::vec_t
//
template <class traj_t>
typename traj_t::VectorXx CentralFdVel(const traj_t& traj, double t, double dt = 1e-5) {
auto x_up = traj(t + dt / 2);
auto x_down = traj(t - dt / 2);
return (x_up - x_down) / dt;
}
template <class traj_t>
typename traj_t::VectorXx FdAcc(const traj_t& traj, double t, double dt = 1e-5) {
auto x = traj(t);
auto x_up = traj(t + dt / 2);
auto x_down = traj(t - dt / 2);
return (x_up + x_down - 2 * x) / (dt * dt / 4);
}
// Converts a trajectory into a velocity trajectory using finite-differencing.
template <class traj_t>
class FdVelTraj {
public:
typedef typename traj_t::VectorXx VectorXx;
explicit FdVelTraj(const traj_t& traj, double dt = 1e-5) : traj_(traj), dt_(dt) {}
VectorXx operator()(double t) const { return CentralFdVel(traj_, t, dt_); }
protected:
traj_t traj_;
double dt_;
};
template <class traj_t>
FdVelTraj<traj_t> ToFdVelTraj(const traj_t& traj) {
return FdVelTraj<traj_t>(traj);
}
// Converts a trajectory into an acceleration trajectory using
// finite-differencing.
template <class traj_t>
class FdAccTraj {
public:
typedef typename traj_t::VectorXx VectorXx;
explicit FdAccTraj(const traj_t& traj, double dt = 1e-5) : traj_(traj), dt_(dt) {}
VectorXx operator()(double t) const { return FdAcc(traj_, t, dt_); }
protected:
traj_t traj_;
double dt_;
};
template <class traj_t>
FdAccTraj<traj_t> ToFdAccTraj(const traj_t& traj) {
return FdAccTraj<traj_t>(traj);
}
// Represents f(t) = c1 * sin(c2 * (t - t0)) + c3
//
// Derivatives:
// f' = c1 * c2 * cos(c2 * (t - t0))
// f'' = -c1 * c2^2 * sin(c2 * (t - t0))
class SinusoidalTraj {
public:
typedef double VectorXx;
SinusoidalTraj(double c1, double c2, double c3, double t0) : c1_(c1), c2_(c2), c3_(c3), t0_(t0) {}
PosVelAcc1d Eval(double t) const {
std::string error_str;
PosVelAcc1d ret;
ROS_ASSERT_MSG(Eval(t, ret, &error_str), "%s", error_str.c_str());
return ret;
}
bool Eval(double t, PosVelAcc1d& ret, std::string* error_str = nullptr) const {
// Suppress warnings that "error_str" is never written to.
(void)error_str;
auto t_affine = c2_ * (t - t0_);
auto x = c1_ * sin(t_affine) + c3_;
auto xd = c1_ * c2_ * cos(t_affine);
auto xdd = -c1_ * c2_ * c2_ * sin(t_affine);
ret = PosVelAcc1d(x, xd, xdd);
return true;
}
double operator()(double t) const { return Eval(t).x; }
protected:
double c1_, c2_, c3_, t0_;
};
//==============================================================================
// Template implementations
//==============================================================================
template <class traj1d_t, class vec_t>
bool MultiDimTraj<traj1d_t, vec_t>::Eval(double t,
PosVelAcc<vec_t>& ret,
std::string* error_str) const {
std::vector<PosVelAcc1d> dim_evals(dim());
for (size_t i = 0; i < trajectories_.size(); ++i) {
if (!trajectories_[i].Eval(t, dim_evals[i], error_str)) {
return false;
}
}
ret = PosVelAcc<vec_t>::Join(dim_evals);
return true;
}
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/math/interpolation/smoothing_incremental_interpolator.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
// Simple and generic smoothing incremental interpolator that creates each new
// polynomial segment between the latest evaluated point (the point sent to
// control) and the incoming point. This adds a level of robustness to noise
// governed by the size of the eval shift window.
#pragma once
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include "cortex/math/interpolation/interpolator.h"
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/time_scaled_interpolator.h"
namespace cortex {
namespace math {
template <class interp_t>
class SmoothingIncrementalInterpolator : public Interpolator<typename interp_t::VectorXx> {
public:
SmoothingIncrementalInterpolator() : is_first_(true), is_ready_(false) {}
bool AddPt(double t,
const PosVelAcc<typename interp_t::VectorXx>& p,
std::string* error_str = nullptr) override {
if (is_first_) {
prev_eval_t_ = t;
prev_eval_p_ = p;
is_first_ = false;
return true;
}
is_ready_ = true;
if (t <= prev_eval_t_) {
if (error_str) {
std::stringstream ss;
ss << "Add time must be beyond the last eval time = " << t
<< " vs last eval t = " << prev_eval_t_;
*error_str += ss.str();
}
return false;
}
interpolator_ = TimeScaledInterpolator<interp_t>(prev_eval_t_, prev_eval_p_, t, p);
return true;
}
// Note: only adds to the error string if there's an error. Typically string
// operations aren't real time safe, but in this case we'd be bailing out.
bool Eval(double t,
PosVelAcc<typename interp_t::VectorXx>& ret,
std::string* error_str) const override {
if (!IsReady(t)) {
if (error_str) {
*error_str +=
"Smoothing increment interpolator not ready. Must see at least two "
"points before evaluating.";
}
return false;
}
if (t < interpolator_.t0()) {
if (error_str) {
std::stringstream ss;
ss << "Nonmonotonic evals -- t = " << t << ", last eval was at " << interpolator_.t0();
*error_str += ss.str();
}
return false;
}
if (t > interpolator_.t1()) {
// TODO(roflaherty): Convert this over to a version that extrapolates with zero
// acceleration. Include a jitter buffer (only extrapolate so far).
//
// For now, though, this is unsupported and it just errors.
if (error_str) {
std::stringstream ss;
ss << "Future eval requested. Currently unsupported. Expects eval "
<< "monotonicity -- t = " << t << ", last eval time = " << interpolator_.t1();
*error_str += ss.str();
}
return false;
}
if (!interpolator_.Eval(t, ret, error_str)) {
return false;
}
prev_eval_t_ = t;
prev_eval_p_ = ret;
return true;
}
using Interpolator<typename interp_t::VectorXx>::Eval;
// Returns true iff the interpolator was created as least enough time in the
// past so the shifted evaluation time falls within the valid range of the
// interpolator.
//
// Note that once the interpolator is ready (has return ready once), since
// new interpolators are always created to be lower bounded at the shifted
// interpolation eval time, and eval times are always monotonically
// increasing, it will always be ready (always return true).
bool IsReady(double t) const { return is_ready_ && (t >= interpolator_.t0()); }
protected:
TimeScaledInterpolator<interp_t> interpolator_;
bool is_first_;
bool is_ready_;
mutable double prev_eval_t_;
mutable PosVelAccXd prev_eval_p_;
};
} // namespace math
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/rmpflow_commanded_joints_listener.cpp | /* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in
* and to this software, related documentation and any modifications thereto. Any use,
* reproduction, disclosure or distribution of this software and related documentation without an
* express license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/control/rmpflow_commanded_joints_listener.h"
namespace cortex {
namespace control {
RmpflowCommandedJointsListener::RmpflowCommandedJointsListener(
const std::string& rmpflow_commands_topic, const std::string& joint_state_topic)
: rmpflow_commands_listener_(rmpflow_commands_topic, 1),
joint_state_listener_(std::make_shared<util::JointStateListener>()) {
joint_state_listener_->Init(joint_state_topic);
rmpflow_commands_listener_.RegisterCallback([&](const auto& msg) {
std::lock_guard<std::mutex> guard(mutex_);
joint_state_listener_->SetRequiredJoints(msg.names);
});
}
bool RmpflowCommandedJointsListener::IsAvailable() const {
std::lock_guard<std::mutex> guard(mutex_);
return is_set_ && joint_state_listener_->is_available();
}
void RmpflowCommandedJointsListener::WaitUntilAvailable(double poll_rate) const {
ros::Rate rate(poll_rate);
while (ros::ok() && !IsAvailable()) {
rate.sleep();
}
}
const std::shared_ptr<util::JointStateListener>
RmpflowCommandedJointsListener::joint_state_listener() const {
return joint_state_listener_;
}
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/command_stream_interpolator.h | /**
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in
* and to this software, related documentation and any modifications thereto. Any use,
* reproduction, disclosure or distribution of this software and related documentation without an
* express license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <atomic>
#include <memory>
#include <mutex>
#include <thread>
#include <vector>
#include <cortex_control/JointPosVelAccCommand.h>
#include <ros/ros.h>
#include <ros/time.h>
#include "cortex/math/interpolation/interpolator.h"
namespace cortex {
namespace control {
enum class ControllerState {
// The controller hasn't started yet so we should ignore any incoming commands so we don't start
// processing state changes prematurely.
StartingController = 0,
// The controller's eval calls have started. We need to wait on the backend to start. (The backend
// may already be started, in which case it'll immediately transition once the next incoming
// command is received).
WaitingOnBackend,
// We need to sync the backend with the current state of the robot by suppressing it briefly.
// Suppression automatically sets the backend to latest measured state from the robot. We remain
// in this state until we've detected we're no longer receiving messages from the backend.
SyncingBackend,
// After we've detected the backend suppression has been successful, we stop suppressing and
// transition to initializing the interpolator. The next incoming command will be used to
// initialize the interpolator. The NextCommand() interface can be used to blend between the
// measured state of the robot and the interpolated command for a blending duration specified on
// initialization.
InitializingInterpolator,
// Once the interpolator is initialized, we're operation and running as expected.
Operational
};
} // namespace control
} // namespace cortex
namespace cortex {
namespace control {
// Enables usage of the following form:
//
// auto suppressor = std::make_shared<cortex::control::CommandSuppressor>(topic, rate_hz);
// suppressor->StartSuppression();
// ros::Duration(2.).sleep();
// suppressor->StopSuppression();
//
// Internally, it constantly sends suppression messages at the specified rate and switches from
// sending std_msgs::String("1") for suppression to st_msgs::String("0") when not suppressing.
class CommandSuppressor {
public:
static std::string default_topic;
static double default_rate_hz;
// Defaults topic to default_topic and the publication rate to default_rate_hz.
CommandSuppressor() : CommandSuppressor(default_topic, default_rate_hz) {}
// Initialize to publish on the specified topic at the specified rate. Constantly publishes in a
// separate thread.
CommandSuppressor(const std::string& topic, double rate_hz);
~CommandSuppressor();
void StartSuppressing() { is_suppressing_ = true; }
void StopSuppressing() { is_suppressing_ = false; }
protected:
void Run();
std::atomic_bool is_suppressing_; // True when suppressing.
std::atomic_bool is_running_; // Set to false to stop the thread.
std::string topic_; // Topic it'll publish on.
double rate_hz_; // Rate at which it'll publish.
ros::Publisher suppression_pub_; // The publisher itself.
std::thread run_thread_; // Thread running the constant publication stream.
};
// Interpolator receiving a stream of cortex commands and reconstructing the integral curve they
// describe using a quintic interpolator. It's assumed that Eval() is called at a regular control
// rate; the eval times are used as a clock for the system.
class CommandStreamInterpolator {
public:
static const double default_blending_duration;
static const double default_backend_timeout;
static const double default_time_between_interp_pubs;
// A command is a commanded position plus return information on the availability from the Eval()
// method. This enables the following syntax
//
// auto command = stream_interpolator->Eval(...);
// if (command) {
// Send(command);
// }
//
// There's a Command::Unavailable() static convenince method for retrieving a generic unavailable
// command.
struct Command {
bool is_available;
Eigen::VectorXd commanded_position;
Command(const Eigen::VectorXd& commanded_position)
: is_available(true), commanded_position(commanded_position) {}
Command() : is_available(false) {}
// Enables checking boolean truth value of the command to see whether
// or not it's available.
operator bool() { return is_available; }
static Command Unavailable() { return Command(); }
};
// By default doesn't use the smoothing interpolator.
bool Init(const ros::Duration& interpolator_lookup_delay_buffer,
const std::string& cortex_command_topic,
ros::Duration blending_duration = ros::Duration(default_blending_duration)) {
return Init(interpolator_lookup_delay_buffer, false, cortex_command_topic);
}
// interpolator_lookup_delay_buffer is how far in the past to look up interpolated values to
// accommodate possible jitter.
//
// use_smoothing_interpolator: if true, uses a smoothing interpolator. Otherwise, uses a basic
// quintic interpolator.
//
// cortex_command_topic: topic on which cortex_control::JointPosVelAccCommand messages are broadcast.
//
// blending_duration: how long to blend for during start up when using NextCommand().
bool Init(const ros::Duration& interpolator_lookup_delay_buffer,
bool use_smoothing_interpolator,
const std::string& cortex_command_topic,
ros::Duration blending_duration = ros::Duration(default_blending_duration),
double backend_timeout = default_backend_timeout);
bool Init(const ros::Duration& interpolator_lookup_delay_buffer,
bool use_smoothing_interpolator,
const std::string& cortex_command_topic,
const std::string& cortex_command_ack_topic,
const std::string& cortex_command_suppress_topic,
const std::string& cortex_command_interpolated_topic,
ros::Duration blending_duration = ros::Duration(default_blending_duration),
double backend_timeout = default_backend_timeout);
void Start();
// Returns true if enough time has passed since the last cortex command callback to designate the
// backend as having been stopped or successfully suppressed.
bool IsBackendTimedOut(const ros::Time& time) const;
// Evaluate the interpolator at the specified time index. Time indices should be monotonically
// increasing, and calling this method steps the protocol. The Command is flagged as not available
// until the protocol is in the Operational state.
Command EvalAndStep(const ros::Time& time);
// Internally calls EvalAndStep(time), but handles unavailable commands cleanly and smoothly
// interpolates as needed to create a smooth transition to interpolation on startup.
//
// Automatically switches between returning q_measured when the interpolator isn't ready, blending
// between q_measured and the interpolated values for a predefined duration (blend_duration, set
// at initialization), and fully returning the interpolated values once blending is complete. It
// is recommended that this method be used for smooth transitioning to interpolated command stream
// control.
//
// q_measured can be smaller in length than the internal interpolated commands. In that case,
// just the first q_measured.size() joint commands are used, and the returned command vector is of
// length q_measured.size().
Eigen::VectorXd NextCommand(const ros::Time& time,
const Eigen::VectorXd& q_measured,
bool* is_interpolator_active = nullptr);
private:
void CommandCallback(const cortex_control::JointPosVelAccCommand& msg);
// Add the command in the given command_msg to the interpolator. The command messages were meant
// to describe waypoints along an integral curve, so their command_msg.t time stamp is a rectified
// (jitter free) time stamp that can be used for interpolation.
void AddPointToInterpolator(const cortex_control::JointPosVelAccCommand& command_msg);
// Add the given interpolation point to the interolator at the given time.
void AddPointToInterpolator(const ros::Time& time, const cortex::math::PosVelAccXd& point);
// This method error checks on the state of the controller and shifts the time point to index the
// interpolator correctly. The time input should be controller time.
//
// Returns the result in eval_point.
//
// If there's an error, returns false (and if the optional error_str is available, sets the error
// string). Otherwise, return true on success.
bool EvalInterpolator(const ros::Time& time,
cortex::math::PosVelAccXd& eval_point,
std::string* error_str = nullptr) const;
// Publish the given interpolated point as a
//
// cortex_control::JointPosVelAccCommand
//
// on <joint_command_topic>/interpolated.
void PublishInterpolatedPoint(const ros::Time& time, const cortex::math::PosVelAccXd& point) const;
// Resets the interpolator to the initial state. One should always call this method for any event
// that transitions the system back to the WaitingOnBackend state.
void ResetInterpolator();
// Protects all members between calls to Eval() and CommandCallback().
std::mutex mutex_;
// Time at the most recent eval. This enables syncing the clocks between Eval() and Callback().
ros::Time last_eval_time_;
// Number of seconds in the past to evaluate the interpolator. The interpolator is effectively
// evaluated as interpolator->Eval(<now> - <delay_buffer>), ...); There are some details about
// syncing the clocks between incoming commands and controllers Eval() time, but the gist of it is
// that new incoming points are added at time <now> and we evaluate at <now> - <delay_buffer>.
ros::Duration interpolator_lookup_delay_buffer_;
// Time of the incoming command when the interpolator was initialized (this is actually the second
// point in the interpolator -- we actually step that back by buffer delay and interpolate from
// the current position to this initial incoming command).
ros::Time eval_time_at_interpolator_start_;
ros::Time command_time_at_interpolator_start_;
ros::Duration control_time_offset_from_now_;
// The underlying quintic interpolator.
std::shared_ptr<cortex::math::Interpolator<Eigen::VectorXd>> interp_;
// Current state of the stream interpolator. This orchestrates the sync protocol with the cortex
// commander.
ControllerState state_;
// The time stamp of the Eval() call when the latest incoming command was received.
ros::Time eval_time_at_last_callback_;
// ROS publishers and subscribers.
ros::Subscriber cortex_command_sub_;
ros::Publisher interpolated_command_pub_;
ros::Publisher cortex_command_time_pub_;
cortex_control::JointPosVelAccCommand latest_command_msg_;
// A command suppressor used during the backend sync to sync the backend with the measured
// joint states.
std::shared_ptr<CommandSuppressor> command_suppressor_;
// If true, uses an auto smoothing interpolator when ResetInterpolator() is called.
bool use_smoothing_interpolator_;
// These three members are used to coordinate blending during
ros::Time blending_start_time_;
bool start_blending_;
ros::Duration blending_duration_;
ros::Time next_print_time_;
ros::Duration print_period_;
double time_offset_;
double momentum_;
double time_between_interp_pubs_;
mutable ros::Time time_at_last_pub_;
double backend_timeout_;
};
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/joint_pos_vel_acc_command_publisher.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/control/joint_pos_vel_acc_command_publisher.h"
#include <vector>
#include <cortex_control/JointPosVelAccCommand.h>
namespace cortex {
namespace control {
JointPosVelAccCommandPublisher::JointPosVelAccCommandPublisher(
const std::string& topic, bool stamp_header_with_controller_time)
: stamp_header_with_controller_time_(stamp_header_with_controller_time),
is_first_(true),
next_id_(0) {
topic_ = topic;
ros::NodeHandle nh;
joint_command_publisher_ = nh.advertise<cortex_control::JointPosVelAccCommand>(topic_, 10);
}
JointPosVelAccCommandPublisher::~JointPosVelAccCommandPublisher() {}
void JointPosVelAccCommandPublisher::Publish(uint64_t id,
const ros::Time& t,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& q,
const Eigen::VectorXd& qd,
const Eigen::VectorXd& qdd) {
cortex_control::JointPosVelAccCommand joint_command;
if (stamp_header_with_controller_time_) {
joint_command.header.stamp = t;
} else {
if (is_first_) {
controller_time_offset_ = ros::Time::now() - t;
}
// We want to report the current time, but with the steadiness of the
// controller time.
joint_command.header.stamp = t + controller_time_offset_;
}
joint_command.id = id;
if (is_first_) {
// Usually this first message is missed by the interpolator (or it's
// dropped because of syncing protocols), but even if it's used, the
// interpolator won't use the period field because that's only used for
// knowing the period between the previous point (there isn't one) and this
// one.
joint_command.period = ros::Duration(0.);
is_first_ = false;
} else {
joint_command.period = (t - prev_t_);
}
joint_command.t = t;
joint_command.names = joint_names;
joint_command.q = std::vector<double>(q.data(), q.data() + q.size());
joint_command.qd = std::vector<double>(qd.data(), qd.data() + qd.size());
joint_command.qdd = std::vector<double>(qdd.data(), qdd.data() + qdd.size());
joint_command_publisher_.publish(joint_command);
// Updating the next_id_ member here means we can always set an ID once with
// a call explicitly to this Publish(...) method and then use the ID-less
// Publish(...) method to continue publishing sequential IDs from there.
next_id_ = id + 1;
prev_t_ = t;
}
void JointPosVelAccCommandPublisher::Publish(const ros::Time& t,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& q,
const Eigen::VectorXd& qd,
const Eigen::VectorXd& qdd) {
// Note that this call automatically increments next_id.
Publish(next_id_, t, joint_names, q, qd, qdd);
}
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/joint_pos_vel_acc_command_publisher.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <string>
#include <vector>
#include <Eigen/Core>
#include <ros/ros.h>
namespace cortex {
namespace control {
/*!\brief Abstract class representing the base of a oint position, velocity,
* and acceleration command publisher. The topic name of the publisher is
* defined as ns + "joint_command".
*/
class JointPosVelAccCommandPublisher {
public:
/*!\brief Creates a JointPosVelAccCommandPublisher under the given name
* space *ns*. The topic name of the publisher is defined as ns +
* "joint_command".
*
* There are two time stamps in each JointPosVelAccCommand message, one in
* the header and another as an explicit field t. The explicit field is
* always set to be the controller time (with each message exactly a period
* duration between), but by default (if stamp_header_with_controller_time is
* false) the header contains the wall clock time so we can see the jitter in
* the calculation using tools like rqt_plot. If
* stamp_header_with_controller_time is true, that header stamp is also set
* to the controller time so that becomes observable in plotters.
*/
JointPosVelAccCommandPublisher(const std::string& ns,
bool stamp_header_with_controller_time = false);
/*!\brief Default virtual destructor
*/
~JointPosVelAccCommandPublisher();
/*!\brief Publishes the position, velocity, and acceleration command. Each
* call to this method sets the id counter to the provided value, so
* subsequent calls to the id-less API will increment from this id.
*
* \param time The time stamp of this command.
* \param id the sequence id of this command.
* \param joint_names Joint names vector. This vector must have the same
* order as q qd, and qdd, i.e. the i-th name must correspond to the i-th q,
* qd, qdd values.
* \param q Joint position values
* \param qd Joint velocity values
* \param qdd Joint acceleration values
*/
virtual void Publish(uint64_t id,
const ros::Time& t,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& q,
const Eigen::VectorXd& qd,
const Eigen::VectorXd& qdd);
/*!\brief This version automatically creates the sequence id, starting from
* zero and incrementing once for each call.
*/
void Publish(const ros::Time& t,
const std::vector<std::string>& joint_names,
const Eigen::VectorXd& q,
const Eigen::VectorXd& qd,
const Eigen::VectorXd& qdd);
const std::string& topic() const { return topic_; }
protected:
bool stamp_header_with_controller_time_;
ros::Publisher joint_command_publisher_;
ros::Duration controller_time_offset_;
bool is_first_;
ros::Time prev_t_;
uint64_t next_id_;
std::string topic_;
};
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/builders.cpp | /**
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/control/builders.h"
#include "cortex/util/yaml.h"
#include <ros/time.h>
namespace cortex {
namespace control {
std::shared_ptr<CommandStreamInterpolator> LoadCommandStreamInterpolatorFromYaml(
const YAML::Node& command_stream_interpolator_config, bool verbose) {
// Extract params from yaml config.
auto params = util::GetFieldOrDie(command_stream_interpolator_config, "params");
auto interpolation_delay = util::GetOrDie<double>(params, "interpolation_delay");
auto use_smoothing_interpolator = util::GetOrDie<bool>(params, "use_smoothing_interpolator");
auto blending_duration = util::GetOrDie<double>(params, "blending_duration");
auto backend_timeout = util::GetOrDie<double>(params, "backend_timeout");
// Extract ROS topics from yaml config.
auto ros_topics = util::GetFieldOrDie(command_stream_interpolator_config, "ros_topics");
auto command_topics = util::GetFieldOrDie(ros_topics, "rmpflow_commands");
auto rmpflow_command_topic = util::GetOrDie<std::string>(command_topics, "command");
auto rmpflow_command_ack_topic = util::GetOrDie<std::string>(command_topics, "ack");
auto rmpflow_command_suppress_topic = util::GetOrDie<std::string>(command_topics, "suppress");
auto rmpflow_command_interpolated_topic = util::GetOrDie<std::string>(command_topics,
"interpolated");
if (verbose) {
std::cout << "RMPflow backend config:" << std::endl;
std::cout << " params:" << std::endl;
std::cout << " interpolation delay: " << interpolation_delay << std::endl;
std::cout << " use smoothing interpolator: " << use_smoothing_interpolator << std::endl;
std::cout << " blending duration: " << blending_duration << std::endl;
std::cout << " backend timeout: " << backend_timeout << std::endl;
std::cout << " ros_topics:" << std::endl;
std::cout << " rmpflow_commands:" << std::endl;
std::cout << " command: " << rmpflow_command_topic << std::endl;
std::cout << " ack: " << rmpflow_command_ack_topic << std::endl;
std::cout << " suppress: " << rmpflow_command_suppress_topic << std::endl;
std::cout << " interpolated: " << rmpflow_command_interpolated_topic << std::endl;
}
auto stream_interpolator = std::make_shared<cortex::control::CommandStreamInterpolator>();
stream_interpolator->Init(ros::Duration(interpolation_delay),
use_smoothing_interpolator,
rmpflow_command_topic,
rmpflow_command_ack_topic,
rmpflow_command_suppress_topic,
rmpflow_command_interpolated_topic,
ros::Duration(blending_duration),
backend_timeout);
return stream_interpolator;
}
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/builders.h | /**
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <memory>
#include <yaml-cpp/node/node.h>
#include "cortex/control/command_stream_interpolator.h"
namespace cortex {
namespace control {
//! Makes and initializes a command stream interpolator from the specified YAML config. One still needs
//! to call Start() on the returned object to start the streaming interpolation.
std::shared_ptr<CommandStreamInterpolator> LoadCommandStreamInterpolatorFromYaml(
const YAML::Node& command_stream_interpolator_config, bool verbose = false);
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/command_stream_interpolator_main.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
// Runs a generic CommandStreamInterpolator without sending the commands to
// a physical robot. This enables visualizing the underlying interpolated
// commands to analyze interpolation techniques for specific problems. Note it
// doesn't use the NextCommand() interface, but directly jumps to the
// interpolations, so blending doesn't pollute early signals.
#include <iostream>
#include "cortex/control/builders.h"
#include "cortex/control/command_stream_interpolator.h"
#include "cortex/control/rmpflow_commanded_joints_listener.h"
#include "cortex/util/joint_state_listener.h"
#include "cortex/util/ros_util.h"
#include "cortex/util/yaml.h"
#include <gflags/gflags.h>
#include <ros/ros.h>
DEFINE_string(command_stream_interpolator_config,
"package://cortex_control/config/command_stream_interpolator.yaml",
"");
DEFINE_double(interpolated_control_rate_hz,
500.,
"Rate in Hz at which the low-level control will be sending "
"commands. In this program, those commands are published on a "
"new topic <command_topic>/interpolated.");
DEFINE_bool(use_rectified_cycles,
false,
"If true, rectifies the time stamp so they're always exactly a period "
"apart. Otherwise (default), sets the time stamp to the current wall-clock "
"time.");
DEFINE_bool(analysis_mode,
false,
"If true, runs in analysis mode. Doesn't use NextCommand() for interpolation "
"between interpolated and desired when starting up. In general, you'll want to "
"use NextCommand() in real controllers.");
DEFINE_bool(verbose, false, "Print extra messages.");
class MockControllerInterface {
public:
bool is_interpolator_active;
MockControllerInterface(
const std::shared_ptr<cortex::util::JointStateListener>& joint_state_listener)
: is_interpolator_active(false), joint_state_listener_(joint_state_listener) {}
Eigen::VectorXd GetMeasuredPositions() {
if (is_interpolator_active) {
// The interpolator is active, so as part of the protocol the joint state listener has
// been set to listen to the same joints as found in the commands and the interpolator has
// made sure those are available in the joint state listener. Therefore, we can return the
// measure states from the listener.
return joint_state_listener_->CurrentState().q;
} else {
// Otherwise, return a zero length vector. That will get the NextCommand() calls to return a
// zero length vector as well.
return Eigen::VectorXd(0);
}
}
protected:
std::shared_ptr<cortex::util::JointStateListener> joint_state_listener_;
};
int main(int argc, char** argv) {
try {
gflags::ParseCommandLineFlags(&argc, &argv, true);
ros::init(argc, argv, "cortex_command_stream_interpolator");
ros::NodeHandle node_handle;
ros::AsyncSpinner spinner(4);
spinner.start();
auto command_stream_interpolator_config = YAML::LoadFile(
cortex::util::ExpandRosPkgRelPath(FLAGS_command_stream_interpolator_config));
auto command_stream_interpolator = cortex::control::LoadCommandStreamInterpolatorFromYaml(
command_stream_interpolator_config);
command_stream_interpolator->Start();
auto ros_topics = cortex::util::GetFieldOrDie(command_stream_interpolator_config, "ros_topics");
auto joint_state_topic = cortex::util::GetOrDie<std::string>(ros_topics, "joint_state");
auto command_topics = cortex::util::GetFieldOrDie(ros_topics, "rmpflow_commands");
auto rmpflow_command_topic = cortex::util::GetOrDie<std::string>(command_topics, "command");
cortex::control::RmpflowCommandedJointsListener rmpflow_commanded_joints_listener(
rmpflow_command_topic, joint_state_topic);
std::cout << "Waiting until joint states are available..." << std::endl;
rmpflow_commanded_joints_listener.WaitUntilAvailable(30.);
std::cout << "<done>" << std::endl;
auto controller_interface =
MockControllerInterface(rmpflow_commanded_joints_listener.joint_state_listener());
auto rate_hz = FLAGS_interpolated_control_rate_hz;
auto period = ros::Duration(1. / rate_hz);
auto time = ros::Time::now();
auto time_at_next_print = time;
Eigen::VectorXd q_des;
ros::Rate rate(rate_hz);
bool is_interpolator_active = false;
while (ros::ok()) {
if (FLAGS_use_rectified_cycles) {
time += period;
} else {
time = ros::Time::now();
}
if (FLAGS_analysis_mode) {
// Analysis mode. Allows us to see the interpolated commands without the blending introduced
// by NextCommand(). Controllers will typically want to use NextCommand().
auto command = command_stream_interpolator->EvalAndStep(time);
if (command) {
q_des = command.commanded_position;
}
} else {
// Standard mode. Usually you would send this next_command to the controller. Here, we just
// use the internal functionality of the command stream interpolator to publish the command
// on the specified interpolated commands topic.
auto q_measured = controller_interface.GetMeasuredPositions();
q_des = command_stream_interpolator->NextCommand(
time, q_measured, &controller_interface.is_interpolator_active);
}
if (FLAGS_verbose && time >= time_at_next_print) {
std::cout << "time = " << time << ", q_des = " << q_des.transpose() << std::endl;
time_at_next_print += ros::Duration(.2);
}
rate.sleep();
}
std::cout << "<done>" << std::endl;
} catch (const std::exception& ex) {
std::cout << "Exception caught: " << ex.what() << std::endl;
}
return 0;
}
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/rmpflow_commanded_joints_listener.h | /* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in
* and to this software, related documentation and any modifications thereto. Any use,
* reproduction, disclosure or distribution of this software and related documentation without an
* express license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include <mutex>
#include <cortex_control/JointPosVelAccCommand.h>
#include "cortex/util/joint_state_listener.h"
#include "cortex/util/ros_message_listener.h"
namespace cortex {
namespace control {
// A wrapper around the joint state listener ensuring that we listen to the same joints we're
// controlling with the RMPflow commander's commands.
//
// Listens to the RMPflow commander's commands as well as the joint state topic. Once we receive
// the first command, we register the joint names with the joint state listener as required joints.
// The IsAvailable() method (or WaitUntilAvailable()) can then be used to check whether the joint
// state listener is ready and has measured values for each of those named joints.
class RmpflowCommandedJointsListener {
public:
RmpflowCommandedJointsListener(const std::string& rmpflow_commands_topic,
const std::string& joint_state_topic);
bool IsAvailable() const;
void WaitUntilAvailable(double poll_rate) const;
const std::shared_ptr<util::JointStateListener> joint_state_listener() const;
protected:
mutable std::mutex mutex_;
util::RosMessageListener<cortex_control::JointPosVelAccCommand> rmpflow_commands_listener_;
bool is_set_;
std::shared_ptr<util::JointStateListener> joint_state_listener_;
};
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/control/command_stream_interpolator.cpp | /**
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in
* and to this software, related documentation and any modifications thereto. Any use,
* reproduction, disclosure or distribution of this software and related documentation without an
* express license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/control/command_stream_interpolator.h"
#include <algorithm>
#include <sstream>
#include <vector>
#include <Eigen/Core>
#include <std_msgs/Bool.h>
#include <std_msgs/Time.h>
#include "cortex/math/interpolation/cubic_position_interpolator.h"
#include "cortex/math/interpolation/incremental_interpolator.h"
#include "cortex/math/interpolation/pos_vel_acc.h"
#include "cortex/math/interpolation/quartic_interpolator.h"
#include "cortex/math/interpolation/smoothing_incremental_interpolator.h"
#include "cortex_control/CortexCommandAck.h"
namespace cortex {
namespace control {
inline std::ostream& operator<<(std::ostream& os, ControllerState state) {
using namespace cortex::control;
switch (state) {
case ControllerState::StartingController:
os << "ControllerState::StartingController";
break;
case ControllerState::WaitingOnBackend:
os << "ControllerState::WaitingOnBackend";
break;
case ControllerState::SyncingBackend:
os << "ControllerState::SyncingBackend";
break;
case ControllerState::InitializingInterpolator:
os << "ControllerState::InitializingInterpolator";
break;
case ControllerState::Operational:
os << "ControllerState::Operational";
break;
default:
os << "ControllerState::<unknown>";
}
return os;
}
inline std::ostream& operator<<(std::ostream& os, CommandStreamInterpolator::Command& command) {
if (command) {
os << "[" << command.commanded_position.transpose() << "]";
} else {
os << "<unavailable>";
}
return os;
}
std::string CommandSuppressor::default_topic = "/robot/command_suppression/right";
double CommandSuppressor::default_rate_hz = 30.;
CommandSuppressor::CommandSuppressor(const std::string& topic, double rate_hz)
: topic_(topic), rate_hz_(rate_hz) {
is_running_ = true;
is_suppressing_ = false;
ros::NodeHandle node_handle;
suppression_pub_ = node_handle.advertise<std_msgs::Bool>(topic_, 10);
run_thread_ = std::thread(&CommandSuppressor::Run, this);
}
CommandSuppressor::~CommandSuppressor() {
is_running_ = false;
run_thread_.join();
}
void CommandSuppressor::Run() {
ros::Rate rate(rate_hz_);
while (ros::ok() && is_running_) {
std_msgs::Bool msg;
if (is_suppressing_) {
msg.data = true;
} else {
msg.data = false;
}
suppression_pub_.publish(msg);
rate.sleep();
}
}
const double CommandStreamInterpolator::default_blending_duration = 2.;
const double CommandStreamInterpolator::default_backend_timeout = .5;
const double CommandStreamInterpolator::default_time_between_interp_pubs = 1. / 60; // 60 hz
bool CommandStreamInterpolator::Init(const ros::Duration& interpolator_lookup_delay_buffer,
bool use_smoothing_interpolator,
const std::string& cortex_command_topic,
ros::Duration blending_duration,
double backend_timeout) {
return Init(interpolator_lookup_delay_buffer,
use_smoothing_interpolator,
cortex_command_topic,
cortex_command_topic + "/ack",
cortex_command_topic + "/suppress",
cortex_command_topic + "/interpolated",
blending_duration,
backend_timeout);
}
bool CommandStreamInterpolator::Init(const ros::Duration& interpolator_lookup_delay_buffer,
bool use_smoothing_interpolator,
const std::string& cortex_command_topic,
const std::string& cortex_command_ack_topic,
const std::string& cortex_command_suppress_topic,
const std::string& cortex_command_interpolated_topic,
ros::Duration blending_duration,
double backend_timeout) {
interpolator_lookup_delay_buffer_ = interpolator_lookup_delay_buffer;
use_smoothing_interpolator_ = use_smoothing_interpolator;
blending_duration_ = blending_duration;
backend_timeout_ = backend_timeout;
time_between_interp_pubs_ = default_time_between_interp_pubs;
ros::NodeHandle node_handle;
// Create pub-subs.
cortex_command_sub_ = node_handle.subscribe(
cortex_command_topic, 1, &CommandStreamInterpolator::CommandCallback, this);
interpolated_command_pub_ =
node_handle.advertise<cortex_control::JointPosVelAccCommand>(cortex_command_interpolated_topic, 10);
cortex_command_time_pub_ =
node_handle.advertise<cortex_control::CortexCommandAck>(cortex_command_ack_topic, 10);
// Create the suppressor with defaults.
command_suppressor_ = std::make_shared<CommandSuppressor>(
cortex_command_suppress_topic, CommandSuppressor::default_rate_hz);
return true;
}
void CommandStreamInterpolator::Start() {
std::lock_guard<std::mutex> lock(mutex_);
std::cout << "<starting_controller>" << std::endl;
state_ = ControllerState::StartingController;
}
bool CommandStreamInterpolator::IsBackendTimedOut(const ros::Time& time) const {
auto delta = (time - eval_time_at_last_callback_).toSec();
return delta >= backend_timeout_;
}
CommandStreamInterpolator::Command CommandStreamInterpolator::EvalAndStep(
const ros::Time& time) {
std::lock_guard<std::mutex> lock(mutex_);
last_eval_time_ = time;
// Check state transitions.
if (state_ == ControllerState::StartingController) {
control_time_offset_from_now_ = ros::Time::now() - time;
ResetInterpolator();
std::cout << "<starting> --> <waiting_on_backend>" << std::endl;
state_ = ControllerState::WaitingOnBackend;
} else if (state_ == ControllerState::WaitingOnBackend) {
// The callback switches us out of this one.
} else if (state_ == ControllerState::SyncingBackend) {
// If we've stopped receiving messages from the backend, stop suppressing and transition to
// initializing the interpolator.
if (IsBackendTimedOut(time)) {
std::cout << "<syncing_backend> --> <initializing_interpolator>" << std::endl;
state_ = ControllerState::InitializingInterpolator;
command_suppressor_->StopSuppressing();
}
} else if (state_ == ControllerState::InitializingInterpolator) {
// The callback switches us out of this one.
} else if (state_ == ControllerState::Operational) {
// We're good to go. We'll just execute until it looks like we've lost communication with the
// backend.
if (IsBackendTimedOut(time)) {
ResetInterpolator();
std::cout << "<operational> --> <waiting_on_backend>" << std::endl;
state_ = ControllerState::WaitingOnBackend;
}
}
// Process states.
if (state_ == ControllerState::StartingController) {
// we should immediately transition to waiting on backend.
std::cerr << "There's something wrong. We should never get here. Diagnose "
<< "immediately.";
throw std::runtime_error("Bad state in CommandStreamInterpolator");
return Command::Unavailable();
} else if (state_ == ControllerState::WaitingOnBackend) {
// Just wait until we start receiving messages.
return Command::Unavailable();
} else if (state_ == ControllerState::SyncingBackend) {
// We're currently suppressing in a separate thread using the command_suppressor_.
// Otherwise, do nothing.
return Command::Unavailable();
} else if (state_ == ControllerState::InitializingInterpolator) {
time_at_last_pub_ = time;
// This is handled by the callback.
return Command::Unavailable();
} else if (state_ == ControllerState::Operational) {
auto lookup_time = time - interpolator_lookup_delay_buffer_;
if (lookup_time < eval_time_at_interpolator_start_) {
return Command::Unavailable();
}
// Get interpolated command.
cortex::math::PosVelAccXd eval_point;
std::string error_str;
if (!EvalInterpolator(lookup_time, eval_point, &error_str)) {
ROS_WARN_STREAM("[cortex] " << error_str);
return Command::Unavailable();
}
PublishInterpolatedPoint(time, eval_point);
return Command(eval_point.x);
} else {
std::cerr << "Unrecognized state: " << state_;
throw std::runtime_error("Bad state in CommandStreamInterpolator");
}
}
Eigen::VectorXd CommandStreamInterpolator::NextCommand(const ros::Time& time,
const Eigen::VectorXd& q_measured,
bool* is_interpolator_active) {
auto command = EvalAndStep(time);
if (is_interpolator_active) {
*is_interpolator_active = static_cast<bool>(command);
}
if (command) {
if (start_blending_) {
blending_start_time_ = time;
start_blending_ = false;
}
auto elapse = (time - blending_start_time_).toSec();
auto blend_duration = blending_duration_.toSec();
Eigen::VectorXd q_des = command.commanded_position.head(q_measured.size());
if (elapse < blend_duration) {
auto alpha = elapse / blend_duration; // Goes linearly from zero to one.
alpha *= alpha; // Quadratic increase.
q_des = alpha * q_des + (1. - alpha) * q_measured;
}
return q_des;
} else {
start_blending_ = true;
return q_measured;
}
}
void CommandStreamInterpolator::AddPointToInterpolator(
const cortex_control::JointPosVelAccCommand& command_msg) {
cortex::math::PosVelAccXd point;
point.x = Eigen::Map<const Eigen::VectorXd>(command_msg.q.data(), command_msg.q.size());
point.xd = Eigen::Map<const Eigen::VectorXd>(command_msg.qd.data(), command_msg.qd.size());
point.xdd = Eigen::VectorXd::Zero(point.x.size()); // Accelerations not used by interpolator.
AddPointToInterpolator(command_msg.t, point);
}
void CommandStreamInterpolator::AddPointToInterpolator(const ros::Time& time,
const cortex::math::PosVelAccXd& point) {
std::string error_str;
if (!interp_->AddPt( // We add the first point slightly in the past.
(time - command_time_at_interpolator_start_).toSec(),
point,
&error_str)) {
ROS_ERROR_STREAM("[monolithic]: " << error_str);
}
}
bool CommandStreamInterpolator::EvalInterpolator(const ros::Time& time,
cortex::math::PosVelAccXd& eval_point,
std::string* error_str) const {
if (state_ != ControllerState::Operational) {
if (error_str) {
std::stringstream ss;
ss << "Attempting to evaluate interpolator before reaching "
"ControllerState::Operational. Current state: "
<< cortex::control::ControllerState::Operational;
*error_str = ss.str();
}
return false;
}
return interp_->Eval(
(time - eval_time_at_interpolator_start_).toSec() + time_offset_, eval_point, error_str);
}
void CommandStreamInterpolator::PublishInterpolatedPoint(
const ros::Time& time, const cortex::math::PosVelAccXd& point) const {
if ((time - time_at_last_pub_).toSec() >= time_between_interp_pubs_) {
cortex_control::JointPosVelAccCommand command_msg;
command_msg.header.stamp = time + control_time_offset_from_now_;
command_msg.names = latest_command_msg_.names;
command_msg.q = std::vector<double>(point.x.data(), point.x.data() + point.x.size());
command_msg.qd = std::vector<double>(point.xd.data(), point.xd.data() + point.xd.size());
command_msg.qdd = std::vector<double>(point.xdd.data(), point.xdd.data() + point.xdd.size());
interpolated_command_pub_.publish(command_msg);
time_at_last_pub_ = time;
}
}
void CommandStreamInterpolator::CommandCallback(
const cortex_control::JointPosVelAccCommand& command_msg) {
if (command_msg.period == ros::Duration(0.)) {
std::cout << "<rejecting first message sent by backend>" << std::endl;
return;
}
std::lock_guard<std::mutex> lock(mutex_);
latest_command_msg_ = command_msg;
// While syncing the backend (state ControllerState::SyncingBackend) we suppress commands so
// callbacks stop. We need to check how much time's elapsed since the last callback (and it needs
// to be comparable to eval times, hence we set it to last_eval_time_). Note it's important that
// we check time since the last callback and not time since the state transition because
// transitioning to that state causes suppression commands to be sent to the backend. We want to
// measure how much time has elapsed since the commands actually start being suppressed, not since
// we started *trying* to suppress commands.
eval_time_at_last_callback_ = last_eval_time_;
if (state_ == ControllerState::StartingController) {
return; // Don't do anything until Update has been called once.
} else if (state_ == ControllerState::WaitingOnBackend) {
// The fact we're in the callback means we're up and running. Transition to syncing the backend.
std::cout << "<waiting_on_backend> --> <syncing_backend>" << std::endl;
state_ = ControllerState::SyncingBackend;
command_suppressor_->StartSuppressing();
// Until the backend's synced, we don't want to be interpolating points.
return;
} else if (state_ == ControllerState::SyncingBackend) {
return; // Still syncing.
} else if (state_ == ControllerState::InitializingInterpolator) {
// This aligns the interpolator's start time (command_msg.t) with the last controller time at
// the last Eval.
eval_time_at_interpolator_start_ = last_eval_time_;
command_time_at_interpolator_start_ = command_msg.t;
time_offset_ = 0.;
momentum_ = 0.;
// Now add the current commanded target at the current time and we're ready to start
// interpolating.
AddPointToInterpolator(command_msg);
std::cout << "<initializing_interpolator> --> <operational>" << std::endl;
state_ = ControllerState::Operational;
next_print_time_ = eval_time_at_last_callback_;
print_period_ = ros::Duration(1.);
} else if (state_ == ControllerState::Operational) {
AddPointToInterpolator(command_msg);
auto interp_time = (eval_time_at_last_callback_ - eval_time_at_interpolator_start_).toSec();
auto command_time = (command_msg.t - command_time_at_interpolator_start_).toSec();
auto time_error = command_time - (interp_time + time_offset_);
auto now = (ros::Time::now() - eval_time_at_interpolator_start_).toSec();
cortex_control::CortexCommandAck command_ack;
command_ack.cortex_command_time = command_msg.t;
command_ack.cortex_command_id = command_msg.id;
command_ack.time_offset = ros::Duration(-time_error);
cortex_command_time_pub_.publish(command_ack);
if (eval_time_at_last_callback_ >= next_print_time_) {
std::cout << std::setprecision(10) << "[stream interpolator (" << time_offset_ << ")] "
<< "interp time: " << interp_time << ", now: " << now
<< ", command time: " << command_time << ", interp - command diff: " << -time_error
<< std::endl;
next_print_time_ += print_period_;
}
}
}
void CommandStreamInterpolator::ResetInterpolator() {
start_blending_ = true;
if (use_smoothing_interpolator_) {
// Auto smoothing quartic interpolation. This version always interpolates between the latest
// evaluated (q, qd, qdd) and the incoming (q_target, qd_target).
interp_ = std::make_shared<
cortex::math::SmoothingIncrementalInterpolator<cortex::math::CubicPositionInterpolatorXd>>();
} else {
// Basic quintic interpolation.
interp_ = std::make_shared<cortex::math::IncrementalInterpolator>();
}
}
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/joint_state_listener.h | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
//! @file
//! @brief A simple and general joint state listener to collect the latest information
//! about the robot's state.
#pragma once
#include "cortex/util/state_listener.h"
#include <atomic>
#include <mutex>
#include <unordered_map>
#include <Eigen/Core>
#include <ros/ros.h>
#include <sensor_msgs/JointState.h>
namespace cortex {
namespace util {
/*!\brief Contains information about the state of a single joint. Includes
* the time stamp of the message that last updated the joint.
*/
struct SingleJointState {
double position;
double velocity;
double effort;
ros::Time stamp;
SingleJointState() {}
SingleJointState(double pos, double vel, double eff, const ros::Time &stamp)
: position(pos), velocity(vel), effort(eff), stamp(stamp) {}
};
typedef std::unordered_map<std::string, SingleJointState> JointStateMap;
/*!\brief A very simple joint state listener that records the latest joint
* state information in an unordered map mapping the joint name to the most
* recent SingleJointState information.
*
* It's necessary to process the information this way rather than simply
* recording the joint state messages because there's no guarantee that each
* joint state message contains information about all of the joints. (This, for
* instance, is an issue with Baxter.)
*
* This class is thread safe.
*/
class JointStateListener : public StateListener {
public:
JointStateListener() = default;
/*!\brief Initialize to listen on the specified topic for the given required joints. Blocks
* waiting for for the joints to be available before returning, polling at the given poll rate.
*/
void Init(const std::string &topic,
const std::vector<std::string> &required_joints,
int poll_rate);
/*!\brief Initialize to listen on the specified topic for the given required joints. This version
* does not block. Users must check explicitly is_available() before accessing.
*/
void Init(const std::string &topic, const std::vector<std::string> &required_joints);
void Init(const std::string &topic, int poll_rate);
void Init(const std::string &topic);
/*!\brief Initializes the listener with 0.0 as the a default joint state
* values. The listener becomes immediately available.
*/
void InitWithZero(const std::string &topic, const std::vector<std::string> &required_joints);
/*!\brief Set the required joints (often used in conjunction with
* Init(topic, poll_rate)). Optionally set wait_until_available to true to
* block until they're available.
*/
void SetRequiredJoints(const std::vector<std::string> &required_joints);
/*!\brief Wait until at information for at least the specified
* required_joints is available.
*/
void WaitUntilAvailable(int poll_rate) const;
/*!\brief Returns true if the required joints are available.
*/
bool is_available() const { return is_available_; }
/*!\brief This variant of the accessor is not atomic. It performs no
* locking.
*/
const JointStateMap ¤t_state_map() const;
/*!\brief This variant is atomic. The only way to ensure no race condition
* is to fully copy the internal state out.
*/
JointStateMap current_state_map_atomic() const;
/*!\brief Returns a vector of position values for the given named joints
* retaining the specified joint order.
*/
std::vector<double> CurrentPositions(const std::vector<std::string> &names) const;
/*!\brief Returns the state of the system stamped with the minimum time
* stamp (oldest) of all the active joints. The state is the positions,
* velocities, and accelerations of the active joints.
*/
StampedState CurrentState() const;
/*!\brief Accessors implementing the StateListener API.
*/
StampedState State() const override { return CurrentState(); }
bool IsReady() const override;
/*!\brief Accessor for the vector of required joints.
*/
const std::vector<std::string> &required_joints() const { return required_joints_; }
protected:
/*!\brief Initialize to listen on the specified topic for the given required joints. If
* wait_until_available is true, blocks waiting for for the joints to be available before
* returning, polling at the given poll rate.
*/
void Init(const std::string &topic,
const std::vector<std::string> &required_joints,
bool wait_until_available,
int poll_rate);
// Calls to this method should be externally protected through a msg_mutex_
// lock.
bool HasRequiredJoints() const;
/*!\brief Callback consuming sensor_msgs::JointState messages. Writes the
* information into the internal current_state_map_.
*/
void Callback(const sensor_msgs::JointState &joint_states);
mutable std::mutex msg_mutex_;
std::vector<std::string> required_joints_;
std::unordered_map<std::string, SingleJointState> current_state_map_;
ros::NodeHandle node_handle_;
ros::Subscriber subscriber_;
std::atomic_bool is_available_;
};
//------------------------------------------------------------------------------
// Helper methods
//------------------------------------------------------------------------------
std::unordered_map<std::string, SingleJointState> ToMap(
const sensor_msgs::JointState &joint_states);
std::vector<double> ExtractNamedPositions(
const std::unordered_map<std::string, SingleJointState> &jstates,
const std::vector<std::string> &names);
std::vector<double> ExtractNamedPositions(const sensor_msgs::JointState &joint_states,
const std::vector<std::string> &names);
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/stamped_state.h | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <cstdint>
#include <Eigen/Core>
namespace cortex {
namespace util {
struct StampedState {
double time;
Eigen::VectorXd q;
Eigen::VectorXd qd;
Eigen::VectorXd u;
int dim() const { return q.size(); }
StampedState() = default;
StampedState(uint32_t num_dim);
StampedState(double time, const Eigen::VectorXd &q, const Eigen::VectorXd &qd);
virtual ~StampedState() = default;
bool HasU() const;
};
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/state_listener.h | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <atomic>
#include <Eigen/Core>
#include "cortex/util/stamped_state.h"
namespace cortex {
namespace util {
/**
* \brief Abstract state listener.
*/
class StateListener {
public:
/**
* \brief Creates a StateListener.
*/
StateListener();
/**
* \brief Default virtual destructor.
*/
virtual ~StateListener() = default;
/**
* \brief Returns the latest state.
*/
virtual StampedState State() const = 0;
/**
* \brief Returns true if the state is available.
*/
virtual bool IsReady() const = 0;
/**
* \brief Blocking call to wait until the state is available.
*/
virtual void WaitForReady(double poll_hz = 100) const;
private:
// This is an alternative and ros free implementation of the thread SIGINT
// signal handling
// static void signal_handler(int signal);
// static std::atomic_bool interruped_;
};
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/joint_state_publisher.cpp | /**
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "joint_state_publisher.h"
namespace cortex {
namespace util {
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/ros_util.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/util/ros_util.h"
#include <vector>
#include <ros/package.h>
#include <ros/ros.h>
#include "cortex/util/string.h"
namespace cortex {
namespace util {
void WaitForConnections(const ros::Publisher& pub, double stable_time, double rate_hz) {
std::cout << "Waiting for connections" << std::flush;
auto rate = ros::Rate(rate_hz);
auto last_change_time = ros::Time::now();
auto num_con = pub.getNumSubscribers();
while (ros::ok()) {
std::cout << '.' << std::flush;
auto curr_time = ros::Time::now();
auto latest_num_con = pub.getNumSubscribers();
auto elapse_sec = (curr_time - last_change_time).toSec();
if (latest_num_con != num_con) {
num_con = latest_num_con;
std::cout << num_con << std::flush;
last_change_time = curr_time;
} else if (latest_num_con > 0 && latest_num_con == num_con && elapse_sec >= stable_time) {
std::cout << "<stable>" << std::endl;
break;
}
rate.sleep();
}
}
std::string ExpandRosPkgRelPathRaw(const std::string& pkg_relative_path) {
// Parse out the json config file.
char delim = '/';
std::vector<std::string> tokens = Split(pkg_relative_path, delim);
if (tokens.size() == 0) {
return "";
} else if (tokens.size() < 2) {
return tokens.front();
}
auto pkg_name = tokens.front();
auto rel_path = Join(tokens, delim, 1); // Join all but first.
auto package_path = ros::package::getPath(pkg_name);
auto full_path = package_path + delim + rel_path;
return full_path;
}
std::string ExpandRosPkgRelPath(const std::string& pkg_relative_path) {
std::string expected_prefix = "package://";
if (pkg_relative_path.find(expected_prefix) == 0) {
return ExpandRosPkgRelPathRaw(pkg_relative_path.substr(expected_prefix.size()));
} else {
// The string doesn't start with the expected prefix, but we're still
// supporting that for the time being. WARNING -- this functionality
// is DEPRECATED; we'll require the package:// prefix soon.
ROS_WARN_STREAM(
"Package expansion without the 'package://' prefix is DEPRECATED: " << pkg_relative_path);
return ExpandRosPkgRelPathRaw(pkg_relative_path);
}
}
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/joint_state_publisher.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
//! @file
//! @brief A simple and general joint state listener to collect the latest information
//! about the robot's state.
#pragma once
#include <vector>
#include <ros/ros.h>
#include <sensor_msgs/JointState.h>
#include "cortex/math/state.h"
namespace cortex {
namespace util {
class JointStatePublisher {
public:
JointStatePublisher(const std::vector<std::string>& joint_names,
const std::string& topic,
int queue_size)
: joint_names_(joint_names), seq_(0) {
ros::NodeHandle node_handle;
pub_ = node_handle.advertise<sensor_msgs::JointState>(topic, queue_size);
}
void Publish(const math::State& state) {
sensor_msgs::JointState msg;
msg.header.seq = seq_++;
msg.header.stamp = ros::Time::now();
msg.name = joint_names_;
msg.position = std::vector<double>(state.pos().data(), state.pos().data() + state.pos().size());
msg.velocity = std::vector<double>(state.vel().data(), state.vel().data() + state.vel().size());
pub_.publish(msg);
}
protected:
ros::Publisher pub_;
std::vector<std::string> joint_names_;
int32_t seq_;
};
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/string.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/util/string.h"
#include <sstream>
namespace cortex {
namespace util {
std::vector<std::string> Split(const std::string& str, char delimiter){
std::vector<std::string> tokens;
std::string token;
std::istringstream token_stream(str);
while (std::getline(token_stream, token, delimiter)) {
if (token.size() > 0) {
tokens.push_back(token);
}
}
return tokens;
}
std::string Join(const std::vector<std::string>& tokens, char delimiter, size_t pos) {
std::stringstream ss;
for (auto i = pos; i < tokens.size(); ++i) {
if (i > pos) ss << delimiter;
ss << tokens[i];
}
return ss.str();
}
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/yaml.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <ros/assert.h>
#include <yaml-cpp/yaml.h>
namespace cortex {
namespace util {
//! Extract the named YAML field or assert if the field doesn't exist.
YAML::Node GetFieldOrDie(const YAML::Node& node, const std::string& name) {
auto field = node[name];
ROS_ASSERT_MSG(field, "YAML field not found: %s", name.c_str());
return field;
}
//! Extract a field of the specified type from the YAML node or assert if the field doesn't exist.
template <class T>
T GetOrDie(const YAML::Node& node, const std::string& name) {
auto field = node[name];
ROS_ASSERT_MSG(field, "Could not extract YAML field: %s", name.c_str());
return field.as<T>();
}
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/joint_state_listener.cpp | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/util/joint_state_listener.h"
#include <atomic>
#include <mutex>
#include <ros/assert.h>
namespace cortex {
namespace util {
//------------------------------------------------------------------------------
// JointStateListener implementation
//------------------------------------------------------------------------------
void JointStateListener::Init(const std::string &topic,
const std::vector<std::string> &required_joints,
int poll_rate) {
Init(topic, required_joints, true, poll_rate);
}
void JointStateListener::Init(const std::string &topic) { Init(topic, std::vector<std::string>()); }
void JointStateListener::Init(const std::string &topic, int poll_rate) {
Init(topic, std::vector<std::string>(), poll_rate);
}
void JointStateListener::Init(const std::string &topic,
const std::vector<std::string> &required_joints) {
Init(topic, required_joints, false, 0);
}
// This version is protected (internal).
void JointStateListener::Init(const std::string &topic,
const std::vector<std::string> &required_joints,
bool wait_until_available,
int poll_rate) {
is_available_ = false;
required_joints_ = required_joints;
subscriber_ = node_handle_.subscribe(topic,
10, // Queue size.
&JointStateListener::Callback,
this);
if (wait_until_available) {
WaitUntilAvailable(poll_rate);
}
}
void JointStateListener::InitWithZero(const std::string &topic,
const std::vector<std::string> &required_joints) {
required_joints_ = required_joints;
subscriber_ = node_handle_.subscribe(topic,
10, // Queue size.
&JointStateListener::Callback,
this);
for (uint32_t i = 0; i < required_joints_.size(); ++i) {
current_state_map_[required_joints_[i]] = SingleJointState(0.0, 0.0, 0., ros::Time::now());
}
is_available_ = true;
}
void JointStateListener::SetRequiredJoints(const std::vector<std::string> &required_joints) {
required_joints_ = required_joints;
}
void JointStateListener::WaitUntilAvailable(int poll_rate) const {
ros::Rate rate(poll_rate);
while (ros::ok() && !is_available()) {
rate.sleep();
}
}
void JointStateListener::Callback(const sensor_msgs::JointState &joint_states) {
std::lock_guard<std::mutex> guard(msg_mutex_);
auto n = joint_states.name.size();
ROS_ASSERT(joint_states.position.size() == n);
ROS_ASSERT(joint_states.velocity.size() == n);
ROS_ASSERT(joint_states.effort.size() == 0 || joint_states.effort.size() == n);
bool has_efforts = (joint_states.effort.size() > 0);
for (uint32_t i = 0; i < n; ++i) {
current_state_map_[joint_states.name[i]] =
SingleJointState(joint_states.position[i],
joint_states.velocity[i],
has_efforts ? joint_states.effort[i] : 0.,
joint_states.header.stamp);
}
if (!is_available_) {
// The method HasRequiredJoints(), which requires looping through the
// required joints to see if they're ready, is only called during the
// period of time when we're waiting for the first full set of
// information to be available.
is_available_ = HasRequiredJoints();
}
}
const std::unordered_map<std::string, SingleJointState> &JointStateListener::current_state_map()
const {
return current_state_map_;
}
std::unordered_map<std::string, SingleJointState> JointStateListener::current_state_map_atomic()
const {
std::lock_guard<std::mutex> guard(msg_mutex_);
return current_state_map_;
}
std::vector<double> JointStateListener::CurrentPositions(
const std::vector<std::string> &names) const {
std::lock_guard<std::mutex> guard(msg_mutex_);
return ExtractNamedPositions(current_state_map_, names);
}
StampedState JointStateListener::CurrentState() const {
std::lock_guard<std::mutex> guard(msg_mutex_);
StampedState state(required_joints_.size());
double min_time = 0.;
for (uint32_t i = 0; i < required_joints_.size(); ++i) {
const auto &name = required_joints_[i];
auto access_iter = current_state_map_.find(name);
ROS_ASSERT_MSG(access_iter != current_state_map_.end(),
"Required joint not found: %s", name.c_str());
const auto &single_joint_state = access_iter->second;
state.q(i) = single_joint_state.position;
state.qd(i) = single_joint_state.velocity;
state.u(i) = single_joint_state.effort;
double time = single_joint_state.stamp.toSec();
if (i == 0 || time < min_time) min_time = time;
}
state.time = min_time;
return state;
}
bool JointStateListener::IsReady() const { return is_available(); }
//------------------------------------------------------------------------------
// Helper methods implementation
//------------------------------------------------------------------------------
bool JointStateListener::HasRequiredJoints() const {
bool has_required_joints = true;
std::cout << "Checking required joints: ";
for (const auto &entry_name : required_joints_) {
std::cout << "[" << entry_name << "(";
if (current_state_map_.find(entry_name) == current_state_map_.end()) {
std::cout << "-";
has_required_joints = false;
} else {
std::cout << "+";
}
std::cout << ")]";
}
std::cout << "|" << std::endl;
return has_required_joints;
}
std::unordered_map<std::string, SingleJointState> ToMap(
const sensor_msgs::JointState &joint_states) {
auto n = joint_states.name.size();
ROS_ASSERT(joint_states.position.size() == n);
ROS_ASSERT(joint_states.velocity.size() == n);
ROS_ASSERT(joint_states.effort.size() == n);
std::unordered_map<std::string, SingleJointState> js_map;
for (uint32_t i = 0; i < n; ++i) {
js_map[joint_states.name[i]] = SingleJointState(joint_states.position[i],
joint_states.velocity[i],
joint_states.effort[i],
joint_states.header.stamp);
}
return js_map;
}
std::vector<double> ExtractNamedPositions(
const std::unordered_map<std::string, SingleJointState> &jstates,
const std::vector<std::string> &names) {
std::vector<double> positions;
for (const auto &name : names) {
auto access_iter = jstates.find(name);
ROS_ASSERT(access_iter != jstates.end());
positions.push_back(access_iter->second.position);
}
return positions;
}
std::vector<double> ExtractNamedPositions(const sensor_msgs::JointState &joint_states,
const std::vector<std::string> &names) {
return ExtractNamedPositions(ToMap(joint_states), names);
}
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/string.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <string>
#include <vector>
namespace cortex {
namespace util {
//! Split the specified string `str` into a set of strings delimited by the `delimiter` character.
//! If the delimiter is not found, the entire string is returned as a single token. The returned
//! vector always contains, in union, the set of all characters in the string that aren't
//! delimiters.
std::vector<std::string> Split(const std::string& str, char delimiter);
//! Join the tokens together separated by the specified `delimiter` character. Start with token
//! `pos`. By default, `pos` is zero, so all tokens are included.
std::string Join(const std::vector<std::string>& tokens, char delimiter, size_t pos = 0);
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/set_state_listener.h | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <Eigen/Core>
#include "cortex/util/state_listener.h"
namespace cortex {
namespace util {
/**
* \brief This is a very simple state listener that just reports its set state.
*/
class SetStateListener : public StateListener {
public:
SetStateListener() : is_set_(false) {}
StampedState State() const override { return state_; }
bool IsReady() const override { return is_set_; }
void set_stamped_state(const StampedState &state) { state_ = state; }
protected:
bool is_set_;
StampedState state_;
};
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/stamped_state.cpp | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include <ros/ros.h>
#include "cortex/util/state_listener.h"
namespace cortex {
namespace util {
bool StampedState::HasU() const { return u.size() > 0; }
StampedState::StampedState(uint32_t num_dim)
: time(0.),
q(Eigen::VectorXd::Zero(num_dim)),
qd(Eigen::VectorXd::Zero(num_dim)),
u(Eigen::VectorXd::Zero(num_dim)) {}
StampedState::StampedState(double time, const Eigen::VectorXd &q, const Eigen::VectorXd &qd)
: time(time), q(q), qd(qd) {}
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/ros_util.h | /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <iostream>
#include <sstream>
#include <Eigen/Core>
#include <ros/ros.h>
#include <ros/serialization.h>
#include <yaml-cpp/yaml.h>
namespace cortex {
namespace util {
//------------------------------------------------------------------------------
// Parameter helpers
//------------------------------------------------------------------------------
/*!\briefGeneric more convenient ROS parameter retrieval method that explicitly
* returns the parameter value.
*
* Call as:
*
* auto value = GetParam("/robot/step_size", .5);
* auto str_value = GetParam("/robot/controller_name", "lqr_controller");
*
* Infers the type by the type of the default value passed in.
*
* TODO: Figure out a way to get this to work with passing in const char*
* string literals.
*/
template <class value_t>
value_t GetParam(const std::string& param_name, const value_t& default_value) {
value_t param_value;
ros::param::param(param_name, param_value, default_value);
return param_value;
}
/*!\brief Call as: auto value = GetParam<double>("/robot/step_size"); Need to
* specific supply the template argument for the parameter type.
*/
template <class value_t>
value_t GetParam(const std::string& param_name) {
value_t param_value;
ros::param::get(param_name, param_value);
return param_value;
}
/*!\brief Get all parameters under a particular namespace.
*/
std::vector<std::string> GetNsParams(const std::string& ns);
/*!\brief Returns all of the names and corresponding tags under the given
* namespace.
*
* Returns a vector of pairs with the first element being a name and the second
* being a vector of strings for the tags:
*
* /ns/first/1
* /ns/first/2
* /ns/second
* /ns/third/1
* /ns/third/2
* /ns/third/3
*
* Corresponding return structure:
*
* { "first", {"1", "2"},
* "second", {},
* "third", {"1", "2", "3"} }
*
*/
void GetNsElements(const std::string& ns, std::map<std::string, std::set<std::string>>& elements);
//------------------------------------------------------------------------------
// Subscription helpers
//------------------------------------------------------------------------------
/*!\brief Wait until connections to the publisher stabilize.
*
* Checks at a rate of rate_hz, and requires that the number of subscribers
* doesn't change for stable_time seconds before considering the connection to
* be stable and returning.
*/
void WaitForConnections(const ros::Publisher& pub, double stable_time = .2, double rate_hz = 30.);
//------------------------------------------------------------------------------
// Package helpers
//------------------------------------------------------------------------------
/*!\brief Converts a ROS package relative path into a full path.
*
* The ROS package relative path should take the form:
* package://<pkg_name>/<rel_path>
*
* Returns <global_path_to_pkg>/<rel_path>
*
* For legacy reasons, currently the package:// prefix can be left off, but
* that functionality is nonstandard with ROS and now deprecated. In the near
* future, we'll require these strings to be prefixed with package://.
*/
std::string ExpandRosPkgRelPath(const std::string& pkg_relative_path);
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/state_listener.cpp | /*
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "cortex/util/state_listener.h"
#include <chrono>
#include <csignal>
#include <thread>
#include <ros/ros.h>
namespace cortex {
namespace util {
// std::atomic_bool StateListener::interruped_(false);
StateListener::StateListener() {
// std::signal(SIGINT, &StateListener::signal_handler);
}
void StateListener::WaitForReady(double poll_hz) const {
// This is an alternative and ros free implementation of the thread SIGINT
// signal handling
// auto sleep_duration = std::chrono::duration<double>(1. / poll_hz);
// while (!interruped_.load() && !IsReady()) {
// std::this_thread::sleep_for(sleep_duration);
// }
ros::Rate rate(poll_hz);
while (ros::ok() && !IsReady()) {
rate.sleep();
}
}
// void StateListener::signal_handler(int signal) { interruped_.store(true); }
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/src/cortex/util/ros_message_listener.h | /*
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <atomic>
#include <functional>
#include <mutex>
#include <vector>
#include <ros/ros.h>
namespace cortex {
namespace util {
// Generic message listener that saves off the latest message and makes it available atomically.
//
// Includes flag accessor is_available() saying whether the first message has been received.
// Thereafter, it always reports the last received message through GetLatestMessage(). There is no
// timeout mechanism on these messages, so once is_available() returns true for the first time, it
// will be true for every call after that.
template <class msg_t>
class RosMessageListener {
public:
RosMessageListener(const std::string& topic, int queue_size) {
is_available_ = false;
ros::NodeHandle node_handle;
sub_ = node_handle.subscribe(topic, queue_size, &RosMessageListener<msg_t>::Callback, this);
}
void Callback(const msg_t& msg) {
std::lock_guard<std::mutex> guard(mutex_);
msg_ = msg;
is_available_ = true;
for (auto& f : callbacks_) {
f(msg_);
}
}
bool is_available() const { return is_available_; }
msg_t GetLatestMessage() const {
std::lock_guard<std::mutex> guard(mutex_);
return msg_;
}
void RegisterCallback(const std::function<void(const msg_t&)>& f) { callbacks_.push_back(f); }
protected:
mutable std::mutex mutex_;
ros::Subscriber sub_;
std::atomic_bool is_available_;
msg_t msg_;
std::vector<std::function<void(const msg_t&)>> callbacks_;
};
} // namespace util
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control/config/command_stream_interpolator.yaml | params:
interpolation_delay: .1
use_smoothing_interpolator: true
blending_duration: 2.
backend_timeout: .1 # 6 backend cycles at dt = 1/60
ros_topics:
joint_state: /robot/joint_state # Only used by main().
rmpflow_commands:
command: /cortex/arm/command
ack: /cortex/arm/command/ack
suppress: /cortex/arm/command/suppress
interpolated: /cortex/arm/command/interpolated
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/CMakeLists.txt | cmake_minimum_required(VERSION 3.0.2)
project(isaac_tutorials)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
message_generation
std_msgs
geometry_msgs
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
add_message_files(
FILES
ContactSensor.msg
)
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs # Or other packages containing msgs
geometry_msgs
)
################################################
## Declare ROS dynamic reconfigure parameters ##
################################################
## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES isaac_tutorials
# CATKIN_DEPENDS other_catkin_pkg
DEPENDS message_runtime
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
# ${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/isaac_tutorials.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/isaac_tutorials_node.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
catkin_install_python(PROGRAMS
scripts/ros_publisher.py
scripts/ros_service_client.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )
## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )
## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_isaac_tutorials.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/package.xml | <?xml version="1.0"?>
<package format="2">
<name>isaac_tutorials</name>
<version>0.1.0</version>
<description>The isaac_tutorials package</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<buildtool_depend>catkin</buildtool_depend>
<export>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/launch/apriltag_continuous_detection.launch | <launch>
<arg name="launch_prefix" default="" />
<arg name="node_namespace" default="apriltag_ros_continuous_node" />
<arg name="camera_info" default="/camera_info" />
<arg name="camera_frame" default="sim_camera" />
<arg name="image_topic" default="/rgb" />
<!-- Set parameters -->
<rosparam param="standalone_tags" ns="$(arg node_namespace)">[{'id': 0, 'size': 0.5, 'name': tag_0},{'id': 1, 'size': 0.5, 'name': tag_1},{'id': 2, 'size': 0.5, 'name': tag_2},] </rosparam>
<rosparam param="tag_bundles" ns="$(arg node_namespace)">[] </rosparam>
<node pkg="apriltag_ros" type="apriltag_ros_continuous_node" name="$(arg node_namespace)" clear_params="true" output="screen" launch-prefix="$(arg launch_prefix)">
<!-- Remap topics from those used in code to those on the ROS network -->
<remap from="image_rect" to="$(arg image_topic)" />
<remap from="camera_info" to="$(arg camera_info)" />
<param name="camera_frame" type="str" value="$(arg camera_frame)" />
<param name="tag_family" type="bool" value="true" />
<param name="publish_tag_detections_image" type="bool" value="true" />
<param name="remove_duplicates" type="bool" value="true" />
<!-- <param name="publish_tf" type="bool" value="true" /> -->
</node>
</launch>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/rtx_lidar.rviz | Panels:
- Class: rviz/Displays
Help Height: 138
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /PointCloud21
- /LaserScan1
Splitter Ratio: 0.5
Tree Height: 818
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: PointCloud2
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud2
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: PointCloud2
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.009999999776482582
Style: Flat Squares
Topic: /point_cloud
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/LaserScan
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: LaserScan
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.03999999910593033
Style: Flat Squares
Topic: /scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: sim_lidar
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 35.7125129699707
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.39539822936058044
Target Frame: <Fixed Frame>
Yaw: 2.8385863304138184
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1330
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000001f70000042afc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b000000b000fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000b0fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006e0000042a0000018200fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000015f0000042afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000006e0000042a0000013200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000008d800000060fc0100000002fb0000000800540069006d00650100000000000008d80000057100fffffffb0000000800540069006d006501000000000000045000000000000000000000056a0000042a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 2264
X: 7269
Y: 868
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/turtle_stereo.rviz | Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Camera1
- /Camera2
Splitter Ratio: 0.6198830604553223
Tree Height: 525
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Camera
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /rgb
Name: Camera
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Camera: true
Value: true
Zoom Factor: 1
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /rgb_2
Name: Camera
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Camera: true
Value: true
Zoom Factor: 1
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: sim_camera
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 9.993002891540527
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: -0.032822735607624054
Y: -0.10360819101333618
Z: 0.054841917008161545
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.8803979158401489
Target Frame: <Fixed Frame>
Yaw: 0.3453984558582306
Saved: ~
Window Geometry:
Camera:
collapsed: false
Displays:
collapsed: false
Height: 846
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd00000004000000000000015600000017fc0200000007fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000000000000000fb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000001e1fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000010c000001e10000000000000000fb0000001200530065006c0065006300740069006f006e010000025a000000b2000000000000000000000002000004f300000298fc0100000004fb000000100044006900730070006c0061007900730100000000000001a30000015600fffffffb0000000c00430061006d00650072006101000001a9000001a10000006900fffffffb0000000c00430061006d0065007200610100000350000001a30000006900fffffffb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004f300000039fc0100000002fb0000000800540069006d00650100000000000004f3000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000004f30000001700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Time:
collapsed: false
Tool Properties:
collapsed: false
Width: 1267
X: 367
Y: 177
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/camera_lidar.rviz | Panels:
- Class: rviz/Displays
Help Height: 138
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Camera1_RGB1
- /Camera1_RGB1/Status1
Splitter Ratio: 0.5
Tree Height: 591
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Name: Time
SyncMode: 0
SyncSource: LaserScan
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/LaserScan
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: LaserScan
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.10000000149011612
Style: Flat Squares
Topic: /laser_scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Class: rviz/Image
Enabled: false
Image Topic: /camera_1/depth/image_rect_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Camera1 - Depth
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Class: rviz/Image
Enabled: false
Image Topic: /camera_2/depth/image_rect_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Camera2 - Depth
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Class: rviz/TF
Enabled: true
Filter (blacklist): ""
Filter (whitelist): ""
Frame Timeout: 15
Frames:
All Enabled: true
Camera_2:
Value: true
Lidar:
Value: true
base_footprint:
Value: true
base_link:
Value: true
base_scan:
Value: true
camera_1:
Value: true
caster_back_link:
Value: true
imu_link:
Value: true
odom:
Value: true
wheel_left_link:
Value: true
wheel_right_link:
Value: true
world:
Value: true
Marker Alpha: 1
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
odom:
{}
world:
Camera_2:
{}
Lidar:
{}
base_link:
base_footprint:
{}
base_scan:
{}
caster_back_link:
{}
imu_link:
{}
wheel_left_link:
{}
wheel_right_link:
{}
camera_1:
{}
Update Interval: 0
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /camera_1/rgb/image_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Camera1_RGB
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /camera_2/rgb/image_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Camera_2_RGB
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 17.770366668701172
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: -0.006776329129934311
Y: -0.7690384984016418
Z: 0.5496565103530884
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.785398006439209
Target Frame: <Fixed Frame>
Yaw: 0.7903980016708374
Saved: ~
Window Geometry:
Camera1 - Depth:
collapsed: false
Camera1_RGB:
collapsed: false
Camera2 - Depth:
collapsed: false
Camera_2_RGB:
collapsed: false
Displays:
collapsed: false
Height: 1376
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd000000040000000000000558000004a4fc020000000efb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000b0fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b00000314000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000001e00430061006d00650072006100310020002d00200044006500700074006802000007de000003e800000280000001e0fb0000001e00430061006d00650072006100320020002d0020004400650070007400680200000a44000003a700000280000001e0fb0000000a0049006d00610067006503000001fa000002f000000156000000c4fb0000000a0049006d006100670065030000044f000002ed00000156000000c4fb0000001600430061006d0065007200610031005f0052004700420100000355000000af0000001600fffffffb0000001800430061006d006500720061005f0032005f005200470042010000040a000000d50000001600ffffff000000010000015f000004a4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000004a4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b20000000000000000000000020000099d000000a9fc0100000004fb0000001a00430061006d00650072006100320020002d00200052004700420200000a6a000000dd00000280000001e0fb0000001a00430061006d00650072006100310020002d002000520047004202000006ad000000e50000017900000122fb0000000c00430061006d0065007200610300000204000000e0000001550000010efb0000000a00560069006500770073030000004e00000080000002e100000197000000030000099d00000060fc0100000002fb0000000800540069006d006501000000000000099d0000030700fffffffb0000000800540069006d00650100000000000004500000000000000000000002da000004a400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 2461
X: 544
Y: 80
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/carter_stereo.rviz | Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Grid1/Offset1
- /Left Camera - RGB1/Status1
Splitter Ratio: 0.5
Tree Height: 755
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: ""
- Class: rviz/Displays
Help Height: 70
Name: Displays 1
Property Tree Widget:
Expanded: ~
Splitter Ratio: 0.5
Tree Height: 371
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 200
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: true
base_link:
Value: true
carter_lidar:
Value: true
chassis_link:
Value: true
com_offset:
Value: true
imu:
Value: true
left_wheel_link:
Value: true
odom:
Value: true
rear_pivot_link:
Value: true
rear_wheel_link:
Value: true
right_wheel_link:
Value: true
world:
Value: true
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
odom:
base_link:
{}
Update Interval: 0
Value: true
- Angle Tolerance: 0.10000000149011612
Class: rviz/Odometry
Covariance:
Orientation:
Alpha: 0.5
Color: 255; 255; 127
Color Style: Unique
Frame: Local
Offset: 1
Scale: 1
Value: true
Position:
Alpha: 0.30000001192092896
Color: 204; 51; 204
Scale: 1
Value: true
Value: true
Enabled: true
Keep: 100
Name: Odometry
Position Tolerance: 0.10000000149011612
Shape:
Alpha: 1
Axes Length: 1
Axes Radius: 0.10000000149011612
Color: 255; 25; 0
Head Length: 0.30000001192092896
Head Radius: 0.10000000149011612
Shaft Length: 1
Shaft Radius: 0.05000000074505806
Value: Arrow
Topic: /odom
Unreliable: false
Value: true
- Class: rviz/Image
Enabled: false
Image Topic: /depth_left
Max Value: 1
Median window: 5
Min Value: 0
Name: Left Camera - Depth
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Class: rviz/Image
Enabled: false
Image Topic: /depth_right
Max Value: 1
Median window: 5
Min Value: 0
Name: Right Camera - Depth
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Class: rviz/Image
Enabled: false
Image Topic: /rgb_right
Max Value: 1
Median window: 5
Min Value: 0
Name: Right Camera - RGB
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Class: rviz/Image
Enabled: false
Image Topic: /rgb_left
Max Value: 1
Median window: 5
Min Value: 0
Name: Left Camera - RGB
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: odom
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 16.157394409179688
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: -2.53791
Y: -0.260085
Z: -2.66869
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.7603980302810669
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 3.3435802459716797
Saved: ~
Window Geometry:
Displays:
collapsed: false
Displays 1:
collapsed: false
Height: 1052
Hide Left Dock: false
Hide Right Dock: false
Left Camera - Depth:
collapsed: false
Left Camera - RGB:
collapsed: false
QMainWindow State: 000000ff00000000fd0000000400000000000001560000037efc0200000015fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000037e000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065020000026f000001210000015600000086fb0000000a0049006d00610067006502000001060000011200000156000000edfb0000000a0049006d0061006700650000000211000000af0000000000000000fb0000000a0049006d0061006700650000000287000001340000000000000000fb000000140044006900730070006c00610079007300200031000000029600000125000000c900fffffffb00000026004c006500660074002000430061006d0065007200610020002d002000440065007000740068020000017800000286000001c300000148fb0000002800520069006700680074002000430061006d0065007200610020002d002000440065007000740068020000048b00000283000001bf00000148fb0000002400520069006700680074002000430061006d0065007200610020002d00200052004700420200000490000000a3000001b80000013efb00000022004c006500660074002000430061006d0065007200610020002d00200052004700420200000179000000a0000001c00000014afb0000002400520069006700680074002000430061006d0065007200610020002d0020005200470042030000046f000000aa000001d80000014dfb0000002800520069006700680074002000430061006d0065007200610020002d00200044006500700074006803000004700000025e000001d20000014cfb00000022004c006500660074002000430061006d0065007200610020002d00200052004700420300000184000000a3000001d20000014dfb00000026004c006500660074002000430061006d0065007200610020002d002000440065007000740068030000017d0000025d000001d80000014e000000010000010f0000037efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000037e000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000003efc0100000002fb0000000800540069006d0065010000000000000780000002eb00fffffffb0000000800540069006d006501000000000000045000000000000000000000050f0000037e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Right Camera - Depth:
collapsed: false
Right Camera - RGB:
collapsed: false
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 1920
X: 0
Y: 0
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/apriltag_config.rviz | Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Camera1
Splitter Ratio: 0.6198830604553223
Tree Height: 525
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Camera
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /tag_detections_image
Name: Camera
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility: true
Zoom Factor: 1
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: sim_camera
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 9.993002891540527
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: -0.032822735607624054
Y: -0.10360819101333618
Z: 0.054841917008161545
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.8803979158401489
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 0.3453984558582306
Saved: ~
Window Geometry:
Camera:
collapsed: false
Displays:
collapsed: false
Height: 846
Hide Left Dock: true
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd00000004000000000000015600000201fc0200000007fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000000000000000fb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000001e1fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000010c000001e10000000000000000fb0000001200530065006c0065006300740069006f006e010000025a000000b2000000000000000000000002000004f300000298fc0100000003fb000000100044006900730070006c0061007900730100000000000001580000015600fffffffb0000000c00430061006d006500720061010000015e000003950000006900fffffffb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004f300000039fc0100000002fb0000000800540069006d00650100000000000004f3000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000004f30000001700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Time:
collapsed: false
Tool Properties:
collapsed: false
Width: 1267
X: 214
Y: 474
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/rviz/camera_manual.rviz | Panels:
- Class: rviz/Displays
Help Height: 138
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /RGB1
Splitter Ratio: 0.5968064069747925
Tree Height: 1215
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Depth
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /depth
Name: Depth
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Grid: true
RGB: true
Value: true
Zoom Factor: 1
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /rgb
Name: RGB
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Depth: true
Grid: true
Value: true
Zoom Factor: 1
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: sim_camera
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 10
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.6953980922698975
Target Frame: <Fixed Frame>
Yaw: 0.6353981494903564
Saved: ~
Window Geometry:
Depth:
collapsed: false
Displays:
collapsed: false
Height: 1727
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000001f7000005b7fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b000000b000fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000b0fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006e000005b70000018200fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a00440065007000740068030000115d0000087a000003af00000255fb000000060052004700420300000cc900000878000003ad00000257000000010000015f000005b7fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000006e000005b70000013200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000c4700000060fc0100000002fb0000000800540069006d0065010000000000000c470000057100fffffffb0000000800540069006d00650100000000000004500000000000000000000008d9000005b700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
RGB:
collapsed: false
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 3143
X: 2683
Y: 1407
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/scripts/ros_publisher.py | #!/usr/bin/env python
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import rospy
from sensor_msgs.msg import JointState
import numpy as np
import time
rospy.init_node("test_rosbridge", anonymous=True)
pub = rospy.Publisher("/joint_command", JointState, queue_size=10)
joint_state = JointState()
joint_state.name = [
"panda_joint1",
"panda_joint2",
"panda_joint3",
"panda_joint4",
"panda_joint5",
"panda_joint6",
"panda_joint7",
"panda_finger_joint1",
"panda_finger_joint2",
]
num_joints = len(joint_state.name)
# make sure kit's editor is playing for receiving messages ##
joint_state.position = np.array([0.0] * num_joints)
default_joints = [0.0, -1.16, -0.0, -2.3, -0.0, 1.6, 1.1, 0.4, 0.4]
# limiting the movements to a smaller range (this is not the range of the robot, just the range of the movement
max_joints = np.array(default_joints) + 0.5
min_joints = np.array(default_joints) - 0.5
# position control the robot to wiggle around each joint
time_start = time.time()
rate = rospy.Rate(20)
while not rospy.is_shutdown():
joint_state.position = np.sin(time.time() - time_start) * (max_joints - min_joints) * 0.5 + default_joints
pub.publish(joint_state)
rate.sleep()
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_tutorials/scripts/ros_service_client.py | #!/usr/bin/env python
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import rospy
import numpy as np
from isaac_ros_messages.srv import IsaacPose
from isaac_ros_messages.srv import IsaacPoseRequest
from geometry_msgs.msg import Pose
def teleport_client(msg):
rospy.wait_for_service("teleport")
try:
teleport = rospy.ServiceProxy("teleport", IsaacPose)
teleport(msg)
return
except rospy.ServiceException as e:
print("Service call failed: %s" % e)
# compose teleport messages
cube_pose = Pose()
cube_pose.position.x = np.random.uniform(-2, 2)
cube_pose.position.y = 0
cube_pose.position.z = 0
cube_pose.orientation.w = 1
cube_pose.orientation.x = 0
cube_pose.orientation.y = 0
cube_pose.orientation.z = 0
cone_pose = Pose()
cone_pose.position.x = 0
cone_pose.position.y = np.random.uniform(-2, 2)
cone_pose.position.z = 0
cone_pose.orientation.w = 1
cone_pose.orientation.x = 0
cone_pose.orientation.y = 0
cone_pose.orientation.z = 0
teleport_msg = IsaacPoseRequest()
teleport_msg.names = ["/World/Cube", "/World/Cone"]
teleport_msg.poses = [cube_pose, cone_pose]
teleport_client(teleport_msg)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_moveit/CMakeLists.txt | cmake_minimum_required(VERSION 3.0.2)
project(isaac_moveit)
find_package(catkin REQUIRED COMPONENTS
rospy
sensor_msgs
panda_moveit_config
)
catkin_package()
include_directories(
${catkin_INCLUDE_DIRS}
)
catkin_install_python(PROGRAMS
scripts/panda_combined_joints_publisher.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_moveit/package.xml | <?xml version="1.0"?>
<package format="2">
<name>isaac_moveit</name>
<version>0.1.0</version>
<description>The moveit samples package</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>sensor_msgs</build_export_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>panda_moveit_config</exec_depend>
<exec_depend>franka_description</exec_depend>
<exec_depend>pilz_industrial_motion</exec_depend>
<exec_depend>moveit_planners_chomp</exec_depend>
<exec_depend>rviz_visual_tools</exec_depend>
<export>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_moveit/launch/franka_isaac_execution.launch | <launch>
<param name="use_sim_time" value="true" />
<arg name="debug" default="false" />
<arg name="pipeline" default="ompl" />
<arg name="use_gui" default="false" />
<node pkg="isaac_moveit" name="panda_combined_joints_publisher" type="panda_combined_joints_publisher.py" />
<include file="$(find panda_moveit_config)/launch/planning_context.launch">
<arg name="load_robot_description" value="true"/>
</include>
<node name="joint_state_desired_publisher" pkg="topic_tools" type="relay" args="/joint_states /joint_states_desired" />
<node name="joint_command_publisher" pkg="topic_tools" type="relay" args="/move_group/fake_controller_joint_states /joint_command_desired" />
<include file="$(find panda_moveit_config)/launch/move_group.launch">
<arg name="allow_trajectory_execution" value="true"/>
<arg name="moveit_controller_manager" value="fake"/>
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="pipeline" value="$(arg pipeline)" />
</include>
<arg name="rviz_command_args" value="-d $(find isaac_moveit)/rviz/isaac_moveit_config.rviz" />
<node name="$(anon rviz)" pkg="rviz" type="rviz" respawn="false"
args="$(arg rviz_command_args)" output="screen">
<rosparam command="load" file="$(find panda_moveit_config)/config/kinematics.yaml"/>
</node>
</launch>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_moveit/rviz/isaac_moveit_config.rviz | Panels:
- Class: rviz/Displays
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /MarkerArray1
- /PlanningScene1/Scene Robot1
- /MotionPlanning1
- /MotionPlanning1/Scene Geometry1
- /MotionPlanning1/Scene Robot1
- /MotionPlanning1/Planning Request1
- /MotionPlanning1/Planning Metrics1
- /MotionPlanning1/Planned Path1
Splitter Ratio: 0.7425600290298462
Tree Height: 343
- Class: rviz/Help
Name: Help
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz_visual_tools/RvizVisualToolsGui
Name: RvizVisualToolsGui
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /rviz_visual_tools
Name: MarkerArray
Namespaces:
{}
Queue Size: 100
Value: true
- Class: moveit_rviz_plugin/PlanningScene
Enabled: true
Move Group Namespace: ""
Name: PlanningScene
Planning Scene Topic: /move_group/monitored_planning_scene
Robot Description: robot_description
Scene Geometry:
Scene Alpha: 0.8999999761581421
Scene Color: 50; 230; 50
Scene Display Time: 0.20000000298023224
Show Scene Geometry: true
Voxel Coloring: Z-Axis
Voxel Rendering: Occupied Voxels
Scene Robot:
Attached Body Color: 150; 50; 150
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
panda_hand:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_tcp:
Alpha: 1
Show Axes: false
Show Trail: false
panda_leftfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link8:
Alpha: 1
Show Axes: false
Show Trail: false
panda_rightfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Robot Alpha: 1
Show Robot Collision: false
Show Robot Visual: true
Value: true
- Acceleration_Scaling_Factor: 0.1
Class: moveit_rviz_plugin/MotionPlanning
Enabled: true
Move Group Namespace: ""
MoveIt_Allow_Approximate_IK: false
MoveIt_Allow_External_Program: false
MoveIt_Allow_Replanning: false
MoveIt_Allow_Sensor_Positioning: false
MoveIt_Planning_Attempts: 10
MoveIt_Planning_Time: 5
MoveIt_Use_Cartesian_Path: false
MoveIt_Use_Constraint_Aware_IK: false
MoveIt_Workspace:
Center:
X: 0
Y: 0
Z: 0
Size:
X: 2
Y: 2
Z: 2
Name: MotionPlanning
Planned Path:
Color Enabled: false
Interrupt Display: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
panda_hand:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_tcp:
Alpha: 1
Show Axes: false
Show Trail: false
panda_leftfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link8:
Alpha: 1
Show Axes: false
Show Trail: false
panda_rightfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Loop Animation: false
Robot Alpha: 0.5
Robot Color: 150; 50; 150
Show Robot Collision: false
Show Robot Visual: true
Show Trail: false
State Display Time: 3x
Trail Step Size: 1
Trajectory Topic: move_group/display_planned_path
Use Sim Time: true
Planning Metrics:
Payload: 1
Show Joint Torques: false
Show Manipulability: false
Show Manipulability Index: false
Show Weight Limit: false
TextHeight: 0.07999999821186066
Planning Request:
Colliding Link Color: 255; 0; 0
Goal State Alpha: 1
Goal State Color: 250; 128; 0
Interactive Marker Size: 0
Joint Violation Color: 255; 0; 255
Planning Group: panda_arm
Query Goal State: true
Query Start State: false
Show Workspace: false
Start State Alpha: 1
Start State Color: 0; 255; 0
Planning Scene Topic: move_group/monitored_planning_scene
Robot Description: robot_description
Scene Geometry:
Scene Alpha: 0.8999999761581421
Scene Color: 50; 230; 50
Scene Display Time: 0.009999999776482582
Show Scene Geometry: true
Voxel Coloring: Z-Axis
Voxel Rendering: Occupied Voxels
Scene Robot:
Attached Body Color: 150; 50; 150
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
panda_hand:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_hand_tcp:
Alpha: 1
Show Axes: false
Show Trail: false
panda_leftfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link0_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link1_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link2_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link3_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link4_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link5_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link6_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link7_sc:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
panda_link8:
Alpha: 1
Show Axes: false
Show Trail: false
panda_rightfinger:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Robot Alpha: 1
Show Robot Collision: false
Show Robot Visual: true
Value: true
Velocity_Scaling_Factor: 0.1
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz_visual_tools/KeyTool
Value: true
Views:
Current:
Class: rviz/XYOrbit
Distance: 2.3573100566864014
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0.11356700211763382
Y: 0.10592000186443329
Z: 2.2351800055275817e-07
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.07520356774330139
Target Frame: panda_link0
Yaw: 0.7067751884460449
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 892
Help:
collapsed: false
Hide Left Dock: false
Hide Right Dock: false
MotionPlanning:
collapsed: false
MotionPlanning - Trajectory Slider:
collapsed: false
QMainWindow State: 000000ff00000000fd0000000200000000000001f300000322fc020000000efb000000100044006900730070006c006100790073010000003d00000194000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a00560069006500770073000000026d000000b5000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb0000002e004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d00200053006c0069006400650072010000026f000000480000000000000000fb00000024005200760069007a00560069007300750061006c0054006f006f006c007300470075006900000003140000004b0000004100fffffffb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e006701000001d7000001880000017d00fffffffb000000120020002d00200053006c006900640065007201000002df000000480000000000000000fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067010000032d000001fb0000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c0069006400650072000000031e000000410000001600000016fb000000280020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb0000003c005400720061006a006500630074006f007200790020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb000000280020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff000000000000000000000001000001f300000322fc0200000002fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067010000003d000003220000000000000000fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067010000003d0000032200000000000000000000054b0000032200000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
RvizVisualToolsGui:
collapsed: false
Views:
collapsed: false
Width: 1860
X: 341
Y: 59
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_moveit/scripts/panda_combined_joints_publisher.py | #!/usr/bin/env python
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import rospy
from sensor_msgs.msg import JointState
joints_dict = {}
def joint_states_callback(message):
joint_commands = JointState()
joint_commands.header = message.header
for i, name in enumerate(message.name):
# Storing arm joint names and positions
joints_dict[name] = message.position[i]
if name == "panda_finger_joint1":
# Adding additional panda_finger_joint2 state info (extra joint used in isaac sim)
# panda_finger_joint2 mirrors panda_finger_joint1
joints_dict["panda_finger_joint2"] = message.position[i]
joint_commands.name = joints_dict.keys()
joint_commands.position = joints_dict.values()
# Publishing combined message containing all arm and finger joints
pub.publish(joint_commands)
return
if __name__ == "__main__":
rospy.init_node("panda_combined_joints_publisher")
pub = rospy.Publisher("/joint_command", JointState, queue_size=1)
rospy.Subscriber("/joint_command_desired", JointState, joint_states_callback, queue_size=1)
rospy.spin()
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/plugin.xml | <library path="lib/libcortex_control_franka">
<class name="cortex_control_franka/InterpolatedCommandStreamController" type="cortex::control::franka::InterpolatedCommandStreamController" base_class_type="controller_interface::ControllerBase">
<description>
Receives a stream of commands from a reactive motion generator, interpolates them, and
streams realtime position commands to Franka Panda's joint-space position controller.
</description>
</class>
</library>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/CMakeLists.txt | cmake_minimum_required(VERSION 2.8.3)
project(cortex_control_franka)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PKG_DEPENDS_LIST
controller_interface
cortex_control
dynamic_reconfigure
franka_hw
hardware_interface
pluginlib
realtime_tools
roscpp
std_msgs
)
find_package(
catkin
REQUIRED
COMPONENTS
${PKG_DEPENDS_LIST}
)
generate_dynamic_reconfigure_options(
cfg/compliance_param.cfg
cfg/desired_mass_param.cfg
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES cortex_control_franka
CATKIN_DEPENDS
${PKG_DEPENDS_LIST}
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_library(
${PROJECT_NAME}
src/interpolated_command_stream_controller.cpp
)
target_link_libraries(
${PROJECT_NAME}
${catkin_LIBRARIES}
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/package.xml | <?xml version="1.0"?>
<package format="2">
<name>cortex_control_franka</name>
<version>0.1.0</version>
<description>Cortex Control ROS extensions with Franka ROS dependencies.</description>
<maintainer email="[email protected]">Nathan Ratliff</maintainer>
<license>BSD</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<depend>controller_interface</depend>
<depend>dynamic_reconfigure</depend>
<depend>franka_hw</depend>
<depend>hardware_interface</depend>
<depend>cortex_control</depend>
<depend>pluginlib</depend>
<depend>realtime_tools</depend>
<depend>roscpp</depend>
<depend>std_msgs</depend>
<export>
<controller_interface plugin="${prefix}/plugin.xml"/>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/launch/joint_position_controller.launch | <?xml version="1.0" ?>
<launch>
<!-- Load controller parameters and launch the controller -->
<rosparam command="load" file="$(find cortex_control_franka)/config/controller.yaml"/>
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_position_controller"/>
</launch>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/launch/franka_control_cortex.launch | <?xml version="1.0" ?>
<launch>
<arg name="robot_ip" default="172.16.0.2"/>
<arg name="load_gripper" default="true" />
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find franka_description)/robots/panda_arm_hand.urdf.xacro'" if="$(arg load_gripper)" />
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find franka_description)/robots/panda_arm.urdf.xacro'" unless="$(arg load_gripper)" />
<include file="$(find franka_gripper)/launch/franka_gripper.launch" if="$(arg load_gripper)">
<arg name="robot_ip" value="$(arg robot_ip)" />
</include>
<node name="franka_control" pkg="franka_control" type="franka_control_node" output="screen" required="true">
<rosparam command="load" file="$(find franka_control)/config/franka_control_node.yaml" />
<param name="robot_ip" value="$(arg robot_ip)" />
<remap from="/tf" to="/franka_control/tf" />
<remap from="/tf_static" to="/franka_control/tf_static" />
</node>
<rosparam command="load" file="$(find franka_control)/config/default_controllers.yaml" />
<node name="state_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="franka_state_controller"/>
<!-- Joint states publisher -->
<node name="joint_state_publisher" type="joint_state_publisher" pkg="joint_state_publisher" output="screen">
<rosparam if="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states, franka_gripper/joint_states] </rosparam>
<rosparam unless="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states] </rosparam>
<param name="rate" value="250"/>
</node>
<!-- Joint states publisher for commands -->
<node name="joint_state_desired_publisher" type="joint_state_publisher" pkg="joint_state_publisher" output="screen">
<rosparam if="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states_desired, franka_gripper/joint_states] </rosparam>
<rosparam unless="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states_desired] </rosparam>
<param name="rate" value="250"/>
<remap from="/joint_states" to="/joint_states_desired" />
</node>
<!-- Another joint state publisher specifically for cortex topic -->
<node name="joint_state_cortex_publisher" type="joint_state_publisher" pkg="joint_state_publisher" output="screen">
<rosparam if="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states, franka_gripper/joint_states] </rosparam>
<rosparam unless="$(arg load_gripper)" param="source_list">[franka_state_controller/joint_states] </rosparam>
<param name="rate" value="250"/>
<remap from="/joint_states" to="/robot/joint_state" />
</node>
</launch>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/src/interpolated_command_stream_controller.cpp | // Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
#include <iomanip>
#include <iostream>
#include <sstream>
#include <controller_interface/controller_base.h>
#include <cortex/math/interpolation/pos_vel_acc.h>
#include <hardware_interface/hardware_interface.h>
#include <pluginlib/class_list_macros.h>
#include <ros/ros.h>
#include <std_msgs/String.h>
#include "cortex/control/builders.h"
#include "cortex/util/ros_util.h" // TODO: verify has ExpandRosPkgRelPath()
#include "cortex/control/franka/interpolated_command_stream_controller.h"
namespace cortex {
namespace control {
namespace franka {
bool InterpolatedCommandStreamController::init(hardware_interface::RobotHW *robot_hardware,
ros::NodeHandle &node_handle) {
// Initialize connection to the robot and obtain joint handles
joint_interface_ = robot_hardware->get<hardware_interface::PositionJointInterface>();
if (joint_interface_ == nullptr) {
ROS_ERROR("InterpolatedCommandStreamController: Error getting position joint "
"interface from hardware!");
return false;
}
std::vector<std::string> joint_names;
if (!node_handle.getParam("joint_names", joint_names)) {
ROS_ERROR("InterpolatedCommandStreamController: Could not parse joint names");
}
if (joint_names.size() != 7) {
ROS_ERROR_STREAM("InterpolatedCommandStreamController: Wrong number of joint names, got"
<< joint_names.size() << " instead of 7 names!");
return false;
}
joint_handles_.resize(joint_names.size());
for (size_t i = 0; i < joint_names.size(); ++i) {
try {
joint_handles_[i] = joint_interface_->getHandle(joint_names[i]);
} catch (hardware_interface::HardwareInterfaceException const &e) {
ROS_ERROR_STREAM(
"InterpolatedCommandStreamController: Exception getting joint handles: " << e.what());
return false;
}
}
auto command_stream_interpolator_config = YAML::LoadFile(
cortex::util::ExpandRosPkgRelPath("package://cortex_control_franka/config/command_stream_interpolator.yaml"));
command_stream_interpolator_ = cortex::control::LoadCommandStreamInterpolatorFromYaml(
command_stream_interpolator_config);
return true;
}
void InterpolatedCommandStreamController::starting(ros::Time const &time) {
initialize_blending_ = true;
print_period_ = ros::Duration(1.);
start_time_ = time;
controller_time_ = time;
next_print_time_ = time;
command_stream_interpolator_->Start();
}
Eigen::VectorXd InterpolatedCommandStreamController::current_position() const {
Eigen::VectorXd q(joint_handles_.size());
for (size_t i = 0; i < joint_handles_.size(); ++i) {
q[i] = joint_handles_[i].getPosition();
}
return q;
}
void InterpolatedCommandStreamController::send_current_position() {
send_position_command(current_position());
}
void InterpolatedCommandStreamController::send_position_command(Eigen::VectorXd const &q) {
for (size_t i = 0; i < joint_handles_.size(); ++i) {
joint_handles_[i].setCommand(q[i]);
}
}
void InterpolatedCommandStreamController::update(ros::Time const &time,
ros::Duration const &period) {
// Update time information.
//
// WARNING: This method of accumulation into a duration using the period
// provided to the method is the only way of handling time
// that works, all other options will result in the robot
// producing motor noises during motion.
controller_time_ += period;
bool is_interpolator_active;
send_position_command(command_stream_interpolator_->NextCommand(
controller_time_, current_position(), &is_interpolator_active));
if (time >= next_print_time_) {
std::cout << std::setprecision(10) << "[franka] time: " << (time - start_time_).toSec()
<< ", control_time: " << (controller_time_ - start_time_).toSec()
<< ", now: " << (ros::Time::now() - start_time_).toSec()
<< ", period: " << period.toSec() << std::endl;
next_print_time_ += print_period_;
}
}
} // namespace franka
} // namespace control
} // namespace cortex
PLUGINLIB_EXPORT_CLASS(cortex::control::franka::InterpolatedCommandStreamController,
controller_interface::ControllerBase)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/src/python/franka_gripper_commander.py | # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# Simple action client interface to the gripper action server.
from __future__ import absolute_import, division, print_function, unicode_literals
from franka_gripper.msg import GraspAction, GraspGoal, GraspEpsilon, MoveAction, MoveGoal
import numpy as np
import rospy
import actionlib
import argparse
# A gripper opening width of 0.8 appears full open, but Franka claims it will cause issues.
# The nominal maximum opening width is 0.7. Here we compromise between the two.
open_pos = 0.75
class FrankaGripperCommander(object):
def __init__(self, verbose=False):
self.verbose = verbose
self.grasp_client = actionlib.SimpleActionClient("/franka_gripper/grasp", GraspAction)
self.move_client = actionlib.SimpleActionClient("/franka_gripper/move", MoveAction)
if self.verbose:
print("Waiting for grasp client...")
self.grasp_client.wait_for_server()
if self.verbose:
print("Waiting for move client...")
self.move_client.wait_for_server()
def close(self, width=0.0, speed=0.03, force=40.0, grasp_eps=(0.2, 0.2), wait=True):
grasp_goal = GraspGoal()
grasp_goal.width = width
grasp_goal.speed = speed
grasp_goal.force = force
grasp_goal.epsilon = GraspEpsilon(inner=grasp_eps[0], outer=grasp_eps[1])
self.grasp_client.send_goal(grasp_goal)
if wait:
self.grasp_client.wait_for_result()
if self.verbose:
print("result:", self.grasp_client.get_result())
def move(self, width, speed=0.03, wait=True):
move_goal = MoveGoal()
move_goal.width = width
move_goal.speed = speed
print("sending goal")
self.move_client.send_goal(move_goal)
if wait:
print("waiting for finish")
self.move_client.wait_for_result()
if self.verbose:
print("result:", self.move_client.get_result())
print("move complete")
def open(self, speed=0.03, wait=True):
self.move(open_pos, speed=speed, wait=wait)
if __name__ == "__main__":
def Grasp(args):
print("Grasping...")
client = actionlib.SimpleActionClient("/franka_gripper/grasp", GraspAction)
# Waits until the action server has started up and started
# listening for goals.
client.wait_for_server()
# Creates a goal to send to the action server.
grasp_goal = GraspGoal()
grasp_goal.width = args.grasp_width
grasp_goal.speed = args.speed
grasp_goal.force = args.force
grasp_goal.epsilon = GraspEpsilon(inner=args.eps_inner, outer=args.eps_outer)
# Sends the goal to the action server.
print(">>>>", grasp_goal)
client.send_goal(grasp_goal)
# Waits for the server to finish performing the action.
client.wait_for_result()
# Prints out the result of executing the action
print("result:", client.get_result())
def Move(args):
print("Moving...")
client = actionlib.SimpleActionClient("/franka_gripper/move", MoveAction)
# Waits until the action server has started up and started
# listening for goals.
client.wait_for_server()
# Creates a goal to send to the action server.
move_goal = GraspGoal()
move_goal.width = args.width
move_goal.speed = args.speed
# Sends the goal to the action server.
client.send_goal(move_goal)
# Waits for the server to finish performing the action.
client.wait_for_result()
# Prints out the result of executing the action
print("result:", client.get_result())
def FrankaGripperCommanderTest(args):
print("Creating gripper commander...")
gripper_commander = FrankaGripperCommander()
print("Closing...")
gripper_commander.close()
print("Opening to all the way...")
gripper_commander.move(0.08)
print("Opening to .2...")
gripper_commander.move(0.02)
print("Opening to .5...")
gripper_commander.move(0.05)
print("Closing...")
gripper_commander.close()
print("Opening to all the way...")
gripper_commander.move(0.08)
def RobustnessTest(args):
commander = FrankaGripperCommander()
mode = "open"
while not rospy.is_shutdown():
if mode == "open":
commander.open(speed=0.2, wait=False)
print("opening...")
mode = "close"
elif mode == "close":
commander.close(speed=0.2, wait=False)
print("closing...")
mode = "open"
else:
raise RuntimeError("Invalid mode:", mode)
wait_time = abs(np.random.normal(loc=0.5, scale=0.75))
print(" wait:", wait_time)
rospy.sleep(wait_time)
parser = argparse.ArgumentParser("gripper_test")
parser.add_argument(
"--mode", type=str, required=True, help="Which mode: close, move, gripper_commander_test, robustness_test."
)
parser.add_argument(
"--width",
type=float,
default=None,
help="How wide in meters. Note that the gripper can open to about .8m wide.",
)
parser.add_argument("--speed", type=float, default=0.03, help="How fast to go in meter per second.")
parser.add_argument("--force", type=float, default=0.03, help="How strongly to grip.")
parser.add_argument(
"--grasp_width",
type=float,
default=0.0,
help="Width of the grasp. Defaults to closing all the way. "
"In conjunction with the default error (set wide) the default "
"behavior is to just close until it feels something.",
)
parser.add_argument(
"--eps_inner", type=float, default=0.2, help="Inner epsilon threshold. Defaults to enabling any error."
)
parser.add_argument(
"--eps_outer", type=float, default=0.2, help="Outer epsilon threshold. Defaults to enabling any error."
)
args = parser.parse_args()
rospy.init_node("gripper_test")
if args.mode == "move":
Move(args)
elif args.mode == "close":
Grasp(args)
elif args.mode == "gripper_commander_test":
FrankaGripperCommanderTest(args)
elif args.mode == "robustness_test":
RobustnessTest(args)
else:
print("ERROR -- unrecognized mode:", args.mode)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/src/python/franka_gripper_command_relay.py | #!/usr/bin/python
# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# Simple action client interface to the gripper action server.
from __future__ import print_function
import argparse
import json
import threading
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import String
from franka_gripper_commander import FrankaGripperCommander
pinch_width = 0.0265
speed = 0.2
class SimGripperCommander(object):
def __init__(self):
pass
def move(self, width, speed, wait=True):
print("[move] width: %.4f, speed %.2f" % (width, speed))
def close(self, width=0.0, speed=0.03, force=40.0, grasp_eps=(0.2, 0.2), wait=True):
print("[close] width: %.4f, speed: %.2f, force: %.2f" % (width, speed, force))
class FrankaGripperCommandRelay(object):
def __init__(self, is_sim=False):
print("Setting up gripper commander")
self.is_sim = is_sim
if self.is_sim:
print("<is sim>")
self.gripper_commander = SimGripperCommander()
else:
print("<is real>")
self.gripper_commander = FrankaGripperCommander(verbose=True)
self.start_time = rospy.Time.now()
self.last_tick_time = self.start_time
self.seconds_between_tick_prints = 0.1
self.command_queue = []
self.command_queue_lock = threading.Lock()
print("Starting subscriber...")
self.command_sub = rospy.Subscriber("/cortex/gripper/command", String, self.command_callback)
print("<ready and listening>")
def command_callback(self, msg):
try:
command = json.loads(msg.data)
try:
self.command_queue_lock.acquire()
self.command_queue.append(command)
finally:
self.command_queue_lock.release()
except ValueError as ve:
print("Jsg parse error -- could not parse command:\n", msg.data)
except Exception as e:
print("Exception in processing command:", e)
print("message data:\n", msg.data)
def process_latest_commands(self):
now = rospy.Time.now()
if (now - self.last_tick_time).to_sec() >= self.seconds_between_tick_prints:
self.last_tick_time = now
try:
self.command_queue_lock.acquire()
command_queue = self.command_queue
self.command_queue = []
finally:
self.command_queue_lock.release()
for command in command_queue:
self.process_latest_command(command)
def process_latest_command(self, cmd):
try:
print("\nprocessing command:", cmd["command"])
if cmd["command"] == "move_to":
print("moving to:", cmd["width"])
self.gripper_commander.move(cmd["width"], speed=speed, wait=True)
elif cmd["command"] == "close_to_grasp":
print("closing to grasp")
self.gripper_commander.close(speed=speed)
else:
print("WARNING -- unrecognized gripper command:", cmd["command"])
except Exception as e:
print("ERROR processing command:\n", cmd)
print("exception:", e)
def run(self):
rate = rospy.Rate(60.0)
while not rospy.is_shutdown():
self.process_latest_commands()
rate.sleep()
if __name__ == "__main__":
node_name = "franka_gripper_commander_relay"
rospy.init_node(node_name)
parser = argparse.ArgumentParser(node_name)
parser.add_argument("--is_sim", action="store_true", help="Set to start in simulated env.")
parser.add_argument("--open", action="store_true", help="Open the gripper then exit.")
parser.add_argument("--close", action="store_true", help="Close the gripper then exit.")
parser.add_argument("--close_pinch", action="store_true", help="Close the gripper then exit.")
args = parser.parse_args()
if args.open:
gripper_commander = FrankaGripperCommander(verbose=True)
gripper_commander.open(speed=speed)
elif args.close:
gripper_commander = FrankaGripperCommander(verbose=True)
gripper_commander.close(speed=speed)
elif args.close_pinch:
gripper_commander = FrankaGripperCommander(verbose=True)
gripper_commander.move(pinch_width, speed=speed, wait=True)
else:
listener = FrankaGripperCommandRelay(args.is_sim)
listener.run()
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/src/python/set_high_collision_thresholds.py | #!/usr/bin/env python
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# Simple action client interface to the gripper action server.
import rospy
from franka_control.srv import SetJointImpedance
from franka_control.srv import SetJointImpedanceRequest
from franka_control.srv import SetForceTorqueCollisionBehavior
from franka_control.srv import SetForceTorqueCollisionBehaviorRequest
rospy.init_node("set_control_parameters")
force_torque_srv = "/franka_control/set_force_torque_collision_behavior"
lower_torque_thresholds_nominal = [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0]
upper_torque_thresholds_nominal = [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0]
lower_force_thresholds_nominal = [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0]
upper_force_thresholds_nominal = [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0]
ft_req = SetForceTorqueCollisionBehaviorRequest()
ft_req.lower_torque_thresholds_nominal = lower_torque_thresholds_nominal
ft_req.upper_torque_thresholds_nominal = upper_torque_thresholds_nominal
ft_req.lower_force_thresholds_nominal = lower_force_thresholds_nominal
ft_req.upper_force_thresholds_nominal = upper_force_thresholds_nominal
print(ft_req)
rospy.loginfo("Waiting for services...")
rospy.wait_for_service(force_torque_srv)
rospy.loginfo("Services ready.")
ft_srv = rospy.ServiceProxy(force_torque_srv, SetForceTorqueCollisionBehavior)
resp = ft_srv(ft_req)
failed = False
if not resp.success:
rospy.logerr("Could not set force torque collision behavior!")
failed = True
else:
rospy.loginfo("Set force torque collision behavior!")
if failed:
raise RuntimeError("Failed to set control parameters")
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/include/cortex/control/franka/interpolated_command_stream_controller.h | // Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
#pragma once
#include <memory>
#include <mutex>
#include <vector>
#include <controller_interface/multi_interface_controller.h>
#include <cortex/control/command_stream_interpolator.h>
#include <cortex_control/JointPosVelAccCommand.h>
#include <hardware_interface/joint_command_interface.h>
#include <hardware_interface/robot_hw.h>
#include <ros/node_handle.h>
#include <ros/time.h>
namespace cortex {
namespace control {
namespace franka {
/**
* \brief Joint position controller using cortex rmp control commands.
*
* This controller forwards with interpolation the received cortex
* control commands to the robot's joint interface.
*/
class InterpolatedCommandStreamController
: public controller_interface::MultiInterfaceController<
hardware_interface::PositionJointInterface> {
public:
/**
* \brief Initializes the controller.
*
* \param robot_hardware handle to the robot's hardware abstraction
* \param node_handle node handle instance
*/
bool init(hardware_interface::RobotHW *robot_hardware, ros::NodeHandle &node_handle) override;
/**
* \brief Initialization of the controller upon activation.
*
* \param time time at which the controller was activated
*/
void starting(ros::Time const &time) override;
/**
* \brief Control update loop execution.
*
* \param time current time
* \param period time elapsed since last call
*/
void update(ros::Time const &time, ros::Duration const &period) override;
private:
/**
* \brief Retrieves the current position from the joint handles.
*/
Eigen::VectorXd current_position() const;
/**
* \brief Sends the robot's current pose to the robot.
*/
void send_current_position();
/**
* \brief Sends the defined position to the robot's joints.
*
* \param q joint position to be sent to the robot
*/
void send_position_command(const Eigen::VectorXd &q);
private:
std::shared_ptr<cortex::control::CommandStreamInterpolator> command_stream_interpolator_;
bool initialize_blending_;
ros::Time controller_time_;
ros::Time start_time_;
hardware_interface::PositionJointInterface *joint_interface_;
std::vector<hardware_interface::JointHandle> joint_handles_;
ros::Duration print_period_;
ros::Time next_print_time_;
};
} // namespace franka
} // namespace control
} // namespace cortex
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/config/controller.yaml | joint_position_controller:
type: cortex_control_franka/InterpolatedCommandStreamController
joint_names:
- panda_joint1
- panda_joint2
- panda_joint3
- panda_joint4
- panda_joint5
- panda_joint6
- panda_joint7
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/cortex_control_franka/config/command_stream_interpolator.yaml | params:
interpolation_delay: .2
use_smoothing_interpolator: true
blending_duration: 2.
backend_timeout: .5
ros_topics:
joint_state: /robot/joint_state
rmpflow_commands:
command: /cortex/arm/command
ack: /cortex/arm/command/ack
suppress: /cortex/arm/command/suppress
interpolated: /cortex/arm/command/interpolated
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/CMakeLists.txt | cmake_minimum_required(VERSION 3.0.2)
project(isaac_vins)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
sensor_msgs
std_msgs
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )
## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# sensor_msgs# std_msgs
# )
################################################
## Declare ROS dynamic reconfigure parameters ##
################################################
## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES a1_launch
# CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/a1_launch.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/a1_launch_node.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )
## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )
## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_a1_launch.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/package.xml | <?xml version="1.0"?>
<package format="2">
<name>isaac_vins</name>
<version>1.0.1</version>
<description>isaac sim visual inertia odometry package demo, currently supports Unitree A1 Quadruped</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>sensor_msgs</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>std_msgs</exec_depend>
<export>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/launch/isaac_a1_vins.launch | <launch>
<!-- VINS config -->
<param name="vins_config_file" type="string" value="$(find isaac_vins)/config/isaac_a1/vins_fusion_isaac_a1.yaml" />
<node name="vinsfusion" pkg="vins" type="vins_node"
args="$(find isaac_vins)/config/isaac_a1/vins_fusion_isaac_a1.yaml" output="screen"/>
<!-- publish a fix transformation, "world" of VINS-FUSION is at IMU, which is higher than the actual ground origin -->
<node pkg="tf" type="static_transform_publisher" name="ground_to_world"
args="0.0 0.0 -0.3 0.0 0.0 0.0 /world /a1_world 1000" />
<node pkg="tf" type="static_transform_publisher" name="body_to_a1_body"
args="0 0 0 0 0 0 /body /a1_body 1000" />
<!-- RVIZ config -->
<node name="rvizvisualisation" pkg="rviz" type="rviz" output="log" args="-d $(find isaac_vins)/rviz/isaac_vins_rviz_config.rviz" />
</launch>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/rviz/isaac_vins_rviz_config.rviz | Panels:
- Class: rviz/Displays
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /VIOGroup1
- /VIOGroup1/VIOPath1
- /VIOGroup1/CameraMarker1
- /VIOGroup1/PointCloud1
- /VIOGroup1/HistoryPointCloud1
- /VIOGroup1/track_image1
- /GlobalGroup1/CarModel1
Splitter Ratio: 0.4651159942150116
Tree Height: 1856
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: PointCloud
- Class: rviz/Displays
Help Height: 138
Name: Displays
Property Tree Widget:
Expanded: ~
Splitter Ratio: 0.5
Tree Height: 270
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Alpha: 1
Class: rviz/Axes
Enabled: true
Length: 0.5
Name: Axes
Radius: 0.05000000074505806
Reference Frame: <Fixed Frame>
Show Trail: false
Value: true
- Class: rviz/Group
Displays:
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /loop_fusion/pose_graph
Name: loopLink
Namespaces:
{}
Queue Size: 100
Value: true
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /loop_fusion/camera_pose_visual
Name: loopCamera
Namespaces:
{}
Queue Size: 100
Value: true
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 204; 0; 0
Enabled: true
Head Diameter: 0.30000001192092896
Head Length: 0.20000000298023224
Length: 0.30000001192092896
Line Style: Lines
Line Width: 0.03999999910593033
Name: loopPath
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.10000000149011612
Shaft Length: 0.10000000149011612
Topic: /loop_fusion/pose_graph_path
Unreliable: false
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: -0.00362956034950912
Min Value: -0.15546569228172302
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud
Color: 255; 255; 255
Color Transformer: FlatColor
Decay Time: 10
Enabled: false
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: PointCloud
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 2
Size (m): 0.009999999776482582
Style: Points
Topic: /loop_fusion/margin_cloud_loop_rect
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: false
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud
Color: 0; 255; 0
Color Transformer: FlatColor
Decay Time: 0
Enabled: false
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: PointCloud
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 4
Size (m): 0.009999999776482582
Style: Points
Topic: /loop_fusion/point_cloud_loop_rect
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: false
- Class: rviz/Image
Enabled: false
Image Topic: /loop_fusion/match_image
Max Value: 1
Median window: 5
Min Value: 0
Name: loop_match_Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
Enabled: true
Name: LoopGroup
- Class: rviz/Group
Displays:
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 25; 255; 0
Enabled: true
Head Diameter: 0.30000001192092896
Head Length: 0.20000000298023224
Length: 0.30000001192092896
Line Style: Lines
Line Width: 0.029999999329447746
Name: VIOPath
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.10000000149011612
Shaft Length: 0.10000000149011612
Topic: /vinsfusion/path
Unreliable: false
Value: true
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /vinsfusion/camera_pose_visual
Name: CameraMarker
Namespaces:
CameraPoseVisualization: true
Queue Size: 100
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: PointCloud
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 2
Size (m): 0.009999999776482582
Style: Points
Topic: /vinsfusion/point_cloud
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud
Color: 0; 255; 0
Color Transformer: FlatColor
Decay Time: 100
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: HistoryPointCloud
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 1
Size (m): 0.009999999776482582
Style: Points
Topic: /vinsfusion/margin_cloud
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Class: rviz/Image
Enabled: false
Image Topic: /vinsfusion/image_track
Max Value: 1
Median window: 5
Min Value: 0
Name: track_image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
Enabled: true
Name: VIOGroup
- Class: rviz/Group
Displays:
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 0; 0; 255
Enabled: true
Head Diameter: 0.30000001192092896
Head Length: 0.20000000298023224
Length: 0.30000001192092896
Line Style: Lines
Line Width: 0.029999999329447746
Name: GloablPath
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.10000000149011612
Shaft Length: 0.10000000149011612
Topic: /globalEstimator/global_path
Unreliable: false
Value: true
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /globalEstimator/car_model
Name: CarModel
Namespaces:
{}
Queue Size: 100
Value: true
Enabled: true
Name: GlobalGroup
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: keyframe_pt
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.009999999776482582
Style: Flat Squares
Topic: /vinsfusion/keyframe_point
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Class: rviz/Marker
Enabled: true
Marker Topic: /vinsfusion/key_poses
Name: key_poses
Namespaces:
key_poses: true
Queue Size: 100
Value: true
- Angle Tolerance: 0.10000000149011612
Class: rviz/Odometry
Covariance:
Orientation:
Alpha: 0.5
Color: 255; 255; 127
Color Style: Unique
Frame: Local
Offset: 1
Scale: 1
Value: true
Position:
Alpha: 0.30000001192092896
Color: 204; 51; 204
Scale: 1
Value: true
Value: true
Enabled: true
Keep: 100
Name: keyframe_pose
Position Tolerance: 0.10000000149011612
Queue Size: 10
Shape:
Alpha: 1
Axes Length: 1
Axes Radius: 0.10000000149011612
Color: 255; 25; 0
Head Length: 0.30000001192092896
Head Radius: 0.10000000149011612
Shaft Length: 1
Shaft Radius: 0.05000000074505806
Value: Arrow
Topic: /vinsfusion/keyframe_pose
Unreliable: false
Value: true
Enabled: true
Global Options:
Background Color: 0; 0; 0
Default Light: true
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/ThirdPersonFollower
Distance: 86.59434509277344
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: -5.432063579559326
Y: -4.7521138191223145
Z: 0.38143399357795715
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 1.0797959566116333
Target Frame: world
Yaw: 3.540623188018799
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 2230
Hide Left Dock: false
Hide Right Dock: true
QMainWindow State: 000000ff00000000fd0000000400000000000003df000007aefc0200000014fb000000100044006900730070006c006100790073010000006e000007ae0000018200fffffffb0000001200530065006c0065006300740069006f006e000000002800000399000000b000fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000b0fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000001200720061007700200049006d0061006700650000000028000000300000000000000000fb00000012007200610077005f0069006d0061006700650000000028000000f90000000000000000fb0000001a0074007200610063006b0065006400200069006d0061006700650000000028000001d50000000000000000fb00000020006c006f006f0070005f006d0061007400630068005f0069006d0061006700650000000192000000d60000000000000000fb000000100044006900730070006c0061007900730000000028000003990000018200fffffffc000000280000011e0000000000fffffffa000000000100000002fb0000001200720061007700200049006d0061006700650000000000ffffffff0000000000000000fb0000001a0074007200610063006b0065006400200069006d0061006700650100000000000002370000000000000000fb0000001000410052005f0069006d0061006700650100000373000000160000000000000000fb0000001200720061007700200069006d006100670065010000038f000000160000000000000000fb00000020006c006f006f0070005f006d0061007400630068005f0049006d00610067006500000004bf000001b60000002600fffffffb0000000a0049006d00610067006501000003a3000001770000000000000000fb00000020006c006f006f0070005f006d0061007400630068005f0049006d00610067006501000005510000015f0000000000000000fb000000160074007200610063006b005f0069006d006100670065020000067e0000049000000280000001e000000001000001ae0000022efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d0000022e0000013200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000f70000000a9fc0100000002fb000000160074007200610063006b005f0069006d006100670065030000080f000003da0000074e00000308fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000f7000000060fc0100000002fb0000000800540069006d0065010000000000000f700000057100fffffffb0000000800540069006d0065010000000000000450000000000000000000000b85000007ae00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 3952
X: 144
Y: 0
loop_match_Image:
collapsed: false
track_image:
collapsed: false
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/config/isaac_a1/vins_fusion_isaac_a1.yaml | %YAML:1.0
#common parameters
#support: 1 imu 1 cam; 1 imu 2 cam: 2 cam;
imu: 0
num_of_cam: 2
imu_topic: "/isaac_a1/imu_data"
image0_topic: "/isaac_a1/camera_forward/camera_left/rgb"
image1_topic: "/isaac_a1/camera_forward/camera_right/rgb"
output_path: "~/output"
cam0_calib: "isaac_left.yaml"
cam1_calib: "isaac_right.yaml"
image_width: 640
image_height: 480
# Extrinsic parameter between IMU and Camera.
estimate_extrinsic: 1 # 0 Have an accurate extrinsic parameters. We will trust the following imu^R_cam, imu^T_cam, don't change it.
# 1 Have an initial guess about extrinsic parameters. We will optimize around your initial guess.
body_T_cam0: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 0, 0, 1, 0.2693,
-1, 0, 0, 0.025,
0, -1, 0, 0.067,
0., 0., 0., 1. ]
body_T_cam1: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 0, 0, 1, 0.2693,
-1, 0, 0, -0.025,
0, -1, 0, 0.067,
0., 0., 0., 1. ]
#Multiple thread support
multiple_thread: 0
#feature traker paprameters
max_cnt: 150 # max feature number in feature tracking
min_dist: 10 # min distance between two features
freq: 15 # frequence (Hz) of publish tracking result. At least 10Hz for good estimation. If set 0, the frequence will be same as raw image
F_threshold: 1.0 # ransac threshold (pixel)
show_track: 1 # publish tracking image as topic
flow_back: 1 # perform forward and backward optical flow to improve feature tracking accuracy
#optimization parameters
max_solver_time: 0.04 # max solver itration time (ms), to guarantee real time
max_num_iterations: 8 # max solver itrations, to guarantee real time
keyframe_parallax: 10.0 # keyframe selection threshold (pixel)
#imu parameters The more accurate parameters you provide, the better performance
acc_n: 0.5 # accelerometer measurement noise standard deviation. #0.2 0.04
gyr_n: 0.1 # gyroscope measurement noise standard deviation. #0.05 0.004
acc_w: 0.001 # accelerometer bias random work noise standard deviation. #0.002
gyr_w: 0.0001 # gyroscope bias random work noise standard deviation. #4.0e-5
g_norm: 9.805 # gravity magnitude
#unsynchronization parameters
estimate_td: 0 # online estimate time offset between camera and imu
td: 0.0 # initial value of time offset. unit: s. readed image clock + td = real image clock (IMU clock)
#loop closure parameters
load_previous_pose_graph: 0 # load and reuse previous pose graph; load from 'pose_graph_save_path'
pose_graph_save_path: "~/output/pose_graph/" # save and load path
save_image: 0 # save image in pose graph for visualization prupose; you can close this function by setting 0
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/config/isaac_a1/isaac_left.yaml | %YAML:1.0
---
model_type: PINHOLE
camera_name: camera
image_width: 640
image_height: 480
distortion_parameters:
k1: 0.0
k2: 0.0
p1: 0.0
p2: 0.0
projection_parameters:
fx: 732.999267578125
fy: 732.9993286132812
cx: 320
cy: 240
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/isaac_vins/config/isaac_a1/isaac_right.yaml | %YAML:1.0
---
model_type: PINHOLE
camera_name: camera
image_width: 640
image_height: 480
distortion_parameters:
k1: 0.0
k2: 0.0
p1: 0.0
p2: 0.0
projection_parameters:
fx: 732.999267578125
fy: 732.9993286132812
cx: 320
cy: 240
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/navigation/carter_description/CMakeLists.txt | cmake_minimum_required(VERSION 3.0.2)
project(carter_description)
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
roscpp
rviz
tf
urdf
xacro
)
catkin_package()
include_directories(
${catkin_INCLUDE_DIRS}
)
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/navigation/carter_description/package.xml | <?xml version="1.0"?>
<package format="2">
<name>carter_description</name>
<version>0.1.0</version>
<description>The carter_description package</description>
<maintainer email="[email protected]">isaac sim</maintainer>
<license>Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>
<url type="Documentation">https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/overview.html</url>
<url type="Forums">https://forums.developer.nvidia.com/c/agx-autonomous-machines/isaac/simulation</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rviz</build_depend>
<build_depend>tf</build_depend>
<build_depend>urdf</build_depend>
<build_depend>xacro</build_depend>
<build_export_depend>geometry_msgs</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rviz</build_export_depend>
<build_export_depend>tf</build_export_depend>
<build_export_depend>urdf</build_export_depend>
<build_export_depend>xacro</build_export_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rviz</exec_depend>
<exec_depend>tf</exec_depend>
<exec_depend>urdf</exec_depend>
<exec_depend>xacro</exec_depend>
<export>
</export>
</package>
|
NVIDIA-Omniverse/IsaacSim-ros_workspaces/noetic_ws/src/navigation/carter_description/urdf/carter.urdf | <?xml version="1.0" encoding="UTF-8"?>
<robot name="carter">
<link name="chassis_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0" />
<geometry>
<mesh filename="package://carter_description/urdf/meshes/chassis.obj" />
</geometry>
<material name="gray"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="-0.07764248 -0.000000 0.14683718" />
<geometry>
<box size=".55 .40 .54"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-0.07764248 -0.000000 0.14683718" />
<mass value="45.88" />
<inertia ixx="1.182744" ixy="0.017957" ixz="-0.077476" iyx="0.017957" iyy="0.538664" iyz="0.000018" izx="-0.077476" izy="0.000018" izz="1.240229"/>
</inertial>
</link>
<link name="left_wheel_link">
<visual>
<origin rpy="1.57057 -1.57057 0" xyz="0 0 0" />
<geometry>
<mesh filename="package://carter_description/urdf/meshes/side_wheel.obj" />
</geometry>
<material name="black"/>
</visual>
<collision>
<origin rpy="1.57057 -1.57057 0" xyz="0 -0.05 0" />
<geometry>
<sphere radius = "0.240"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0 -0.05 0" />
<mass value="4.195729" />
<inertia ixx="0.063680" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.121410" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.063680"/>
</inertial>
</link>
<link name="right_wheel_link">
<visual>
<origin rpy="-1.57057 -1.57057 0" xyz="0 0 0" />
<geometry>
<mesh filename="package://carter_description/urdf/meshes/side_wheel.obj" />
</geometry>
<material name="black"/>
</visual>
<collision>
<origin rpy="-1.57057 -1.57057 0" xyz="0 .05 0" />
<geometry>
<sphere radius = "0.240"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0 .05 0" />
<mass value="4.195729" />
<inertia ixx="0.063680" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.121410" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.063680"/>
</inertial>
</link>
<link name="rear_pivot_link">
<visual>
<origin rpy="-1.57057 0 0" xyz="-.03809695 0 -.088" />
<geometry>
<mesh filename="package://carter_description/urdf/meshes/pivot.obj" />
</geometry>
<material name="black"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="-.01 0 -.03" />
<geometry>
<box size=".09 .08 .12"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-.01 0 -.03" />
<mass value="0.579519"/>
<inertia ixx="0.001361" ixy="-0.000003" ixz="0.000347" iyx="-0.000003" iyy="0.001287" iyz="-0.000010" izx="0.000347" izy="-0.000010" izz="0.000632"/>
</inertial>
</link>
<link name="rear_wheel_link">
<visual>
<origin rpy="1.57057 0 0" xyz="0 0 0" />
<geometry>
<mesh filename="package://carter_description/urdf/meshes/caster_wheel.obj" />
</geometry>
</visual>
<collision>
<origin rpy="1.57057 0 0" xyz="0 0 0" />
<geometry>
<sphere radius=".076"/>
</geometry>
</collision>
<inertial>
<origin rpy="1.57057 0 0" xyz="0.000000 0.000000 0.000000" />
<mass value="1.25"/>
<inertia ixx="0.02888" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.02888" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.02888"/>
</inertial>
</link>
<link name="com_offset">
<collision>
<origin rpy="0 0 0" xyz="0 0 0" />
<geometry>
<box size=".25 .25 .1"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0 0 0" />
<mass value="20.0" />
<inertia ixx="1.208" ixy="0" ixz="0" iyy="1.208" iyz="0" izz="2.08" />
</inertial>
</link>
<link name="imu">
<collision>
<origin rpy="0 0 0" xyz="0 0 0" />
<geometry>
<box size=".1 .1 .1"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0 0 0" />
<mass value=".1" />
<inertia ixx="0.0001667" ixy="0" ixz="0" iyy="0.0001667" iyz="0" izz="0.0001667" />
</inertial>
</link>
<joint name="com_joint" type="fixed">
<origin rpy="0 0 0" xyz="-.3 0 0" />
<axis xyz="0 1 0" />
<parent link="chassis_link" />
<child link="com_offset" />
</joint>
<joint name="imu_joint" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0" />
<axis xyz="0 1 0" />
<parent link="chassis_link" />
<child link="imu" />
</joint>
<joint name="left_wheel" type="continuous">
<origin rpy="0 0 0" xyz="0 0.31420517 0" />
<axis xyz="0 1 0" />
<parent link="chassis_link" />
<child link="left_wheel_link" />
</joint>
<joint name="right_wheel" type="continuous">
<origin rpy="0 0 0" xyz="0 -0.31420517 0" />
<axis xyz="0 1 0" />
<parent link="chassis_link" />
<child link="right_wheel_link" />
</joint>
<joint name="rear_pivot" type="continuous">
<origin rpy="0 0 0" xyz="-0.31613607 0 -.0758" />
<axis xyz="0 0 1" />
<parent link="chassis_link" />
<child link="rear_pivot_link" />
</joint>
<joint name="rear_axle" type="continuous">
<origin rpy="0 0 0" xyz="-.03809695 0 -.08961022" />
<axis xyz="0 1 0" />
<parent link="rear_pivot_link" />
<child link="rear_wheel_link" />
</joint>
</robot>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.