How to return a complex data structure from C++ to NODE.JS
2020-01-19
2020-01-18 NODE.JS C++ Interface: Return a custom C++ Object to NODE.JS
How to interface NODE.JS and high performance C++ binaries.
How to return a complex data structure from C++ to NODE.JS
How to return a complex data structure from C++ to NODE.JS
2020-01-09
2019-12-27 OrangeBot Hull
>>>Pi Wars 2020<<<
1OB Hull
With the motors, electronics, layout and software at a good enough point in the development, the moment finally arrived to build the hull of the platform and finally give shape to the robot.1.1Mock Up 1.0
The initial mock up was done in October when the platform still deployed four independent DC motors. The turret was also a place holder, way too small to sport the capabilities required for the Pi Wars.
Illustration 1 - Mock Up 1.0
1.2Mock Up 2.0
With a changed layout, with the boards ready and the gun mechanism is decided, a second mock up was made in to evaluate the fitting of all components.
Illustration 2 - Mock Up 2.0 Structure
The structure changed little overall. The turret turn mechanism was also decided upon. The turret was moved and increased in size. It was decided to put the RPI inside the turret since that's where the camera lay. Also, the elevation mechanism was decided.
Illustration 3 - Mock Up 2.0 Turret
There was the option to use sliding contacts to give the turret infinite 360° turn capability, but this feature was dropped due to the little practical use and the added complexity on the turret turn motor.
Illustration 4 - Mock Up 2.0 Inner Component
Placement
The rotation mechanism fits well inside the body of the machine,
requiring an additional fixture plate. The motor board and voltage
regulator can be fixed on the main structural plate that supports the
motor as well. Battery is placed in the front lower section for
protection and ease of access.2Hull
The second mock up allowed to size up the boards. Next, is the construction of the (hopefully) final Pi-Wars Hull.First choice is the material. We had both 3mm aluminium and 5mm polycarbonate sheets at our disposals. The final choice landed on polycarbonate for aesthetic reasons. OrangeBot will look fabulous with a carefully routed wires, transparent hull and strategically placed LEDs.
Illustration 5 - Cut Masks
Construction method was the same deployed for OBY, our beefiest
platform. First, paper mask are drawn 1:1 with the desired shape,
than the masks are applied to the sheet, that are cut using vertical
saws and drilled with a vertical drill. machine.
Illustration 6 - Cut Plates
2.1Hull Construction and Assembly
The main structural plate hosts the motors, the trailing wheel, the motor board, the battery housing, most of the wiring and give shape to the platform.
Illustration 7 - Main Structural Plate
Below the main structural plate there is a skirt section to protect components above the clearance line, like the battery. The biggest are side plates, that rests on the motor bracket wings. Like all plates, angular L and M4 bolts hold the structure together.
Illustration 8 - Side Plates
The front and rear plates close the skirt and together with ten angular elements and forty bolts, give the structure of the platform rigidity.
Illustration 9 - Front and Rear Plates
The front plate is lower on the ground, to allow the installation of the Joust Equipment Extension and the Barrel Mover Extension. The rear plate is higher to allow space for the Main Motor Board.
The Front Angular plate and the Rear Angular plates have no structural purpose and have a fixed M4 bolt holding them, allowing for quick dismounting of the plates. They are designed to come off quickly and allow maintenance of the equipment inside the platform.
Illustration 10 - Front Angular and Rear Angular
Plates
Closing the platform is the Top Plate. In future the plate might be modified to allow rapid extraction as well. The Top Plate hosts the turret rotating joint and the turret rotation servo.
Illustration 11 - Top Plate and Turret Joint
The turret rotation servo is placed inside the body to save space inside the turret itself. The pillar to connect the servo to the turret above is still being optimized. Cable runs by the side of the pillar inside the turret joint hole. Long M5x60 bolts allow regulation of height and hold the plate in position.
Illustration 12 - Top Plate and Turret Rotation
Servo
With the body of the platform taken care of, next step is to
construct the turret.2.2Dummy Turret Construction
OrangeBot is designed to have a main weapon as integral part of the platform, and not as standalone extension. Similarly, equipment is going to be always present beside the main weapon. A low power targeting laser, and the main camera. This gives the ability to aim quickly and precisely from the remote control interface, removing the need to look at the physical laser manually.Because of this, the Raspberry Pi 3B+ is best placed inside the turret, with a dedicated power and communication cable interfacing with the Main Motor Board.
Illustration 13 - Turret Component Placement
Since the main weapon design is yet to be finalized, the current turret design is only a place holder, meant to provide the minimal capability: Host the Raspberry Pi 3B+.
The MVP turret is composed by just two plates. A turret base plate to host the angular elements and the rotating joint housing and a vertical rear plate to host the RaspberryPi 3B+.
Illustration 14 - Turret Base Plate and Turret
Rear Plate
The dummy turret is attached on top of the turret rotating joint, with a pillar connecting the rotation servo with the turret top plate.
Illustration 15 - Turret Assembly
With the structure assembled, next step is to mount the electronics and route the wires.
2.3Install Electronic Boards and Route Wires
With the structure assembled, next step is to disassemble it, remove the protective film from the plates, and install all electronics and wirings.The bundle of wires coming from the encoders, the motors and the battery are cut to length, terminated and routed through an hole in the main structural plate.
Illustration 16 - Motor, Encoder and Battery
Wirings
Next step is installing the boards. First the voltage regulator board fits the Left Side Plate. Wirings fits below the Main Motor Board.
Illustration 17 - Voltage Regulator Board on Left
Side Plate
Next step is installing the Main Motor Board along with all the required wirings. An XT60 Connector goes to the battery in the lower front section. Two DC Motors and Encoder channels are routed to the front of the board. Power wirings are routed below the motor board and held in place by zip ties.
Illustration 18 - Main Motor Board on the Main
Structural Plate
Due to a reduction in scope, and to solve the “DISASTER: Turn”, the platform uses only two DC motor channels in base configuration. The Barrel Mover Extension is going to make use of the two remaining open loop DC motor channels.
With the bulk of the wirings in place, the reminder of the hull can be assembled.
Illustration 19 - Final Assembly
3Electrical Test
With the platform assembled, an electrical test was conducted to validate the platform.
Video 1 - Electrical Test
4Conclusions
The construction of the hull is a major step in the construction of the OrangeBot platform.With the hull assembled, the core of the platform is ready, and development for challenge specific extensions and core software components can continue.
A major focus is achieving high precision of the controls.
2020-01-08
2019-11-26 DISASTER Controls - Upgrade Encoder
>>>Pi Wars 2020<<<
1DISASTER: Control System
As part of the MVP development strategy, a closed loop PID control system was glued together to evaluate OrangeBot closed loop motor control capabilities.All features that enable a control system were validated:
- Quad Motor Driver
- Quad PWM Controls
- Quad Quadrature Encoder Acquisition
- Bidirectional Status and Control messages
And yet, while it was possible to tune a quad speed PID to workable if not great performance, it was not possible to tune a stable position PID at all.
Video 1: Quad Position PID Unstable
Needless to say, raw PWM controls are not Pi-Wars worthy. This
problem needs to be sorted out in order to achieve a Pi-Wars worthy
robot.1.1Architecture
The desired control system specifications are as follow:- Optimize aggressively for precision
- PID Period: 1ms
- Quad PWM Slew Rate Limiter (validated code)
- Generic 16b PID class (code)
- Quad Current PID
- Quad Speed PID with two modes of operation
- Position Ramp at low speed
- Speed at high speed
- Position Ramp at low speed
- Quad Position PID when near stop speed
1.2Problem
A through debugging, revealed that the source of the problem is quite simple. The control system is running too fast for the resolution of the encoder counters. This means the control system mostly sees zeros with some +1/-1 sprinkled in between.Using lower gains, making the control softer, eliminates the instability at the cost of precision loss. The control systems allows large errors in this configuration.
Video 2: Low gain position PID
There is an array of possible solutions given the time to the
competition:- Increase hardware encoder resolution
- Interpolate encoder to increase software resolution
- Reduce wheel diameter/Increase reducer ratio
- Reduce the PID execution frequency
2Replace Encoder
The current encoder achieves 3.6 counts per mm. We had an optical encoder laying around which has 250 pulses per turn of native resolution, we decided to replace the hall encoder with an optical one.2.1Optical Encoder
The new encoder has a ~2.0mm hole, the motor has a ~2.2mm shaft. A 2.5mm drill was modified to enlarge the hole of the encoder disk.
Illustration 1: New Optical Encoder
A full upgrade and testing on the spare motor was done before
upgrading two of OrangeBot main motors.2.2Replace Encoders
Two main motors of OrangeBot were disassembled in preparation for the upgrade.
Illustration 2: Disassembly Two Motors
Remove Encoders and Reducer. The upgrade requires the naked DC motor.
Hole of the encoder disk was
enlarged, and the disk was implanted on the encoder axis, taking care
of installing the electronics before the disk.
Illustration 4: Install Encoder
Mount the reducer stage back on the motor and solder the wires.
Electronics of the encoder is fixed via M2 screws and hot glue.
Illustration 5: Solder Wires
2.3Electronic Test
With the motors upgraded, an electrical test with an oscilloscope was conducted to test the encoder. Both direction, manual and 12V. Check that bot quadrature channels work along the full disk.
Illustration 6: Waveforms
One motors measured 33KHz frequency, the other 39KHz at 12V. This
is due to differences in free running speed. By comparison, the
previous encoder performed at about 750 Hz at 12V. The vastly
increased encoder resolution was exactly what we were looking for.3Conclusions
We were unable to increase the PID gains due to the low resolution of the encoders.Replacing the hall encoder with a much more accurate variant should allow to vastly improve the tuning or the PID controllers.
Calibration of the PID will be moved to a dedicated remote control web browser page to ease the calibration.
2020-01-07
2019-11-11 DISASTER Turn
>>>Pi Wars 2020<<<
1OrangeBot Disaster: Steering
Following the MVP design strategy, a minimal version of the planned platform layout was built to evaluate performance and feasibility.OrangeBot was designed to deploy four independently controlled fixed DC motors with encoders to achieve a good mix of speed, torque and control. In this layout, steering is achieved by having the right side motors advance at a different speed from the left side motors.
Illustration 1: OrangeBot Platform Layout
The following elements of the vertical slice were tested
successfully:- Electronics
- Motors
- Encoders
- Forward/backward motion
- Remote control using Maze Runner remote control software
stack
OrangeBot could not turn at all.
1.1Problem
OrangeBot uses the layout of our beefiest robot, OBY, in which the platform is meant to steer like a tank. During OrangeBot design, a tool was built to compute performance, allowing choice of the correct motorsOne problem, that became obvious after this disaster revealed itself, was that the tool did not (and still doesn't) account for torque that emerges when motors are not moving along the axis of motion of the platform.
Illustration 2: Out-of-Axis Steering Torque
The OBY platform was capable of producing 133.3 [Kgf] of push,
meaning the steering torque is inconsequential to OBY's operations.
By contrast, OrangeBot motors were restricted in size by the Pi Wars
rules while optimized aggressively for speed. Furthermore, a supplier
shortage meant that a faster weaker motor was chosen instead of the
design target.Compounding the problem were the high grip wheels of the platform, designed to improve precision, clearance and control. In forward motion, rolling friction is weak, but during a drag turn the sideway slide friction must instead be fought. The high grip wheels proved true to their name.
The end result was that OrangeBot was simply unable to turn, even with 100% differential power applied to all four wheels, the motors simply stalled and the platform stood like a dead stone.
2Search for a Solution
The problem was identified early enough in the project that even a full redesign would be doable within the time constraint of the Pi-Wars.Solutions considered:
- Overvolt: Overvolting the engines to 24V or
even 28V would allow for double the stall torque. It would have
(barely) solved the problem while causing overload stresses on the
reducer and causing a significant loss of precision as the platform
brute forces sharp turns.
- Lower Friction: By reducing the friction of the
wheels, the torque to fight against lowers, and turn become easier.
This solution causes loss of precision and loss of clearance.
- Smaller Wheels: By reducing diameter, torque is
increased. This causes a loss in clearance.
- Layout Change: By moving the pivot in between
torque wheel, force becomes always parallel to the wheel themselves,
solving the problem at the source. This can be achieved in several
ways.
- Replace Motors: Replacing motors with a
stronger slower variant solves the problem at the source, at the
cost of significant delivery times, redesign, rework the wheel hubs
and motor brackets and economic cost.
2.1Lower Friction
Applying black tape on the wheels was enough to lower the friction of the wheels themselves.
Video 1: Black Tape Steering
While the solution was workable in the strictest sense of the
word, it was clear that the result was not Pi-Wars worthy. Given the
time available it was decided to search for a better solution.The only solution that was not an hack and allowed to reuse the motors, was to change the layout of the platform.
3Possible Layouts
A new search for layout was conducted with an additional constraint. The wheels must always face the direction of motion projected from the pivot.Now, the pivot position moves according to the steering radious of the platform. At least some of the wheels must rotate to be parallel to the motion relative to the wheel itself resulting in three possibilities.
- Traction wheel(s) with active rotation (servo)
- Trailing wheel(s) with active rotation (servo)
- Trailing wheel with trailing rotation (roller)
Removing one of the traction axis moves the pivot in between the traction wheels, allowing them to be fixed in all turn configurations and removing half the complexity. Unfortunately, half was not enough.
With the second axis reduced to a single trailing wheel mounted on a trailing vertical axis, all the complexity is removed. This also removes the need for core joint to ensure all four wheels touch the ground.
SOLUTION: Two fixed traction wheel with one trailing rotating wheel.
4Layout Change
Solution was validated by testing a small rolling wheel.
Illustration 4: Layout validation
What followed was a design phase with fitting of components to
find out how to best design the rolling wheel. Diameter was maximized
as a bigger wheel would have allowed to reduce the clearance loss
penalty. Such rolling wheels are common, and can be found on local
hardware store.
Illustration 5: Final Layout
The final choice landed on a 60mm rolling wheel with a v-shaped
flat track.5Conclusions
A misstep during the first design phase of OrangeBot, caused the turn torque to be overlooked. This, combined with other factor, caused for motors too weak for the job to be chosen for the platform.Thanks to the MVP design strategy, the mistake was caught early on, allowing for a wide array of solution.
Final solution was to reduce the scope of the platform, replacing two traction wheels with one trailing rolling wheel.
This solution maintain precision, and lowers weight, at the cost of a slightly reduced top speed and halved pushing power of the platform.
Subscribe to:
Posts (Atom)