Skip to content

Commit

Permalink
allow systemd services to be enabled by default, plus various little …
Browse files Browse the repository at this point in the history
…renames and polishes
  • Loading branch information
Demo User committed Jun 26, 2018
1 parent 60905c7 commit 6d8cb22
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 145 deletions.
31 changes: 17 additions & 14 deletions debian/postinst
Expand Up @@ -5,6 +5,13 @@
set -e # exit on error
. /usr/share/debconf/confmodule # Source debconf library.


# enable services, but don't start yet
systemctl daemon-reload
systemctl enable robotcontrol
systemctl enable rc_battery_monitor

# in interactive mode, ask for configuration options
if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ] ; then

# Fetching configuration from debconf
Expand All @@ -30,34 +37,30 @@ if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ] ; then
echo "setting nothing to run on boot"
rm -f /etc/robotcontrol/link_to_startup_program
else
echo "leaving current robotcontrol startup program alone"
echo "leaving current robot control startup program alone"
fi

# enable services
echo "systemctl daemon-reload"
systemctl daemon-reload
echo "Enabling robotcontrol Service"
systemctl enable robotcontrol
echo "Enabling rc_battery_monitor Service"
systemctl enable rc_battery_monitor
# try to start battery monitor, but ignore errors as this may not work
echo "Starting rc_battery_monitor Service"

# try to start services, but ignore errors as this may not work
set +e
systemctl start rc_battery_monitor
systemctl start robotcontrol

# leave error checking off when setting up device tree too
if [ "$ENABLE_DT" = "true" ]; then
echo "Configuring Device Tree"
configure_robotics_dt
fi

echo "Robotics Cape package installation complete."

echo "**********************************************"
echo "librobotcontrol package installation complete."
if [ "$ENABLE_DT" = "true" ]; then
echo "**********************************************"
echo "Please reboot now to load new device tree."
echo "**********************************************"
fi
echo "**********************************************"

# put error checking back on in case debhelper wants it
set -e

fi

Expand Down
3 changes: 1 addition & 2 deletions debian/rules
Expand Up @@ -4,6 +4,5 @@

override_dh_fixperms:
dh_fixperms \
--exclude var/lib/robotcontrol \
--exclude var/run/robotcontrol
--exclude var/lib/robotcontrol

4 changes: 2 additions & 2 deletions examples/src/rc_balance.c
Expand Up @@ -8,7 +8,7 @@
#include <unistd.h> // for isatty()
#include <stdlib.h> // for strtof()
#include <math.h> // for M_PI
#include <roboticscape.h>
#include <robotcontrol.h>

#include "rc_balance_defs.h"

Expand Down Expand Up @@ -474,7 +474,7 @@ void balance_controller()
* read sensors and compute the state when either ARMED or DISARMED
******************************************************************/
// angle theta is positive in the direction of forward tip around X axis
cstate.theta = mpu_data.dmp_TaitBryan[TB_PITCH_X] + CAPE_MOUNT_ANGLE;
cstate.theta = mpu_data.dmp_TaitBryan[TB_PITCH_X] + BOARD_MOUNT_ANGLE;

// collect encoder positions, right wheel is reversed
cstate.wheelAngleR = (rc_encoder_eqep_read(ENCODER_CHANNEL_R) * 2.0 * M_PI) \
Expand Down
26 changes: 3 additions & 23 deletions examples/src/rc_balance_defs.h
Expand Up @@ -11,34 +11,14 @@
#define DT 0.01 // 1/sample_rate

// Structural properties of eduMiP
#define CAPE_MOUNT_ANGLE 0.49 // increase if mip tends to roll forward
#define BOARD_MOUNT_ANGLE 0.49 // increase if mip tends to roll forward
#define GEARBOX 35.577
#define ENCODER_RES 60
#define WHEEL_RADIUS_M 0.034
#define TRACK_WIDTH_M 0.035
#define V_NOMINAL 7.4

/*
// inner loop controller 200hz old
#define D1_GAIN 0.8
#define D1_ORDER 2
#define D1_NUM {-6.289, 11.910, -5.634 }
#define D1_DEN { 1.000, -1.702, 0.702 }
#define D1_NUM_LEN 3
#define D1_DEN_LEN 3
#define D1_SATURATION_TIMEOUT 0.5
// outer loop controller original 200hz
#define D2_GAIN 0.7
#define D2_ORDER 1
#define D2_NUM { 0.3858, -0.3853 }
#define D2_DEN { 1.0000, -0.9277 }
#define D2_NUM_LEN 2
#define D2_DEN_LEN 2
#define THETA_REF_MAX 0.37
*/

// // inner loop controller 100hz new
// inner loop controller 100hz
#define D1_GAIN 1.05
#define D1_ORDER 2
#define D1_NUM {-4.945, 8.862, -3.967}
Expand All @@ -48,7 +28,7 @@
#define D1_SATURATION_TIMEOUT 0.4


// outer loop controller new 100hz
// outer loop controller 100hz
#define D2_GAIN 0.9
#define D2_ORDER 2
#define D2_NUM {0.18856, -0.37209, 0.18354}
Expand Down
3 changes: 1 addition & 2 deletions examples/src/rc_bind_dsm.c
@@ -1,8 +1,7 @@
/**
* @example rc_bind_dsm
*
* routine to put a DSM2/DSMX satellite receiver into pairing mode James
* Strawson 2014
* routine to put a DSM2/DSMX satellite receiver into pairing mode
*
* DSM satellite receivers are put into bind mode by sending them a sequence of
* pulses right after it receives power and starts up. This program puts the
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_blink.c
Expand Up @@ -3,7 +3,7 @@
* @example rc_blink
*
* This is an example program to demonstrate use of LEDs and button handlers in
* the robotics cape API. Once started, blink will flash the green and red LEDs.
* the Robot Control API. Once started, blink will flash the green and red LEDs.
* Pressing the mode button will cycle through 3 blinking speeds, slow medium,
* and fast. Momentarily pressing the pause button will stop and start the
* blinking by toggling the global state between PAUSED and RUNNING. If the user
Expand Down
4 changes: 2 additions & 2 deletions examples/src/rc_calibrate_accel.c
Expand Up @@ -21,8 +21,8 @@
// change this for your platform
#define I2C_BUS 2

int main(){

int main()
{
printf("\nThis program will generate a new accelerometer calibration file\n");
printf("Press any key to continue\n");
getchar();
Expand Down
4 changes: 2 additions & 2 deletions examples/src/rc_calibrate_dsm.c
Expand Up @@ -16,8 +16,8 @@

int main()
{
printf("Please connect a DSM satellite receiver to your Robotics Cape\n");
printf("and make sure your transmitter is on and paired to the receiver\n");
printf("Please connect a DSM satellite receiver and make sure\n");
printf("your transmitter is on and paired to the receiver.\n");
printf("\n");
printf("Press ENTER to continue or anything else to quit\n");
getchar();
Expand Down
8 changes: 4 additions & 4 deletions examples/src/rc_calibrate_gyro.c
Expand Up @@ -17,14 +17,14 @@
#include <stdio.h>
#include <rc/mpu.h>

// bus for Robotics Cape and BeagleboneBlue is 2
// bus for Robotics Cape and BeagleBone Blue is 2
// change this for your platform
#define I2C_BUS 2

int main(){

int main()
{
printf("\nThis program will generate a new gyro calibration file\n");
printf("keep your beaglebone very still for this procedure.\n");
printf("keep your board very still for this procedure.\n");
printf("Press any key to continue\n");
getchar();
printf("Starting calibration routine\n");
Expand Down
5 changes: 3 additions & 2 deletions examples/src/rc_calibrate_mag.c
Expand Up @@ -20,11 +20,12 @@
// change this for your platform
#define I2C_BUS 2

int main(){
int main()
{

printf("\n");
printf("This will sample the magnetometer for the next 15 seconds\n");
printf("Rotate the cape around in the air through as many orientations\n");
printf("Rotate the board around in the air through as many orientations\n");
printf("as possible to collect sufficient data for calibration\n");
printf("Press any key to continue\n");
getchar();
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_check_battery.c
Expand Up @@ -10,7 +10,7 @@
#include <rc/start_stop.h>
#include <rc/time.h>

#define VOLTAGE_DISCONNECT 1 // Threshold for detecting disconnected battery
#define VOLTAGE_DISCONNECT 1 // Threshold for detecting disconnected battery

int main()
{
Expand Down
6 changes: 3 additions & 3 deletions examples/src/rc_kill.c
Expand Up @@ -2,8 +2,8 @@
* @file rc_kill.c
* @example rc_kill
*
* Example program for shutting down any existing process that uses the robotics
* cape library PID file functionality in <rc/start_stop.h> such as the
* Example program for shutting down any existing process that uses the robot
* control library PID file functionality in <rc/start_stop.h> such as the
* rc_balance and rc_test_start_stop examples.
*/

Expand All @@ -19,7 +19,7 @@ int main()
// quiet on success but prints errors and warnings already.
switch(ret){
case 0:
printf("No existing roboticscape program is running.\n");
printf("No existing robot control program is running.\n");
break;
case 1:
printf("An existing program was running and shut down cleanly.\n");
Expand Down
3 changes: 2 additions & 1 deletion examples/src/rc_test_adc.c
Expand Up @@ -14,7 +14,8 @@
#include <rc/time.h>


int main(){
int main()
{
int i;

// initialize hardware first
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_test_bmp.c
Expand Up @@ -15,7 +15,7 @@
#include <rc/bmp.h>

// choice of 1,2,4,8,16 oversampling. Here we use 16 and sample at 25hz which
// is close to the update rate specified in robotics_cape.h for that oversample.
// is close to the update rate specified in rc/bmp.h for that oversample.
#define OVERSAMPLE BMP_OVERSAMPLE_16

// choice of OFF, 2, 4, 8, 16 filter constants. Here we turn off the filter and
Expand Down
3 changes: 2 additions & 1 deletion examples/src/rc_test_buttons.c
Expand Up @@ -2,7 +2,8 @@
* @file rc_test_buttons.c
* @example rc_test_buttons
*
* This is a very basic test of button functionality. It simply prints to the screen when a button has been pressed or released.
* This is a very basic test of button functionality. It simply prints to the
* screen when a button has been pressed or released.
**/

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_test_drivers.c
Expand Up @@ -2,7 +2,7 @@
* @example rc_test_drivers.c
*
* without actually calling library functions, this checks that all the drivers
* necessary for libroboticscape to work.
* necessary for the robot control library to fully work.
**/

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_test_leds.c
Expand Up @@ -2,7 +2,7 @@
* @file rc_test_leds.c
* @example rc_test_leds
*
* tests all LEDs on Robotics Cape & BeagleBone Blue
* tests all LEDs
*
* @author James Strawson
* @date 1/29/2018
Expand Down
5 changes: 3 additions & 2 deletions examples/src/rc_test_time.c
Expand Up @@ -2,7 +2,7 @@
* @file rc_test_time.c
* @example rc_test_time
*
* Prints the current version of the Robotics Cape Library.
* Prints the current version of the robot control library.
*
*
*
Expand All @@ -16,7 +16,8 @@

#define LOOPS 10000

int main(){
int main()
{
int i;
uint64_t a,b,nanos;

Expand Down
2 changes: 1 addition & 1 deletion examples/src/rc_version.c
Expand Up @@ -2,7 +2,7 @@
* @file rc_version.c
* @example rc_version
*
* Prints the current version of the Robotics Cape Library.
* Prints the current version of the Robot Control Library.
*
*
*
Expand Down
2 changes: 1 addition & 1 deletion library/src/dsm.c
Expand Up @@ -780,7 +780,7 @@ int rc_dsm_bind_routine()

// wait for user to hit enter before continuing
printf("\nDisconnect your dsm satellite receiver if it is still connected\n");
printf("Plug it into the cape quickly and firmly to begin binding.\n");
printf("Plug it into the board quickly and firmly to begin binding.\n");

// wait for the receiver to be disconnected
value = 1;
Expand Down
3 changes: 1 addition & 2 deletions library/src/io/adc.c
@@ -1,8 +1,7 @@
/**
* @file adc_bbb_iio.c
*
* Basic interface to the iio adc driver to reading ADCs on Robotics Cape and
* BeagleBone Blue.
* Basic interface to the iio adc driver
*
* @author James Strawson
* @date 1/29/2018
Expand Down

0 comments on commit 6d8cb22

Please sign in to comment.