-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ruff/ruff format to pre-commit & Add integration test #28
Open
JafarAbdi
wants to merge
10
commits into
main
Choose a base branch
from
feature/integration_test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1205b10
Add ruff/ruff format to pre-commit & Add integration test
JafarAbdi a6486ff
Set joint_states_ to initial_value as well
JafarAbdi bf1194f
Update comments
JafarAbdi ffd1daa
Update test depends
JafarAbdi a73a22a
Linter
JafarAbdi adb300a
Add xacro as exec depend
JafarAbdi d912cca
More dependencies
JafarAbdi 69b46f6
Add xml linter
JafarAbdi 85dcc27
Convert all depend to test_depend
JafarAbdi bc5fe4d
More dependencies
JafarAbdi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[tool.ruff] | ||
extend-select = [ | ||
# Enabled by default | ||
# pyflakes | ||
# "F", | ||
# pycodestyle | ||
# "E", | ||
"W", | ||
# isort | ||
"I", | ||
# NumPy-specific rules | ||
"NPY", | ||
# Ruff-specific rules | ||
"RUF", | ||
] | ||
# line-length = 88 | ||
ignore = ["E501"] | ||
target-version = "py310" | ||
[tool.ruff.pydocstyle] | ||
convention = "google" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2024 PickNik Inc. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# * Neither the name of the PickNik Inc. nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
import xacro | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
SCRIPT_PATH = Path(os.path.realpath(__file__)).parent | ||
|
||
|
||
def generate_launch_description(): | ||
ros2_controllers_file = Path(SCRIPT_PATH / "ros2_controllers.yaml") | ||
robot_description = { | ||
"robot_description": xacro.process_file(SCRIPT_PATH / "rrr.urdf.xacro").toxml(), | ||
} | ||
controllers = ["joint_state_broadcaster", "joint_trajectory_controller"] | ||
return LaunchDescription( | ||
[ | ||
Node( | ||
package="robot_state_publisher", | ||
executable="robot_state_publisher", | ||
name="robot_state_publisher", | ||
parameters=[robot_description], | ||
), | ||
Node( | ||
package="controller_manager", | ||
executable="ros2_control_node", | ||
parameters=[robot_description, ros2_controllers_file], | ||
output="screen", | ||
), | ||
] | ||
+ [ | ||
Node( | ||
package="controller_manager", | ||
executable="spawner", | ||
arguments=[controller], | ||
) | ||
for controller in controllers | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2024 PickNik Inc. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# * Neither the name of the s nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
|
||
|
||
import os | ||
import unittest | ||
from pathlib import Path | ||
|
||
import launch_testing | ||
from launch import LaunchDescription | ||
from launch.actions import ( | ||
DeclareLaunchArgument, | ||
IncludeLaunchDescription, | ||
TimerAction, | ||
) | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.substitutions import ( | ||
LaunchConfiguration, | ||
PathJoinSubstitution, | ||
) | ||
from launch_ros.actions import Node | ||
|
||
SCRIPT_PATH = Path(os.path.realpath(__file__)).parent | ||
|
||
|
||
def generate_test_description(): | ||
test_node = Node( | ||
executable=LaunchConfiguration("test_file"), | ||
) | ||
|
||
return LaunchDescription( | ||
[ | ||
IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[ | ||
PathJoinSubstitution( | ||
[ | ||
str(SCRIPT_PATH), | ||
"control.launch.py", | ||
], | ||
), | ||
], | ||
), | ||
), | ||
DeclareLaunchArgument("test_file"), | ||
TimerAction(period=2.0, actions=[test_node]), | ||
launch_testing.util.KeepAliveProc(), | ||
launch_testing.actions.ReadyToTest(), | ||
], | ||
), { | ||
"test_node": test_node, | ||
} | ||
|
||
|
||
class TestWaitForCompletion(unittest.TestCase): | ||
# Waits for test to complete, then waits a bit to make sure result files are generated | ||
def test_run_complete(self, test_node): | ||
self.proc_info.assertWaitForShutdown(test_node, timeout=4000.0) | ||
|
||
|
||
@launch_testing.post_shutdown_test() | ||
class TestProcessPostShutdown(unittest.TestCase): | ||
# Checks if the test has been completed with acceptable exit codes (successful codes) | ||
def test_pass(self, proc_info, test_node): | ||
launch_testing.asserts.assertExitCodes(proc_info, process=test_node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
controller_manager: | ||
ros__parameters: | ||
update_rate: 50 | ||
joint_state_broadcaster: | ||
type: joint_state_broadcaster/JointStateBroadcaster | ||
joint_trajectory_controller: | ||
type: joint_trajectory_controller/JointTrajectoryController | ||
|
||
joint_trajectory_controller: | ||
ros__parameters: | ||
joints: | ||
- joint_1 | ||
- joint_2 | ||
- joint_3 | ||
command_interfaces: | ||
- position | ||
state_interfaces: | ||
- position | ||
- velocity | ||
state_publish_rate: 100.0 | ||
action_monitor_rate: 20.0 | ||
allow_partial_joints_goal: false | ||
constraints: | ||
stopped_velocity_tolerance: 0.0 | ||
goal_time: 0.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By setting this can it cause the connected robot to jump to the initial position when started?