Help in breaking down bytes into bits through Masking and Shifting in Python [closed]
Hi all, I am new to Python programming and I need some help. I am currently working on a project for robots and I am being tasked by my supervisor to work on the number of bytes that we are going to transmit. I have a base station to send data to the robot.
So, I am sending cmd_vel which consists of linear and angular velocity. I have calculated the number of bits for each. They are both 7 bits. (X(3 bits). X (4bits)) (The first X values are from 0 to 2 (2 bits) and I used 1 bit as a sign bit to represent +/-)(For the second X value, it is from 0-9 (4 bits)). So in total, that would be 14 bits, so I have to use 1 byte for each.
The problem now is that my supervisor wants me to put these values into Python. He also wants me to send these data as bytes to the robot, and when the robot receives these data, he wants the bytes to be broken down into bits through masking and shifting.
I have no clue on how to do it and I would really appreciate if someone could help me out.
https://www.google.com/search?q=Maski...
I'm sorry, but this does not seem to be a ROS question.
As you write yourself:
I would recommend you post your question on a more appropriate forum.