std::numeric_limits::min() vs. std::numeric_limits::lowest()

While this is quite a technical blog post it took me a little while to fully understand the implications on my code and I therefore would like to share this insight with my readers. This article applies to everyone who likes to use software constructs like the following one:

Looks reasonable, doesn't it? However, the tricky bit is that min() does return the minimum representable finite POSITVE value of the type provided as template argument (in this case float). If x and some_other_value are always positive, this is not a problem. If some_other_value can also be negative, above statement will not work as intented.

What is the correct solution? Use std::numeric_limtis<T>::lowest() (Only available from C++11 on!). If I print the concrete values of min(), max() and lowest() on my dev system I do get the following results:

The correct code sequence should therefore be:

This stumbling block is especially heinous because the following software construct works as desired in every case:

0

Erase the complete flash memory on a STM32 with OpenOCD

Lately I had the pleasure of working with Frank Voorburg on integrating his OpenBLT bootloader in a STM32F4 (precisely a STM32F405RG) based project. As a means to debug the microcontroller OpenOCD in combination with an Olimex ARM-USB-TINY-H JTAG adapter was used. For those not familiar with openocd, you can simply install it via

OpenOCD can be started via

However, it is necessary to have a openocd.cfg file present in the directory where openocd is invoked which defines the used microcontroller as well the used JTAG adapter. In our case openocd.cfg looked like that:

At one point of our integration effort it was necessary to erase the complete flash memory of the target microcontroller. Since the information on how to do it was not so easy to find I decided to document it here. First thing to do is to establish a telnet connection to the OpenOCD driver:

Than the execution of commands within the microcontroller needs to be stopped:

With the next command one can obtain various information about the flash present at the microcontroller:

The important thing here is that the STM32F4x uses the same flash model as the STM32F2x. This is important because the flash type 'stm32f2x' is used as a part of the next command to completely erase the flash:

Done 🙂 You have completely erased the flash of your STM32F4x microcontroller 🙂

0

Featherweight Schnauzer Part 20

Since the work on all the mechanical components of Schnauzer is complete the focus now shifts on the completion of the electrical parts. Since the ESCs and the power wiring is already installed the next step is the integration of the batteries into the system. Two 2-cell LiPo batteries with a capacity of 1800 mAh each are used. Those two batteries are connected in serial providing one 4-cell LiPo battery for the ESCs.

Because of the tight space situation in the robot the battery cables need to be shortened down a bit. This is done by cutting off the power cables and soldering a new EC3 female power plug to the cable. Attention: If you ever work with LiPo batteries make sure that the bared red cable touches the black cable at no point during your soldering process - otherwise sparks (in the best case) and an explosion (in the worst case) will ensue. At least one of the two cables needs to be fully insulated.

The next step was to manufacture an adapter which allows to create a single 4-cell battery from two 2-cell batteries. Such an adapter can be seen in the picture below and consists of two EC3 male power plugs. Those plugs are connected with the two batteries while the other end of the cable if connected to Schnauzer's power distribution system.

Since the frame of the robot is made out of Hardox (which makes it really tough to drill holes into it) I had to think of a new method to mount the batteries to the frame. Luckily I do have some spare strong neodymium magnets lying around from the beetleweight arena build.

Two of those neodymium magnets are placed on a rectangular piece of foam material (to provide some sort of cushioning from hard hits against the robots frame). Good old duct tape is used to mount everything together.

The next pictures shows the assembled battery completely covered in duct tape.

In the next picture you can see the two batteries mounted at the rear end of Schnauzer. Since each magnet has a holding forvce of ~ 110 N the batteries are held firmly against the Hardox frame. I am confident that they shall not come loose during a robot battle.

Last but not least a close up shot from the adapter which creates a single 4-cell battery out of the two 2-cell batteries. Also to be seen: The 80 A fuse 😉

Schnauzer is now ready to go 😉 Well nearly, I am still working on a last electronic component which should provide Schnauzer with an edge in the arena ... more details after the event 😉 Speaking of an event: The German Roboteers Assocation is holding a full contact featherweight competition on April 8th, 2017. More details here.

0

Ham Radio - First Steps

Dear reader! 2k16 is almost over and although this post is not a strictly LXRobotics related topic I'd like to write about it on the LXRobotics blog: In October 2016 I sucessfully took the class 1 CEPT amateur radio exam at the Oberösterreichische Fernmeldebehörde. I am now not only eligible to broadcast and listen to a lot of frequencies but also are allowed to design, develop and operate my own communication equipment. While the development of such gear is definitely something not happening too soon I purchased some commercial equipment to get started. On the picture below you can see my temporary shack located at JN78SH consisting of my old thinkbook for looking up stuff like the repeater map of Austria. As radio I am using a Kenwood TM-D700 2m/70cm radio also capable of ARPS/Packet Radio. The necessary power is supplied by a MAAS SPA-8350 13.8 V / 35 A stationary power supply unit. A Diamond SX-400N SWR & Power-Meter is used to monitor output power and standing wave ratio.

The Kenwood radio is connected via a short N-Male/N-Male cable with the SWR-Meter which in turn is connected via a 20 m N-Male/N-Male connector cable with a Diamond X300N antenna which is mounted to a refurbished traffic sign pillar. The whole construction is actually pretty high and easily reaches up to the start of the roof.

After everything was setup I was ready to go on the net. For a while I was listening to a conversation going on via the 2m repeater OE3XLS in Sandl/Langenlois. Later I tried to establish a conversation about aforementioned relais but the incoming signal was barely readable (the propagation conditions had changed). Fortunately my communication partner helped me to change frequency a couple of times which led ultimately to us having a QSO (amateur radio communication) via the 2m repeater OE3XPA at Kaiserkogel. With only 5 watts of TX power I was able to communicate reliably via the Kaiserkogel repeater. And the end of our QSO the other ham invited my to join a broadcast round on the repeater the next day which I gladly accepted. Since my shack was a only temporary first tryout I had to disassembly everything ... nonetheless I am looking forward to soon go QRV (ready to receive) in Oberwölbling/Linz again.

73 OE3LXR/OE5LXR Alex

0
Seite 2 von 47 12345...»