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

Arduino <-> Jetson Communication #11

Open
1 task done
bchandaka opened this issue Jan 24, 2022 · 5 comments
Open
1 task done

Arduino <-> Jetson Communication #11

bchandaka opened this issue Jan 24, 2022 · 5 comments
Assignees
Milestone

Comments

@bchandaka
Copy link
Member

bchandaka commented Jan 24, 2022

  • Explore Jake's Code
@bchandaka
Copy link
Member Author

Jake's Code: https://github.com/jnicke7/iris-electrical

@Quantum26
Copy link
Contributor

//First byte: contains checksum and motorVal, in the Order Checksum:[7:3], motorVal[2:0]
//Second byte: is the power value.
/*

  • Input[0],[1],[2] correspond to motor
    KEY:
    Motor ID:
    0: Left Drive
    1: Right Drive
    2: Bucket Ladder M
    3: dump conveyor LA
    4: bucket ladder LA
    5: agitator
    6: dump conveyor M
    7: stops motors
    */

Generating Checksum:
--TODO--

@bchandaka bchandaka added this to the Feb 2022 milestone Feb 1, 2022
@Quantum26
Copy link
Contributor

init:
self.arduino = serial.Serial(port = '/dev/ttyACM0',baudrate = 9600, timeout = .1)
self.power = 0

def power_to_bytes(self) -> bytes: #converts self.power into bytes
x = abs(self.power) + 256 * self.numMotor + 256 * 16
#x is two bits, power must be between -127 and 127. probably.
#first byte should be # of motor + b'00010000 <- makes sure non-inputs are not read as power (similar to CRC)
#second byte is power (most significant bit is negative sign)
if(self.power < 0):
x += 128
return x.to_bytes((x.bit_length() + 7) // 8, 'big')

def sendPower(self):
self.arduino.write(self.power_to_bytes()) #writes power to serial

@Quantum26
Copy link
Contributor

Quantum26 commented Feb 17, 2022

  • Create ROS2 arduino package ( needs to be able to start joy, python script, and upload .ino to arduino)

  • Set up Computer <-> Jetson communication to test with remote control

@Quantum26
Copy link
Contributor

https://answers.ros.org/question/377723/ros2-multiple-machines/ possible fix to jetson not communicating properly

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

No branches or pull requests

2 participants