Coder Social home page Coder Social logo

cahrr's Introduction

CAHRR

Build Status

Chi's Advanced Hurricane Robot Runtime

This framework can be embedded into any system. For example, Hurricane, the robot control system for SJTU RoboMaster Competition.

Usage

Refer to Tests.

Structure

System

CAHRR defines a variety of systems being widely used in robot control systems.

  • CAN System (CANSystem.h) - control CAN devices
  • Chassis System (ChassisSystem.h) - control chassis
  • Debug System (DebugSystem.h) - transmit debug information
  • IMU System (IMUSystem.h) - read gyro data from IMU
  • Remote System (RemoteSystem.h) - read user control value from joystick or other devices
  • Ultrasonic System (UltrasonicSystem.h) - use ultrasonic sensor to measure distance

You can either extend these classes or build your own system based on these specifications.

Accumulator and Utils

  • Average Accumulator (AvgAccumulator.h) - feed the accumulator some data and get the average
  • Delta Accumulator (DeltaAccumulator.h) - feed the accumulator current value and get delta from last value
  • PID Rate Accumulator (PIDAccumulator.h) - PID rate control
  • PID Displacement Accumulator (PIDAccumulator.h) - PID displacement control, usually used with rate accumulator
  • Ramp Accumulator (RampAccumulator.h) - feed the accumulator target value and get a value not to far from previous
  • Rotate Accumulator (RotateAccumulator.h) - usually used with motors with feedback of position and provide precise position control
  • clamp (utils.h) - clamp value
  • cycle_err (utils.h) - get continous error
  • map_range (utils.h) - map a range of value to another range

Tasks

Task is the core idea of CAHRR. All of your stuff should be fit in task to provide asynchronous control of all systems.

Each task is made up of (Task.h):

  • initialize() - called on the start of the task
  • destroy() - called at the end of the task
  • isEnd() - a function which returns a boolean value, indicating if this task has been ended. Note that if the task is not wrapped in a task container supporting automated scheduling of tasks, this value is ignored.
  • update() - called at each update cycle

And then there are automated task containers:

  • TimedTask - Task will end if timeout is triggered. You should implement your own time() function based on the system you're using.
  • SwitchTask - Take two tasks as parameters. If selected is false, it will execute the first task. Otherwise the second task is executed.
  • ConditionSwitchTask - Take two tasks as parameters. You should implement member function when(). If when() returns true, it will start the second task, otherwise it will start the first task.
  • AutoSwitchTask - Take two tasks as parameters. If one task ends, start another. If both tasks end, this task ends.
  • TriggeredSwitchTask - Take two tasks as parameters. You should implement your own trigger(). It is like a push button. If you push the button, the light goes on. Another push turns off the light. trigger() returns a signal like this. If it is triggered, TriggeredSwitchTask will switch to another task. By default the first task is executed.
  • ParallelTask - Take a vector of Task* as parameter. All tasks are being executed.
  • SequentialTask - Take a vector of Task* as parameter. Tasks will be executed one by one if the previous one ends. If cycle is on, first task will be executed after last task ends. If cycle is off, all tasks will end and sequential task ends.

If you have any further questions, please submit a issue or refer to unit tests of these modules.

cahrr's People

Contributors

skyzh avatar

Watchers

 avatar  avatar

cahrr's Issues

Test Plan

  • Accumulator for Rotate
  • PID
  • DebugSystem
  • CANSystem
  • Robot
  • OI
  • RemoteSystem
  • GyroSystem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.