space-concordia-robotics / robotics-prototype

Teleoperated Mars rover with autonomous capabilities intended for robotics competitions.
https://spaceconcordia.github.io/robotics.html
25 stars 18 forks source link

Comms arm 540: New arm code #559

Closed vexandmore closed 2 years ago

vexandmore commented 2 years ago

Assignee Section

Description

Complete rewrite of the old arm code. Currently, only command that is implemented is set_motor_speeds. It takes 6 floats, and works as follows:

Also, now sending messages back from a teensy to the OBC has been fixed and seems to be working. I have also added CommsNodeLocalTest.py , which is a version of commsnode that uses USB. You will need to change the serial port on it for it to work. It is using this that I have tested messages sending back to the obc.

The arm now sends back an message with ID 1 as a pong, and a message with ID 0 as a debug string when it encounters an invalid command.

Steps for Testing

  1. Compile and upload the arm code (see https://github.com/space-concordia-robotics/robotics-prototype/wiki/Building-the-C---code) then run upload Arm
  2. Then, send a set motor speed command over serial to the Arm teensy. For instance, if the attached sketch simulate-sending-motors.zip - is run in a teensy, which has Serial 1 connected to Serial 1 of the primary teensy, and grounds are connected - it will cause the first four motors, on pins 9, 5, 10, and 6, to pulse in sequence.

For the OBC things:

  1. Compile and upload the Arm code, but in ArmDebug.h, uncomment #define DEBUG.
  2. In CommsNodeLocalTest, change line 225 with the serial port of your Teensy - change it from /dev/ttyACM0 to the one you see in Arduino IDE.
  3. Run ros master with roscore
  4. Run this node with rosrun mcu_control CommsNodeLocalTest.py
  5. In another terminal, run rostopic echo /arm_feedback
  6. In another terminal, run rostopic pub /arm_command std_msgs/String "data: 'ping'" you should see the LED on the teensy blink, and a pong response in arm_feedback
  7. Run rostopic pub /arm_command std_msgs/String "data: 'debug_test'" You should see data: "This is a debug string" in arm_feedback
  8. Run rostopic pub /arm_command std_msgs/String "data: 'set_motor_speeds 255 0 0 0 0 0'" -r 11 if you plug a light into pin 9, you should see it light up.

The approval from all software team leads is necessary before merging.

Reviewer Section

Aside from local testing and the General Integration Test it is implied that static analysis should be included in the verification process.

For Pull Requests that do not include code changes, it is not required to perform the tests above.