-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: humble
Are you sure you want to change the base?
Conversation
…_robot into humble-signal-lights
|
||
<exec_depend>rclpy</exec_depend> | ||
<exec_depend>std_msgs</exec_depend> | ||
<exec_depend>can_msgs</exec_depend> |
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.
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> |
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.
What is this package?
pkg: "lamps_control" | ||
exec: "sent_msgs" | ||
name: "sent_msgs" | ||
parameters: ["$(find canbus_modules)/config/lamps.yaml"] |
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.
Did you mean sirius_signal_lights_driver
package instead of canbus_modules
?
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.
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 |
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.
Use message from ros2_socketcan_msgs
instead
rclpy.spin(sent_canbus_messages) | ||
sent_canbus_messages.destroy_node() | ||
rclpy.shutdown() |
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.
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() |
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) |
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.
Why there is my_
prefix everywhere?
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): |
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.
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 |
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.
Don't parametrize topic names, they can be easily remapped
self.send_topic = self.declare_parameter('send_topic', '/sent_canbus_messages').value |
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) |
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.
self.my_data is not used anywhere else, it can be a local variable
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) |
No description provided.