-
Notifications
You must be signed in to change notification settings - Fork 526
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
Re-attempting rosserial for VEX Cortex #380
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
00bc535
initial commit
CanyonTurtle 748a17e
reorganized dir to provide project building script
CanyonTurtle 531f3fa
readme change
CanyonTurtle 441b461
readme change
CanyonTurtle daef54b
removed more
CanyonTurtle 6a59c02
renamed logger functions to be more specific.
CanyonTurtle 2ae4fc7
logger name changes
CanyonTurtle 87d154b
added to the readme
CanyonTurtle b264691
readme diagram
CanyonTurtle b341506
image to specify uart configuration
CanyonTurtle 12c65d7
adjusted readme, documentation, and slimmed project structure
CanyonTurtle 8df221c
re-added some necessary infrastructure
CanyonTurtle a22ff27
Added documentation about how to prevent crashes.
CanyonTurtle da35a34
added demos for using a joystick or a phone to control robot
CanyonTurtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# rosserial for VEX Cortex | ||
|
||
This package contains everything needed allow you to run rosserial on the [VEX Cortex](https://www.vexrobotics.com/276-2194.html), on the [PROS Kernel](https://pros.cs.purdue.edu/cortex/index.html). | ||
This package contains everything needed to run rosserial on the [VEX Cortex](https://www.vexrobotics.com/276-2194.html), on the [PROS Kernel](https://pros.cs.purdue.edu/cortex/index.html). | ||
|
||
# Requirements | ||
1. Linux (Only tested on Ubuntu 18.04LTS) | ||
2. ROS (Only tested on ROS Melodic) - [installation guide](http://wiki.ros.org/melodic/Installation/Source). | ||
3. PROS - [installation guide](https://pros.cs.purdue.edu/cortex/getting-started/index.html) | ||
Software: | ||
1. Linux (Only tested on Ubuntu 18.04LTS) (possible, but not tested, on windows + virtual machines with USB support) | ||
2. ROS installed on Linux (Only tested on ROS Melodic) - [installation guide](http://wiki.ros.org/melodic/Installation/Source). | ||
3. PROS installed on Linux - [installation guide](https://pros.cs.purdue.edu/cortex/getting-started/index.html) | ||
Hardware: | ||
1. VEX essentials: VEX Cortex, Joystick, VexNet keys, battery | ||
2. VEX Programming Cable | ||
3. (recommended, for debugging) a [USB-serial adapter](https://www.adafruit.com/product/954) | ||
4. Three Male-Male jumper wires for USB-serial adapter | ||
|
||
# Setup | ||
Setup a ROS workspace and build rosserial packages (including rosserial_vex_cortex) from source: | ||
|
@@ -19,8 +25,8 @@ catkin_make | |
catkin_make install # this will generate folders in the workspace that contain executable scripts. | ||
``` | ||
|
||
# Usage Example(Linux) | ||
This will show you how to run the "hello world" example PROS project. | ||
# Usage Example (Linux) | ||
This will show you how to run the "hello world" example PROS project. Plug in the VEX Programming cable to the computer and the joystick, plug the VexNet keys into the Cortex and the joystick. Power cycle the Joystick and Cortex between cortex downloads for optimal usage. | ||
|
||
### Step 1 : Run the ROS instance | ||
open a terminal window and run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/open/Open/ |
||
|
@@ -49,6 +55,7 @@ This is how rosserial clients are able to communicate with the ROS system. | |
source <your-workspace-name>/install/setup.bash | ||
rosrun rosserial_arduino serial_node.py _port:=/dev/ttyACM0 _baud:=115200 | ||
``` | ||
see the `Serial Connections` section below, for more information about how the serial ports are used. | ||
|
||
### Step 4: Display a topic in a terminal (technically optional) | ||
open another terminal window and run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/open/Open/ |
||
|
@@ -61,28 +68,57 @@ this will display any messages that come through on the "chatter" topic. | |
If everyting is working properly, then the terminal from step 2 should show outputs of `"Hello World!"` This means the bridge between the cortex and ROS is established. | ||
You are now able to use ROS with the VEX Cortex! | ||
|
||
# Debugging on Cortex | ||
PROS does not provide a debugger, but it does provide printing. | ||
use vexroslog(char* out, ...) just like you would use fprintf from the PROS API: | ||
|
||
# Physical Serial Connections | ||
The optimal setup for this project is with two physical serial connections, one for rosserial to function, and one for debugging. The default connection for rosserial is the VEX Programming Cable, and the default debugging serial connection is UART2. | ||
|
||
Since the The VEX programming cable provides the default rosserial connection, the baud rate of the ROS serial connecting node must be 115200 Hz, which is why the command reads: | ||
|
||
```bash | ||
vexroslog("hello, my favorite number is %d", 3); | ||
rosserial_arduino serial_node _port:=/dev/ttyACM0 _baud:=115200 | ||
``` | ||
remember to include this header in your code for logging! | ||
This overrides the default (57600) Hz.To switch the rosserial/debug serial connections, see `logger.h` in your generated PROS project. If you do end up using UART1 or UART2 for rosserial instead of debugging, update the USB device argument: `_port:=/dev/ttyUSB0` instead, and update the baud rate argument, or simply remove it for the default 57600 Hz. | ||
|
||
`include/logger.h`, you can change which serial output to use (stdin/stdout, uart1, or uart2) for debugging. | ||
Also, the USB device path for the VEX Programming cable on linux may either be `/dev/ttyACM0` or `/dev/ttyACM1`. To figure out which to use as an argument, use `pros lsusb`, or unplug/replug the cable from/into the computer and run `dmesg` and look at the last lines. | ||
|
||
to view serial output from UART2, (instead of running `pros terminal`, which only works for stdout), use screen: | ||
Viewing the UART debug stream requires a [USB-serial adapter](https://www.adafruit.com/product/954) for your computer, and it needs to be plugged in correctly. | ||
To set up the wires with the cable linked above, use this layout: | ||
[layout](./uartdiagram.png) | ||
You need male-male jumper wires to plug in this adapter. | ||
Run `dmesg` right after plugging in the adapter to identify the USB device path - it is most likely `/dev/ttyUSB0`. | ||
|
||
To view serial output from UART2, (instead of running `pros terminal`, which only works for the VEX Programming cable), use screen: | ||
```bash | ||
# to install screen: sudo apt-get install screen | ||
screen /dev/ttyUSB0 | ||
screen /dev/ttyUSB0 57600 | ||
``` | ||
note: this requires a [USB-serial adapter](https://www.adafruit.com/product/954) for your computer, and it needs to be plugged in correctly. | ||
To set up the wires with the cable linked above, use this layout: | ||
[layout](./uartdiagram.png) | ||
Again, you may need to change the above command to use the correct USB device path and baud rate, if you change the default configuration. | ||
|
||
You would need male-male jumper wires to plug in this adapter. | ||
to view the UART | ||
PROS does not provide a debugger, but it does provide printing. | ||
use vexroslog(char* out, ...) just like you would use fprintf from the PROS API: | ||
|
||
```bash | ||
vexroslog("hello, my favorite number is %d", 3); | ||
``` | ||
remember to include this header in your code for logging! | ||
```cpp | ||
#include "logger.h" | ||
``` | ||
|
||
# Generating Custom Messages | ||
To design you own ROS messages, it is necessary to add the `msgs` directory to this project, | ||
add the `message_generation` dependency, and make several modifications to this project's `CMakeLists.txt`. | ||
This infrastructure is removed from this project by default, | ||
because there are many useful built-in message types that are used commonly across ROS packages anyway. | ||
|
||
See documentation and source of sister packages, such as `rosserial_arduino`, for more information about generating custom messages. | ||
|
||
# Limitations | ||
Global scope causes segmentation faults. Do not try to use global scope. ROS-related objects in the global scope causes segmentation faults. The cause of this is still unknown, but it may have something to do with the implementation of the global memory segment. | ||
Global scope variables causes segmentation faults. Unlike in the other rosserial examples, avoid ROS objects in the global scope. | ||
|
||
This has been developed and tested on ROS melodic, but it should work on many earier/later versions as well. | ||
|
||
# Speed | ||
Over the VEX Programming cable/VexNet wireless connection, the simplest messages can stream at upwards of 200Hz. More complex messages, such as sensor_msgs::JointState, can be published at 50hz. The baud rate degrades as the distance from the cortex and the Joystick increases, however. | ||
|
||
A wired UART1 or UART2 connection should have higher stability and frequency with arbitrarily-sized messages, with no degradation in baud rate as distance increases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 0 additions & 91 deletions
91
rosserial_vex_cortex/src/rosserial_vex_cortex/make_libraries.py
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think that all
rosserial
packages should have the same version number so it should be 0.7.7. But I may be wrong. See with @mikepurvisThere 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.
thanks, about to re-commit because my commit broke the building (oops).