Skip to content
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

Improved Kinematics #187

Merged
merged 33 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
39c1a58
Reworked kinematics node to use numpy matrix multiplication
liamgilligan Oct 13, 2023
4a326d2
Removed commented-out code and added comments for new code
liamgilligan Oct 13, 2023
085aa50
Updated Motor Configuration Matrix to use real values
liamgilligan Dec 29, 2023
0c19ef0
Removed root3 variable as it is unused
liamgilligan Dec 29, 2023
2d0a26e
Fixed Broken Matrix Multiplication
liamgilligan Dec 29, 2023
bcca5cf
Added TSV file for storing Thrust->Current Data
liamgilligan Dec 29, 2023
574977e
Added functions for converting Thrust->Current and generating paramet…
liamgilligan Dec 29, 2023
1e3612c
Add thrust limit scaling and fixed thrust to current data path
liamgilligan Dec 31, 2023
5ce50c5
Set motor message data directly from numpy func call
liamgilligan Dec 31, 2023
1dceba3
Added thrust limit scaling and pilot thrust control
liamgilligan Dec 31, 2023
694f221
Added the ability to shift the center of mass by changing a ROS Param…
liamgilligan Dec 31, 2023
7135693
Added functionality for respecting current draw limitations
liamgilligan Dec 31, 2023
587a4bc
Replaced lambdas and map/filter with list comprehensions
liamgilligan Jan 2, 2024
be5a597
Handle all-zero twist messages by publishing all-zero motor message
liamgilligan Jan 3, 2024
920733a
Update kinematics debugging view.
mike-matera Jan 3, 2024
a758eae
Updated motor ordering.
mike-matera Jan 3, 2024
af41a67
Adding a bag for debugging.
mike-matera Jan 4, 2024
696ed8d
Fix bag recording
mike-matera Jan 4, 2024
7784fe9
Changed Thrust->Current model to 6th degree polynomial and fixed 0 th…
liamgilligan Jan 12, 2024
0fd9ee5
Added descripton for motor position and thrust arrays
liamgilligan Jan 17, 2024
3d6f585
Updated twist subscription to desired_twist
liamgilligan Jan 17, 2024
13a6387
Changed single quotes to double quotes for consistency
liamgilligan Jan 17, 2024
5822d15
Changed publishing topic name to motor_values
liamgilligan Jan 17, 2024
0065b4f
Added function description for get_polynomial_coef
liamgilligan Jan 17, 2024
ff9e2cc
Fixed lack of and excess of newlines in certain areas
liamgilligan Jan 17, 2024
371c8e6
Deleted outdated motor config comment
liamgilligan Jan 17, 2024
0486c0e
Fixed bug for scaling based off twist and corrected spelling errors
liamgilligan Jan 17, 2024
794ef93
Cleaned up parameter callback function
liamgilligan Jan 17, 2024
b71b84d
Removed CoM offset member variable
liamgilligan Jan 22, 2024
48b8b63
Fixed initilization by passing in CoM offset param
liamgilligan Jan 23, 2024
db8f59e
Changed topic names in Input and RViz to match new topics in kinematics
liamgilligan Jan 28, 2024
57b377e
Updated and reformatted motor position matrix
liamgilligan Feb 1, 2024
db66e1a
Resolved merge conflicts
liamgilligan Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions bags/joy_recording/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Joystick Recording

This is a recording of a joystick. It makes the following moves:

1. Left Stick
1. Up and back
1. Down and back
1. Left and back
1. Right and back
1. Slow circle
1. Right Stick
1. Up and back
1. Down and back
1. Left and back
1. Right and back
1. Slow circle
1. Left trigger pull and release
1. Right trigger pull and release
1. Left trigger pull and release
1. Right trigger pull and release

The total play time is about 52 seconds.

## Using this Bag

The bag replaces the need for a real joystick. Test the `thrust` node by running the `input_xbox_one` node without the `joy` node. This bag works in place of the `joy` node.

Start the input node:

```console
$ ros2 run seahawk input_xbox_one
```

Start the thrust node:

```console
$ ros2 run seahawk thrust
```

Play the bagfile:

```console
$ ros2 bag play bags/joy_recording/
```

26 changes: 26 additions & 0 deletions bags/joy_recording/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
rosbag2_bagfile_information:
version: 5
storage_identifier: sqlite3
duration:
nanoseconds: 52245814145
starting_time:
nanoseconds_since_epoch: 1704409072014791615
message_count: 3583
topics_with_message_count:
- topic_metadata:
name: /joy
type: sensor_msgs/msg/Joy
serialization_format: cdr
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false"
message_count: 3583
compression_format: ""
compression_mode: ""
relative_file_paths:
- rosbag2_2024_01_04-14_57_51_0.db3
files:
- path: rosbag2_2024_01_04-14_57_51_0.db3
starting_time:
nanoseconds_since_epoch: 1704409072014791615
duration:
nanoseconds: 52245814145
message_count: 3583
Binary file not shown.
4 changes: 2 additions & 2 deletions src/seahawk/launch/kinematics_viz.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def generate_launch_description():
default_value=model_path
),
Node(
package='seahawk_deck',
package='seahawk',
executable='rviz_markers',
name='rviz_markers'
),
Expand All @@ -29,7 +29,7 @@ def generate_launch_description():
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=['-d', os.path.join(get_package_share_path('seahawk_deck'), 'rviz/debug_kinematics.rviz')]
arguments=['-d', os.path.join(get_package_share_path('seahawk'), 'rviz/debug_kinematics.rviz')]
),

Node(
Expand Down
2 changes: 1 addition & 1 deletion src/seahawk/seahawk_deck/input_xbox_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self):
self.declare_parameter('angular_y_scale', 0.5) # Pitch
self.declare_parameter('angular_z_scale', 0.5) # Yaw
self.subscription = self.create_subscription(Joy, 'joy', self._callback, 10)
self.twist_pub = self.create_publisher(Twist, 'drive/twist', 10)
self.twist_pub = self.create_publisher(Twist, 'desired_twist', 10)
self.claw_pub = self.create_publisher(Int8MultiArray, 'claw_control', 10)
self.cam_servo_pub = self.create_publisher(Float32, 'camera_control', 10)
self.claw_grab = False
Expand Down
14 changes: 7 additions & 7 deletions src/seahawk/seahawk_deck/rviz_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ class MarkerMaker(Node):
TOP_P = 47*math.pi/36

MOTORS = [
(( MOTOR_X, -MOTOR_Y, BOT_Z), (0,0,5*math.pi/4)),
(( MOTOR_X, MOTOR_Y, TOP_Z), (0,TOP_P,math.pi/4)),
(( MOTOR_X, -MOTOR_Y, TOP_Z), (0,TOP_P,7*math.pi/4)),
((-MOTOR_X, -MOTOR_Y, BOT_Z), (0,0,7*math.pi/4)),
((-MOTOR_X, -MOTOR_Y, TOP_Z), (0,TOP_P,5*math.pi/4)),
((-MOTOR_X, MOTOR_Y, BOT_Z), (0,0,math.pi/4)),
((-MOTOR_X, MOTOR_Y, TOP_Z), (0,TOP_P,3*math.pi/4)),
((-MOTOR_X, -MOTOR_Y, TOP_Z), (0,TOP_P,5*math.pi/4)),
(( MOTOR_X, MOTOR_Y, BOT_Z), (0,0,3*math.pi/4)),
(( MOTOR_X, MOTOR_Y, TOP_Z), (0,TOP_P,math.pi/4)),
(( MOTOR_X, -MOTOR_Y, BOT_Z), (0,0,5*math.pi/4)),
((-MOTOR_X, MOTOR_Y, BOT_Z), (0,0,math.pi/4)),
((-MOTOR_X, -MOTOR_Y, BOT_Z), (0,0,7*math.pi/4)),
]

def __init__(self):
"""Initialize this node"""
super().__init__('marker_maker')
self.marker_pub = self.create_publisher(MarkerArray, 'drive/motors_debug', 10)
self.subscription = self.create_subscription(Float32MultiArray, 'drive/motors', self._callback, 10)
self.subscription = self.create_subscription(Float32MultiArray, 'motor_values', self._callback, 10)

self.markers = MarkerArray()
self.markers.markers = [ Marker() for x in range(8*3) ]
Expand Down Expand Up @@ -98,7 +98,7 @@ def _callback(self, motor_msg):
"""
self.get_logger().info(f"Motor Message: {motor_msg.data}")
for i, motor in enumerate(motor_msg.data):
self.arrows[i].scale.x = -motor
self.arrows[i].scale.x = -motor / 4
self.labels[i].text = f"{i}:{round(motor,2)}"
if motor < -1 or motor > 1:
self.arrows[i].color.r = 1.0
Expand Down
Loading