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

Humble signal lights #4

Open
wants to merge 5 commits into
base: humble
Choose a base branch
from
Open

Humble signal lights #4

wants to merge 5 commits into from

Conversation

KlaNiedz
Copy link

No description provided.


<exec_depend>rclpy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>can_msgs</exec_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ros2_socketcan_msgs in ros2

<exec_depend>rclpy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>can_msgs</exec_depend>
<exec_depend>lamps_nodes_py</exec_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this package?

pkg: "lamps_control"
exec: "sent_msgs"
name: "sent_msgs"
parameters: ["$(find canbus_modules)/config/lamps.yaml"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean sirius_signal_lights_driver package instead of canbus_modules?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this file?

import rclpy
from rclpy.node import Node
from std_msgs.msg import String
from can_msgs.msg import Frame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use message from ros2_socketcan_msgs instead

Comment on lines +68 to +70
rclpy.spin(sent_canbus_messages)
sent_canbus_messages.destroy_node()
rclpy.shutdown()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rclpy.spin(sent_canbus_messages)
sent_canbus_messages.destroy_node()
rclpy.shutdown()
try:
rclpy.spin(sent_canbus_messages)
except (KeyboardInterrupt, rclpy.executors.ExternalShutdownException):
pass
rclpy.try_shutdown()
sent_canbus_messages.destroy_node()

Comment on lines +28 to +34
self.my_device_id = self.get_parameter('device_id').value
self.my_command_id = self.get_parameter('command_id').value
self.my_green = str(self.get_parameter('green').value)
self.my_yellow= str(self.get_parameter('yellow').value)
self.my_blue = str(self.get_parameter('blue').value)
self.my_red = str(self.get_parameter('red').value)
self.my_beeper = str(self.get_parameter('beeper').value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why there is my_ prefix everywhere?

Suggested change
self.my_device_id = self.get_parameter('device_id').value
self.my_command_id = self.get_parameter('command_id').value
self.my_green = str(self.get_parameter('green').value)
self.my_yellow= str(self.get_parameter('yellow').value)
self.my_blue = str(self.get_parameter('blue').value)
self.my_red = str(self.get_parameter('red').value)
self.my_beeper = str(self.get_parameter('beeper').value)
self.device_id = self.get_parameter('device_id').value
self.command_id = self.get_parameter('command_id').value
self.green = str(self.get_parameter('green').value)
self.yellow= str(self.get_parameter('yellow').value)
self.blue = str(self.get_parameter('blue').value)
self.red = str(self.get_parameter('red').value)
self.beeper = str(self.get_parameter('beeper').value)




def publish_can_frame(self, data_to_msg, frame: Frame = None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def publish_can_frame(self, data_to_msg, frame: Frame = None):
def publish_can_frame(self, data_to_msg):

])
self.my_data = 0

self.send_topic = self.declare_parameter('send_topic', '/sent_canbus_messages').value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't parametrize topic names, they can be easily remapped

Suggested change
self.send_topic = self.declare_parameter('send_topic', '/sent_canbus_messages').value

Comment on lines +60 to +62
self.my_data = [int(self.my_blue), int(self.my_yellow), int(self.my_red), int(self.my_beeper)]

self.publish_can_frame(self.my_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.my_data is not used anywhere else, it can be a local variable

Suggested change
self.my_data = [int(self.my_blue), int(self.my_yellow), int(self.my_red), int(self.my_beeper)]
self.publish_can_frame(self.my_data)
my_data = [int(self.my_blue), int(self.my_yellow), int(self.my_red), int(self.my_beeper)]
self.publish_can_frame(my_data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants