A useful list of aliases to put in your .bashrc for working with DCP, Babel and Babel-Babel

You can append these lines to the end of your .bashrc file. I hope they will save time, I use them frequently every day:

Below is a macro for creating a can connection and initializing it, CAN speed is set to 1 Mbit/s, UART speed is set to 3000000 baud and UART control flow type is hardware, name of the created interface is slcan0 and the realpath invocation is maybe not necessary but will resolve the symbolic link.

alias initcan="sudo slcand -o -s8 -t hw -S 3000000 \$(realpath /dev/serial/by-id/usb-Zubax*Babel*-if00) slcan0 && sudo ifconfig slcan0 up && sudo ifconfig slcan0 txqueuelen 100"

If you need a double (or triple or some other number of) redundant connection(s) to be initalized and therefore, then use the below macro. It will resolve the paths that are produced by the glob /dev/serial/by-id/usb-Zubax*Babel*-if00 and then save them to the argument array that exists in GNU bash. Then it will loop over each of these arguments and initialize and interface just like in the previous alias.

alias initmcan="set -- \$(realpath /dev/serial/by-id/usb-Zubax*Babel*-if00) && for ((i=1;i<=\$#;i++)); do sudo slcand -o -s8 -t hw -S 3000000 \"\${!i}\" \"slcan\$((i-1))\" && sudo ifconfig \"slcan\$((i-1))\" txqueuelen 100 && sudo ifconfig \"slcan\$((i-1))\" up; done"

Below is an alias that will run picocom to connect to a serial console of a DCP:

alias dp="picocom --quiet \$(realpath /dev/serial/by-id/usb-Black*-if02) -b 115200"

And also here is one that will loop over all the available interfaces that have this serial console available and launch windows for reading them all:

alias dpm="set -- \$(realpath /dev/serial/by-id/usb-Black*-if02) && for ((i=1;i<=\$#;i++)); do konsole -e \"picocom --quiet \"\${!i}\" -b 115200\" & done"

Here is one that is almost the same but will exit the current console you are in and probably open the two new consoles to the left and right:

alias dpm="set -- \$(realpath /dev/serial/by-id/usb-Black*-if02) && for ((i=1;i<=\$#;i++)); do konsole -e \"picocom --quiet \"\${!i}\" -b 115200\" & done && exit"

Here is an alias that will configure a Yakut environment for you and use all the available slcan interfaces:

alias yee2="UAVCAN__CAN__MTU=8 && export UAVCAN__NODE__ID=126 && export UAVCAN__CAN__IFACE=\"\" && set -- \$(netstat -i | tail -n +3 |cut -d\" \" -f1 | grep \"slcan\") && while (( \"\$#\" )); do    export UAVCAN__CAN__IFACE=\"\$UAVCAN__CAN__IFACE socketcan:\$1\" ;   shift ; done"

Here is what the above alias basically looks like if you want to type in your own slcan interface names:

alias yee="export UAVCAN__CAN__MTU=8 && export UAVCAN__NODE__ID=126 && export UAVCAN__CAN__IFACE=\"socketcan:slcan0 socketcan:slcan1\""

Here is a link to a Python script that I wrote that is mainly concerned with interacting with the user and then calling gdb to upload some firmware through the gdb load command:

It has a unique feature that it can upload the firmware you select to all available DCP interfaces. Thus you can flash many devices at once (as many as are connected by Dronecode Probes to your computer) with one image.

tool <folder-in-which-the-binary-elf-is> -ay -y